Showing preview only (212K chars total). Download the full file or copy to clipboard to get everything.
Repository: Splidejs/vue-splide
Branch: master
Commit: a3657c7b63aa
Files: 55
Total size: 197.0 KB
Directory structure:
gitextract_hmr2hzg6/
├── .babelrc
├── .editorconfig
├── .eslintrc
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── BUG_REPORT.yml
│ │ └── config.yml
│ └── pull_request_template.md
├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── dist/
│ └── js/
│ ├── vue-splide.cjs.js
│ └── vue-splide.esm.js
├── examples/
│ ├── .gitignore
│ ├── README.md
│ ├── index.html
│ ├── package.json
│ ├── src/
│ │ ├── App.vue
│ │ ├── components/
│ │ │ ├── AutoplayExample.vue
│ │ │ ├── BasicExample.vue
│ │ │ ├── DynamicSlideExample.vue
│ │ │ ├── ReactivityExample.vue
│ │ │ ├── ThumbnailsExample.vue
│ │ │ └── VideoExample.vue
│ │ ├── env.d.ts
│ │ ├── main.ts
│ │ └── utils/
│ │ ├── generateSlides/
│ │ │ └── generateSlides.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ └── vite.config.ts
├── jest.config.js
├── package.json
├── scripts/
│ └── copy-css.js
├── src/
│ └── js/
│ ├── build/
│ │ └── iife.ts
│ ├── components/
│ │ ├── Splide/
│ │ │ └── Splide.vue
│ │ ├── SplideSlide/
│ │ │ └── SplideSlide.vue
│ │ ├── SplideTrack/
│ │ │ └── SplideTrack.vue
│ │ └── index.ts
│ ├── constants/
│ │ ├── events.ts
│ │ └── keys.ts
│ ├── env.d.ts
│ ├── index.ts
│ ├── plugin/
│ │ └── plugin.ts
│ └── utils/
│ ├── forOwn/
│ │ ├── forOwn.ts
│ │ └── test/
│ │ └── forOwn.test.ts
│ ├── index.ts
│ ├── isEqualShallow/
│ │ ├── isEqualShallow.ts
│ │ └── test/
│ │ └── isEqualShallow.test.ts
│ ├── isObject/
│ │ ├── isObject.ts
│ │ └── test/
│ │ └── isObject.test.ts
│ └── merge/
│ ├── merge.test.ts
│ └── merge.ts
├── tsconfig.json
├── vite/
│ └── vite.config.iife.ts
└── vite.config.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": [
"@babel/preset-env"
]
}
================================================
FILE: .editorconfig
================================================
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
================================================
FILE: .eslintrc
================================================
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:vue/vue3-recommended"
],
"plugins": [
"@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"env": {
"browser": true
},
"ignorePatterns": [
"*.esm.js"
],
"rules": {
"semi": [
"error",
"always",
{
"omitLastInOneLineBlock": true
}
],
"space-in-parens": [
"error",
"always"
],
"array-bracket-spacing": [
"error",
"always"
],
"object-curly-spacing": [
"error",
"always"
],
"computed-property-spacing": [
"error",
"always"
],
"camelcase": "error",
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"eqeqeq": "error",
"indent": [
"error",
2,
{
"SwitchCase": 1,
"VariableDeclarator": "first"
}
],
"no-console": [
"error",
{
"allow": [
"error"
]
}
],
"no-empty-function": [
"error",
{
"allow": [
"methods"
]
}
],
"@typescript-eslint/no-empty-function": [
"error",
{
"allow": [
"methods"
]
}
],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
"allowArgumentsExplicitlyTypedAsAny": true
}
],
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"object": false
}
}
]
}
}
================================================
FILE: .github/FUNDING.yml
================================================
github: NaotoshiFujita
================================================
FILE: .github/ISSUE_TEMPLATE/BUG_REPORT.yml
================================================
name: Bug Report
description: Create a bug report.
labels: [ "bug" ]
body:
- type: markdown
attributes:
value: |
Thank you for taking your time to post a bug report!
Please fill out the following form. I might need to close the issue without required fields or e.g. clear repro steps.
- type: checkboxes
attributes:
label: Checks
description: Before posting a report, please check following things.
options:
- label: "Not a duplicate."
required: true
- label: "Not a question, feature request, or anything other than a bug report directly related to Vue Splide. Use Discussions for these topics: https://github.com/Splidejs/splide/discussions"
required: true
- type: input
id: version
attributes:
label: Version
description: The version where the bug happens.
placeholder: x.x.x
validations:
required: true
- type: textarea
attributes:
label: Description
description: Describe the bug.
placeholder: Provide a clear and precise description. Feel free to paste your code, screenshort, etc.
validations:
required: true
- type: input
id: reproduction-link
attributes:
label: Reproduction Link
description: A link to a reproduction (CodeSandbox, etc.). **Do not link to your project**, it has to be a minimal and fresh reproduction.
placeholder: "https://codesandbox.io/"
validations:
required: false
- type: textarea
attributes:
label: Steps to Reproduce
description: Describe steps how to reproduce the bug.
value: |
1.
2.
...
validations:
required: true
- type: textarea
attributes:
label: Expected Behaviour
description: Describe what you expected to happen.
validations:
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
================================================
FILE: .github/pull_request_template.md
================================================
<!--
Please make sure to add a new issue before you send PR!
-->
## Related Issues
<!--
Link to the issue
-->
## Description
<!-- Write a brief description here -->
================================================
FILE: .gitignore
================================================
node_modules/
.idea/
local/
================================================
FILE: .npmignore
================================================
node_modules/
images/
examples/
local/
.idea/
.github/
.editorconfig
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2020 Naotoshi Fujita
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
<div align="center">
<a href="https://splidejs.com" target="_blank">
<img width="70" src="images/logo.svg">
</a>
<a href="https://v3.vuejs.org/" target="_blank">
<img width="70" src="images/vue-logo.svg">
</a>
<h1>Vue Splide</h1>
<p>
Vue Splide is the Vue component for the
<a href="https://github.com/Splidejs/splide">Splide</a> slider/carousel.
</p>
<p>
<a href="https://splidejs.com/integration/vue-splide/">Getting Started</a>
<br>
<a href="https://splidejs.com/">Demo</a>
<br>
<a href="https://github.com/Splidejs/splide/discussions">Discussions</a>
</p>
</div>
## Caveat
The latest version only supports **Vue 3**.
You have to use the old version (0.3.5) for Vue 2, but the Splide version is also outdated.
## Quick Start
Get the latest version from NPM:
```
$ npm install @splidejs/vue-splide
```
Import CSS and components:
```vue
<template>
<Splide :options="{ rewind: true }" aria-label="Vue Splide Example">
<SplideSlide>
<img src="image1.jpg" alt="Sample 1">
</SplideSlide>
<SplideSlide>
<img src="image2.jpg" alt="Sample 2">
</SplideSlide>
</Splide>
</template>
<script>
import { Splide, SplideSlide } from '@splidejs/vue-splide';
import { defineComponent } from 'vue';
import '@splidejs/vue-splide/css';
export default defineComponent( {
components: { Splide, SplideSlide },
} );
</script>
```
Visit [here](https://splidejs.com/integration/vue-splide/) for more details.
## Support Splide
Please support the project if you like it!
- [GitHub Sponsors](https://github.com/sponsors/NaotoshiFujita)
## License
Vue Splide and Splide are released under the MIT license.
© 2022 Naotoshi Fujita
================================================
FILE: dist/js/vue-splide.cjs.js
================================================
"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
/*!
* Splide.js
* Version : 4.1.3
* License : MIT
* Copyright: 2022 Naotoshi Fujita
*/
var MEDIA_PREFERS_REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
var CREATED = 1;
var MOUNTED = 2;
var IDLE = 3;
var MOVING = 4;
var SCROLLING = 5;
var DRAGGING = 6;
var DESTROYED = 7;
var STATES = {
CREATED,
MOUNTED,
IDLE,
MOVING,
SCROLLING,
DRAGGING,
DESTROYED
};
function empty(array) {
array.length = 0;
}
function slice(arrayLike, start, end) {
return Array.prototype.slice.call(arrayLike, start, end);
}
function apply(func) {
return func.bind.apply(func, [null].concat(slice(arguments, 1)));
}
var nextTick = setTimeout;
var noop = function noop2() {
};
function raf(func) {
return requestAnimationFrame(func);
}
function typeOf(type, subject) {
return typeof subject === type;
}
function isObject$1(subject) {
return !isNull(subject) && typeOf("object", subject);
}
var isArray = Array.isArray;
var isFunction = apply(typeOf, "function");
var isString = apply(typeOf, "string");
var isUndefined = apply(typeOf, "undefined");
function isNull(subject) {
return subject === null;
}
function isHTMLElement(subject) {
try {
return subject instanceof (subject.ownerDocument.defaultView || window).HTMLElement;
} catch (e) {
return false;
}
}
function toArray(value) {
return isArray(value) ? value : [value];
}
function forEach(values, iteratee) {
toArray(values).forEach(iteratee);
}
function includes(array, value) {
return array.indexOf(value) > -1;
}
function push(array, items) {
array.push.apply(array, toArray(items));
return array;
}
function toggleClass(elm, classes, add) {
if (elm) {
forEach(classes, function(name) {
if (name) {
elm.classList[add ? "add" : "remove"](name);
}
});
}
}
function addClass(elm, classes) {
toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true);
}
function append(parent, children2) {
forEach(children2, parent.appendChild.bind(parent));
}
function before(nodes, ref) {
forEach(nodes, function(node) {
var parent = (ref || node).parentNode;
if (parent) {
parent.insertBefore(node, ref);
}
});
}
function matches(elm, selector) {
return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector);
}
function children(parent, selector) {
var children2 = parent ? slice(parent.children) : [];
return selector ? children2.filter(function(child2) {
return matches(child2, selector);
}) : children2;
}
function child(parent, selector) {
return selector ? children(parent, selector)[0] : parent.firstElementChild;
}
var ownKeys = Object.keys;
function forOwn$1(object, iteratee, right) {
if (object) {
(right ? ownKeys(object).reverse() : ownKeys(object)).forEach(function(key) {
key !== "__proto__" && iteratee(object[key], key);
});
}
return object;
}
function assign(object) {
slice(arguments, 1).forEach(function(source) {
forOwn$1(source, function(value, key) {
object[key] = source[key];
});
});
return object;
}
function merge$1(object) {
slice(arguments, 1).forEach(function(source) {
forOwn$1(source, function(value, key) {
if (isArray(value)) {
object[key] = value.slice();
} else if (isObject$1(value)) {
object[key] = merge$1({}, isObject$1(object[key]) ? object[key] : {}, value);
} else {
object[key] = value;
}
});
});
return object;
}
function omit(object, keys) {
forEach(keys || ownKeys(object), function(key) {
delete object[key];
});
}
function removeAttribute(elms, attrs) {
forEach(elms, function(elm) {
forEach(attrs, function(attr) {
elm && elm.removeAttribute(attr);
});
});
}
function setAttribute(elms, attrs, value) {
if (isObject$1(attrs)) {
forOwn$1(attrs, function(value2, name) {
setAttribute(elms, name, value2);
});
} else {
forEach(elms, function(elm) {
isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value));
});
}
}
function create(tag, attrs, parent) {
var elm = document.createElement(tag);
if (attrs) {
isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs);
}
parent && append(parent, elm);
return elm;
}
function style(elm, prop, value) {
if (isUndefined(value)) {
return getComputedStyle(elm)[prop];
}
if (!isNull(value)) {
elm.style[prop] = "" + value;
}
}
function display(elm, display2) {
style(elm, "display", display2);
}
function focus(elm) {
elm["setActive"] && elm["setActive"]() || elm.focus({
preventScroll: true
});
}
function getAttribute(elm, attr) {
return elm.getAttribute(attr);
}
function hasClass(elm, className) {
return elm && elm.classList.contains(className);
}
function rect(target) {
return target.getBoundingClientRect();
}
function remove(nodes) {
forEach(nodes, function(node) {
if (node && node.parentNode) {
node.parentNode.removeChild(node);
}
});
}
function parseHtml(html) {
return child(new DOMParser().parseFromString(html, "text/html").body);
}
function prevent(e, stopPropagation) {
e.preventDefault();
if (stopPropagation) {
e.stopPropagation();
e.stopImmediatePropagation();
}
}
function query(parent, selector) {
return parent && parent.querySelector(selector);
}
function queryAll(parent, selector) {
return selector ? slice(parent.querySelectorAll(selector)) : [];
}
function removeClass(elm, classes) {
toggleClass(elm, classes, false);
}
function timeOf(e) {
return e.timeStamp;
}
function unit(value) {
return isString(value) ? value : value ? value + "px" : "";
}
var PROJECT_CODE = "splide";
var DATA_ATTRIBUTE = "data-" + PROJECT_CODE;
function assert(condition, message) {
if (!condition) {
throw new Error("[" + PROJECT_CODE + "] " + (message || ""));
}
}
var min = Math.min, max = Math.max, floor = Math.floor, ceil = Math.ceil, abs = Math.abs;
function approximatelyEqual(x, y, epsilon) {
return abs(x - y) < epsilon;
}
function between(number, x, y, exclusive) {
var minimum = min(x, y);
var maximum = max(x, y);
return exclusive ? minimum < number && number < maximum : minimum <= number && number <= maximum;
}
function clamp(number, x, y) {
var minimum = min(x, y);
var maximum = max(x, y);
return min(max(minimum, number), maximum);
}
function sign(x) {
return +(x > 0) - +(x < 0);
}
function format(string, replacements) {
forEach(replacements, function(replacement) {
string = string.replace("%s", "" + replacement);
});
return string;
}
function pad(number) {
return number < 10 ? "0" + number : "" + number;
}
var ids = {};
function uniqueId(prefix) {
return "" + prefix + pad(ids[prefix] = (ids[prefix] || 0) + 1);
}
function EventBinder() {
var listeners = [];
function bind(targets, events, callback, options) {
forEachEvent(targets, events, function(target, event, namespace) {
var isEventTarget = "addEventListener" in target;
var remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback);
isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback);
listeners.push([target, event, namespace, callback, remover]);
});
}
function unbind(targets, events, callback) {
forEachEvent(targets, events, function(target, event, namespace) {
listeners = listeners.filter(function(listener) {
if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) {
listener[4]();
return false;
}
return true;
});
});
}
function dispatch(target, type, detail) {
var e;
var bubbles = true;
if (typeof CustomEvent === "function") {
e = new CustomEvent(type, {
bubbles,
detail
});
} else {
e = document.createEvent("CustomEvent");
e.initCustomEvent(type, bubbles, false, detail);
}
target.dispatchEvent(e);
return e;
}
function forEachEvent(targets, events, iteratee) {
forEach(targets, function(target) {
target && forEach(events, function(events2) {
events2.split(" ").forEach(function(eventNS) {
var fragment = eventNS.split(".");
iteratee(target, fragment[0], fragment[1]);
});
});
});
}
function destroy() {
listeners.forEach(function(data) {
data[4]();
});
empty(listeners);
}
return {
bind,
unbind,
dispatch,
destroy
};
}
var EVENT_MOUNTED = "mounted";
var EVENT_READY = "ready";
var EVENT_MOVE = "move";
var EVENT_MOVED = "moved";
var EVENT_CLICK = "click";
var EVENT_ACTIVE = "active";
var EVENT_INACTIVE = "inactive";
var EVENT_VISIBLE = "visible";
var EVENT_HIDDEN = "hidden";
var EVENT_REFRESH = "refresh";
var EVENT_UPDATED = "updated";
var EVENT_RESIZE = "resize";
var EVENT_RESIZED = "resized";
var EVENT_DRAG = "drag";
var EVENT_DRAGGING = "dragging";
var EVENT_DRAGGED = "dragged";
var EVENT_SCROLL = "scroll";
var EVENT_SCROLLED = "scrolled";
var EVENT_OVERFLOW = "overflow";
var EVENT_DESTROY = "destroy";
var EVENT_ARROWS_MOUNTED = "arrows:mounted";
var EVENT_ARROWS_UPDATED = "arrows:updated";
var EVENT_PAGINATION_MOUNTED = "pagination:mounted";
var EVENT_PAGINATION_UPDATED = "pagination:updated";
var EVENT_NAVIGATION_MOUNTED = "navigation:mounted";
var EVENT_AUTOPLAY_PLAY = "autoplay:play";
var EVENT_AUTOPLAY_PLAYING = "autoplay:playing";
var EVENT_AUTOPLAY_PAUSE = "autoplay:pause";
var EVENT_LAZYLOAD_LOADED = "lazyload:loaded";
var EVENT_SLIDE_KEYDOWN = "sk";
var EVENT_SHIFTED = "sh";
var EVENT_END_INDEX_CHANGED = "ei";
function EventInterface(Splide2) {
var bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment();
var binder = EventBinder();
function on(events, callback) {
binder.bind(bus, toArray(events).join(" "), function(e) {
callback.apply(callback, isArray(e.detail) ? e.detail : []);
});
}
function emit(event) {
binder.dispatch(bus, event, slice(arguments, 1));
}
if (Splide2) {
Splide2.event.on(EVENT_DESTROY, binder.destroy);
}
return assign(binder, {
bus,
on,
off: apply(binder.unbind, bus),
emit
});
}
function RequestInterval(interval, onInterval, onUpdate, limit) {
var now = Date.now;
var startTime;
var rate = 0;
var id;
var paused = true;
var count = 0;
function update() {
if (!paused) {
rate = interval ? min((now() - startTime) / interval, 1) : 1;
onUpdate && onUpdate(rate);
if (rate >= 1) {
onInterval();
startTime = now();
if (limit && ++count >= limit) {
return pause();
}
}
id = raf(update);
}
}
function start(resume) {
resume || cancel();
startTime = now() - (resume ? rate * interval : 0);
paused = false;
id = raf(update);
}
function pause() {
paused = true;
}
function rewind() {
startTime = now();
rate = 0;
if (onUpdate) {
onUpdate(rate);
}
}
function cancel() {
id && cancelAnimationFrame(id);
rate = 0;
id = 0;
paused = true;
}
function set(time) {
interval = time;
}
function isPaused() {
return paused;
}
return {
start,
rewind,
pause,
cancel,
set,
isPaused
};
}
function State(initialState) {
var state = initialState;
function set(value) {
state = value;
}
function is(states) {
return includes(toArray(states), state);
}
return {
set,
is
};
}
function Throttle(func, duration) {
var interval = RequestInterval(duration || 0, func, null, 1);
return function() {
interval.isPaused() && interval.start();
};
}
function Media(Splide2, Components2, options) {
var state = Splide2.state;
var breakpoints = options.breakpoints || {};
var reducedMotion = options.reducedMotion || {};
var binder = EventBinder();
var queries = [];
function setup() {
var isMin = options.mediaQuery === "min";
ownKeys(breakpoints).sort(function(n, m) {
return isMin ? +n - +m : +m - +n;
}).forEach(function(key) {
register(breakpoints[key], "(" + (isMin ? "min" : "max") + "-width:" + key + "px)");
});
register(reducedMotion, MEDIA_PREFERS_REDUCED_MOTION);
update();
}
function destroy(completely) {
if (completely) {
binder.destroy();
}
}
function register(options2, query2) {
var queryList = matchMedia(query2);
binder.bind(queryList, "change", update);
queries.push([options2, queryList]);
}
function update() {
var destroyed = state.is(DESTROYED);
var direction = options.direction;
var merged = queries.reduce(function(merged2, entry) {
return merge$1(merged2, entry[1].matches ? entry[0] : {});
}, {});
omit(options);
set(merged);
if (options.destroy) {
Splide2.destroy(options.destroy === "completely");
} else if (destroyed) {
destroy(true);
Splide2.mount();
} else {
direction !== options.direction && Splide2.refresh();
}
}
function reduce(enable) {
if (matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches) {
enable ? merge$1(options, reducedMotion) : omit(options, ownKeys(reducedMotion));
}
}
function set(opts, base, notify) {
merge$1(options, opts);
base && merge$1(Object.getPrototypeOf(options), opts);
if (notify || !state.is(CREATED)) {
Splide2.emit(EVENT_UPDATED, options);
}
}
return {
setup,
destroy,
reduce,
set
};
}
var ARROW = "Arrow";
var ARROW_LEFT = ARROW + "Left";
var ARROW_RIGHT = ARROW + "Right";
var ARROW_UP = ARROW + "Up";
var ARROW_DOWN = ARROW + "Down";
var RTL = "rtl";
var TTB = "ttb";
var ORIENTATION_MAP = {
width: ["height"],
left: ["top", "right"],
right: ["bottom", "left"],
x: ["y"],
X: ["Y"],
Y: ["X"],
ArrowLeft: [ARROW_UP, ARROW_RIGHT],
ArrowRight: [ARROW_DOWN, ARROW_LEFT]
};
function Direction(Splide2, Components2, options) {
function resolve(prop, axisOnly, direction) {
direction = direction || options.direction;
var index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1;
return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, function(match, offset) {
var replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match;
return offset > 0 ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement;
});
}
function orient(value) {
return value * (options.direction === RTL ? 1 : -1);
}
return {
resolve,
orient
};
}
var ROLE = "role";
var TAB_INDEX = "tabindex";
var DISABLED = "disabled";
var ARIA_PREFIX = "aria-";
var ARIA_CONTROLS = ARIA_PREFIX + "controls";
var ARIA_CURRENT = ARIA_PREFIX + "current";
var ARIA_SELECTED = ARIA_PREFIX + "selected";
var ARIA_LABEL = ARIA_PREFIX + "label";
var ARIA_LABELLEDBY = ARIA_PREFIX + "labelledby";
var ARIA_HIDDEN = ARIA_PREFIX + "hidden";
var ARIA_ORIENTATION = ARIA_PREFIX + "orientation";
var ARIA_ROLEDESCRIPTION = ARIA_PREFIX + "roledescription";
var ARIA_LIVE = ARIA_PREFIX + "live";
var ARIA_BUSY = ARIA_PREFIX + "busy";
var ARIA_ATOMIC = ARIA_PREFIX + "atomic";
var ALL_ATTRIBUTES = [ROLE, TAB_INDEX, DISABLED, ARIA_CONTROLS, ARIA_CURRENT, ARIA_LABEL, ARIA_LABELLEDBY, ARIA_HIDDEN, ARIA_ORIENTATION, ARIA_ROLEDESCRIPTION];
var CLASS_PREFIX = PROJECT_CODE + "__";
var STATUS_CLASS_PREFIX = "is-";
var CLASS_ROOT = PROJECT_CODE;
var CLASS_TRACK = CLASS_PREFIX + "track";
var CLASS_LIST = CLASS_PREFIX + "list";
var CLASS_SLIDE = CLASS_PREFIX + "slide";
var CLASS_CLONE = CLASS_SLIDE + "--clone";
var CLASS_CONTAINER = CLASS_SLIDE + "__container";
var CLASS_ARROWS = CLASS_PREFIX + "arrows";
var CLASS_ARROW = CLASS_PREFIX + "arrow";
var CLASS_ARROW_PREV = CLASS_ARROW + "--prev";
var CLASS_ARROW_NEXT = CLASS_ARROW + "--next";
var CLASS_PAGINATION = CLASS_PREFIX + "pagination";
var CLASS_PAGINATION_PAGE = CLASS_PAGINATION + "__page";
var CLASS_PROGRESS = CLASS_PREFIX + "progress";
var CLASS_PROGRESS_BAR = CLASS_PROGRESS + "__bar";
var CLASS_TOGGLE = CLASS_PREFIX + "toggle";
var CLASS_SPINNER = CLASS_PREFIX + "spinner";
var CLASS_SR = CLASS_PREFIX + "sr";
var CLASS_INITIALIZED = STATUS_CLASS_PREFIX + "initialized";
var CLASS_ACTIVE = STATUS_CLASS_PREFIX + "active";
var CLASS_PREV = STATUS_CLASS_PREFIX + "prev";
var CLASS_NEXT = STATUS_CLASS_PREFIX + "next";
var CLASS_VISIBLE = STATUS_CLASS_PREFIX + "visible";
var CLASS_LOADING = STATUS_CLASS_PREFIX + "loading";
var CLASS_FOCUS_IN = STATUS_CLASS_PREFIX + "focus-in";
var CLASS_OVERFLOW = STATUS_CLASS_PREFIX + "overflow";
var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING, CLASS_FOCUS_IN, CLASS_OVERFLOW];
var CLASSES = {
slide: CLASS_SLIDE,
clone: CLASS_CLONE,
arrows: CLASS_ARROWS,
arrow: CLASS_ARROW,
prev: CLASS_ARROW_PREV,
next: CLASS_ARROW_NEXT,
pagination: CLASS_PAGINATION,
page: CLASS_PAGINATION_PAGE,
spinner: CLASS_SPINNER
};
function closest(from, selector) {
if (isFunction(from.closest)) {
return from.closest(selector);
}
var elm = from;
while (elm && elm.nodeType === 1) {
if (matches(elm, selector)) {
break;
}
elm = elm.parentElement;
}
return elm;
}
var FRICTION = 5;
var LOG_INTERVAL = 200;
var POINTER_DOWN_EVENTS = "touchstart mousedown";
var POINTER_MOVE_EVENTS = "touchmove mousemove";
var POINTER_UP_EVENTS = "touchend touchcancel mouseup click";
function Elements(Splide2, Components2, options) {
var _EventInterface = EventInterface(Splide2), on = _EventInterface.on, bind = _EventInterface.bind;
var root = Splide2.root;
var i18n = options.i18n;
var elements = {};
var slides = [];
var rootClasses = [];
var trackClasses = [];
var track;
var list;
var isUsingKey;
function setup() {
collect();
init();
update();
}
function mount() {
on(EVENT_REFRESH, destroy);
on(EVENT_REFRESH, setup);
on(EVENT_UPDATED, update);
bind(document, POINTER_DOWN_EVENTS + " keydown", function(e) {
isUsingKey = e.type === "keydown";
}, {
capture: true
});
bind(root, "focusin", function() {
toggleClass(root, CLASS_FOCUS_IN, !!isUsingKey);
});
}
function destroy(completely) {
var attrs = ALL_ATTRIBUTES.concat("style");
empty(slides);
removeClass(root, rootClasses);
removeClass(track, trackClasses);
removeAttribute([track, list], attrs);
removeAttribute(root, completely ? attrs : ["style", ARIA_ROLEDESCRIPTION]);
}
function update() {
removeClass(root, rootClasses);
removeClass(track, trackClasses);
rootClasses = getClasses(CLASS_ROOT);
trackClasses = getClasses(CLASS_TRACK);
addClass(root, rootClasses);
addClass(track, trackClasses);
setAttribute(root, ARIA_LABEL, options.label);
setAttribute(root, ARIA_LABELLEDBY, options.labelledby);
}
function collect() {
track = find("." + CLASS_TRACK);
list = child(track, "." + CLASS_LIST);
assert(track && list, "A track/list element is missing.");
push(slides, children(list, "." + CLASS_SLIDE + ":not(." + CLASS_CLONE + ")"));
forOwn$1({
arrows: CLASS_ARROWS,
pagination: CLASS_PAGINATION,
prev: CLASS_ARROW_PREV,
next: CLASS_ARROW_NEXT,
bar: CLASS_PROGRESS_BAR,
toggle: CLASS_TOGGLE
}, function(className, key) {
elements[key] = find("." + className);
});
assign(elements, {
root,
track,
list,
slides
});
}
function init() {
var id = root.id || uniqueId(PROJECT_CODE);
var role = options.role;
root.id = id;
track.id = track.id || id + "-track";
list.id = list.id || id + "-list";
if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) {
setAttribute(root, ROLE, role);
}
setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel);
setAttribute(list, ROLE, "presentation");
}
function find(selector) {
var elm = query(root, selector);
return elm && closest(elm, "." + CLASS_ROOT) === root ? elm : void 0;
}
function getClasses(base) {
return [base + "--" + options.type, base + "--" + options.direction, options.drag && base + "--draggable", options.isNavigation && base + "--nav", base === CLASS_ROOT && CLASS_ACTIVE];
}
return assign(elements, {
setup,
mount,
destroy
});
}
var SLIDE = "slide";
var LOOP = "loop";
var FADE = "fade";
function Slide$1(Splide2, index, slideIndex, slide) {
var event = EventInterface(Splide2);
var on = event.on, emit = event.emit, bind = event.bind;
var Components = Splide2.Components, root = Splide2.root, options = Splide2.options;
var isNavigation = options.isNavigation, updateOnMove = options.updateOnMove, i18n = options.i18n, pagination = options.pagination, slideFocus = options.slideFocus;
var resolve = Components.Direction.resolve;
var styles = getAttribute(slide, "style");
var label = getAttribute(slide, ARIA_LABEL);
var isClone = slideIndex > -1;
var container = child(slide, "." + CLASS_CONTAINER);
var destroyed;
function mount() {
if (!isClone) {
slide.id = root.id + "-slide" + pad(index + 1);
setAttribute(slide, ROLE, pagination ? "tabpanel" : "group");
setAttribute(slide, ARIA_ROLEDESCRIPTION, i18n.slide);
setAttribute(slide, ARIA_LABEL, label || format(i18n.slideLabel, [index + 1, Splide2.length]));
}
listen();
}
function listen() {
bind(slide, "click", apply(emit, EVENT_CLICK, self));
bind(slide, "keydown", apply(emit, EVENT_SLIDE_KEYDOWN, self));
on([EVENT_MOVED, EVENT_SHIFTED, EVENT_SCROLLED], update);
on(EVENT_NAVIGATION_MOUNTED, initNavigation);
if (updateOnMove) {
on(EVENT_MOVE, onMove);
}
}
function destroy() {
destroyed = true;
event.destroy();
removeClass(slide, STATUS_CLASSES);
removeAttribute(slide, ALL_ATTRIBUTES);
setAttribute(slide, "style", styles);
setAttribute(slide, ARIA_LABEL, label || "");
}
function initNavigation() {
var controls = Splide2.splides.map(function(target) {
var Slide2 = target.splide.Components.Slides.getAt(index);
return Slide2 ? Slide2.slide.id : "";
}).join(" ");
setAttribute(slide, ARIA_LABEL, format(i18n.slideX, (isClone ? slideIndex : index) + 1));
setAttribute(slide, ARIA_CONTROLS, controls);
setAttribute(slide, ROLE, slideFocus ? "button" : "");
slideFocus && removeAttribute(slide, ARIA_ROLEDESCRIPTION);
}
function onMove() {
if (!destroyed) {
update();
}
}
function update() {
if (!destroyed) {
var curr = Splide2.index;
updateActivity();
updateVisibility();
toggleClass(slide, CLASS_PREV, index === curr - 1);
toggleClass(slide, CLASS_NEXT, index === curr + 1);
}
}
function updateActivity() {
var active = isActive();
if (active !== hasClass(slide, CLASS_ACTIVE)) {
toggleClass(slide, CLASS_ACTIVE, active);
setAttribute(slide, ARIA_CURRENT, isNavigation && active || "");
emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self);
}
}
function updateVisibility() {
var visible = isVisible();
var hidden = !visible && (!isActive() || isClone);
if (!Splide2.state.is([MOVING, SCROLLING])) {
setAttribute(slide, ARIA_HIDDEN, hidden || "");
}
setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : "");
if (slideFocus) {
setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);
}
if (visible !== hasClass(slide, CLASS_VISIBLE)) {
toggleClass(slide, CLASS_VISIBLE, visible);
emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self);
}
if (!visible && document.activeElement === slide) {
var Slide2 = Components.Slides.getAt(Splide2.index);
Slide2 && focus(Slide2.slide);
}
}
function style$1(prop, value, useContainer) {
style(useContainer && container || slide, prop, value);
}
function isActive() {
var curr = Splide2.index;
return curr === index || options.cloneStatus && curr === slideIndex;
}
function isVisible() {
if (Splide2.is(FADE)) {
return isActive();
}
var trackRect = rect(Components.Elements.track);
var slideRect = rect(slide);
var left = resolve("left", true);
var right = resolve("right", true);
return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]);
}
function isWithin(from, distance) {
var diff = abs(from - index);
if (!isClone && (options.rewind || Splide2.is(LOOP))) {
diff = min(diff, Splide2.length - diff);
}
return diff <= distance;
}
var self = {
index,
slideIndex,
slide,
container,
isClone,
mount,
destroy,
update,
style: style$1,
isWithin
};
return self;
}
function Slides(Splide2, Components2, options) {
var _EventInterface2 = EventInterface(Splide2), on = _EventInterface2.on, emit = _EventInterface2.emit, bind = _EventInterface2.bind;
var _Components2$Elements = Components2.Elements, slides = _Components2$Elements.slides, list = _Components2$Elements.list;
var Slides2 = [];
function mount() {
init();
on(EVENT_REFRESH, destroy);
on(EVENT_REFRESH, init);
}
function init() {
slides.forEach(function(slide, index) {
register(slide, index, -1);
});
}
function destroy() {
forEach$1(function(Slide2) {
Slide2.destroy();
});
empty(Slides2);
}
function update() {
forEach$1(function(Slide2) {
Slide2.update();
});
}
function register(slide, index, slideIndex) {
var object = Slide$1(Splide2, index, slideIndex, slide);
object.mount();
Slides2.push(object);
Slides2.sort(function(Slide1, Slide2) {
return Slide1.index - Slide2.index;
});
}
function get(excludeClones) {
return excludeClones ? filter(function(Slide2) {
return !Slide2.isClone;
}) : Slides2;
}
function getIn(page) {
var Controller2 = Components2.Controller;
var index = Controller2.toIndex(page);
var max2 = Controller2.hasFocus() ? 1 : options.perPage;
return filter(function(Slide2) {
return between(Slide2.index, index, index + max2 - 1);
});
}
function getAt(index) {
return filter(index)[0];
}
function add(items, index) {
forEach(items, function(slide) {
if (isString(slide)) {
slide = parseHtml(slide);
}
if (isHTMLElement(slide)) {
var ref = slides[index];
ref ? before(slide, ref) : append(list, slide);
addClass(slide, options.classes.slide);
observeImages(slide, apply(emit, EVENT_RESIZE));
}
});
emit(EVENT_REFRESH);
}
function remove$1(matcher) {
remove(filter(matcher).map(function(Slide2) {
return Slide2.slide;
}));
emit(EVENT_REFRESH);
}
function forEach$1(iteratee, excludeClones) {
get(excludeClones).forEach(iteratee);
}
function filter(matcher) {
return Slides2.filter(isFunction(matcher) ? matcher : function(Slide2) {
return isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index);
});
}
function style2(prop, value, useContainer) {
forEach$1(function(Slide2) {
Slide2.style(prop, value, useContainer);
});
}
function observeImages(elm, callback) {
var images = queryAll(elm, "img");
var length = images.length;
if (length) {
images.forEach(function(img) {
bind(img, "load error", function() {
if (!--length) {
callback();
}
});
});
} else {
callback();
}
}
function getLength(excludeClones) {
return excludeClones ? slides.length : Slides2.length;
}
function isEnough() {
return Slides2.length > options.perPage;
}
return {
mount,
destroy,
update,
register,
get,
getIn,
getAt,
add,
remove: remove$1,
forEach: forEach$1,
filter,
style: style2,
getLength,
isEnough
};
}
function Layout(Splide2, Components2, options) {
var _EventInterface3 = EventInterface(Splide2), on = _EventInterface3.on, bind = _EventInterface3.bind, emit = _EventInterface3.emit;
var Slides2 = Components2.Slides;
var resolve = Components2.Direction.resolve;
var _Components2$Elements2 = Components2.Elements, root = _Components2$Elements2.root, track = _Components2$Elements2.track, list = _Components2$Elements2.list;
var getAt = Slides2.getAt, styleSlides = Slides2.style;
var vertical;
var rootRect;
var overflow;
function mount() {
init();
bind(window, "resize load", Throttle(apply(emit, EVENT_RESIZE)));
on([EVENT_UPDATED, EVENT_REFRESH], init);
on(EVENT_RESIZE, resize);
}
function init() {
vertical = options.direction === TTB;
style(root, "maxWidth", unit(options.width));
style(track, resolve("paddingLeft"), cssPadding(false));
style(track, resolve("paddingRight"), cssPadding(true));
resize(true);
}
function resize(force) {
var newRect = rect(root);
if (force || rootRect.width !== newRect.width || rootRect.height !== newRect.height) {
style(track, "height", cssTrackHeight());
styleSlides(resolve("marginRight"), unit(options.gap));
styleSlides("width", cssSlideWidth());
styleSlides("height", cssSlideHeight(), true);
rootRect = newRect;
emit(EVENT_RESIZED);
if (overflow !== (overflow = isOverflow())) {
toggleClass(root, CLASS_OVERFLOW, overflow);
emit(EVENT_OVERFLOW, overflow);
}
}
}
function cssPadding(right) {
var padding = options.padding;
var prop = resolve(right ? "right" : "left");
return padding && unit(padding[prop] || (isObject$1(padding) ? 0 : padding)) || "0px";
}
function cssTrackHeight() {
var height = "";
if (vertical) {
height = cssHeight();
assert(height, "height or heightRatio is missing.");
height = "calc(" + height + " - " + cssPadding(false) + " - " + cssPadding(true) + ")";
}
return height;
}
function cssHeight() {
return unit(options.height || rect(list).width * options.heightRatio);
}
function cssSlideWidth() {
return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
}
function cssSlideHeight() {
return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight());
}
function cssSlideSize() {
var gap = unit(options.gap);
return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")";
}
function listSize() {
return rect(list)[resolve("width")];
}
function slideSize(index, withoutGap) {
var Slide2 = getAt(index || 0);
return Slide2 ? rect(Slide2.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0;
}
function totalSize(index, withoutGap) {
var Slide2 = getAt(index);
if (Slide2) {
var right = rect(Slide2.slide)[resolve("right")];
var left = rect(list)[resolve("left")];
return abs(right - left) + (withoutGap ? 0 : getGap());
}
return 0;
}
function sliderSize(withoutGap) {
return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, withoutGap);
}
function getGap() {
var Slide2 = getAt(0);
return Slide2 && parseFloat(style(Slide2.slide, resolve("marginRight"))) || 0;
}
function getPadding(right) {
return parseFloat(style(track, resolve("padding" + (right ? "Right" : "Left")))) || 0;
}
function isOverflow() {
return Splide2.is(FADE) || sliderSize(true) > listSize();
}
return {
mount,
resize,
listSize,
slideSize,
sliderSize,
totalSize,
getPadding,
isOverflow
};
}
var MULTIPLIER = 2;
function Clones(Splide2, Components2, options) {
var event = EventInterface(Splide2);
var on = event.on;
var Elements2 = Components2.Elements, Slides2 = Components2.Slides;
var resolve = Components2.Direction.resolve;
var clones = [];
var cloneCount;
function mount() {
on(EVENT_REFRESH, remount);
on([EVENT_UPDATED, EVENT_RESIZE], observe);
if (cloneCount = computeCloneCount()) {
generate(cloneCount);
Components2.Layout.resize(true);
}
}
function remount() {
destroy();
mount();
}
function destroy() {
remove(clones);
empty(clones);
event.destroy();
}
function observe() {
var count = computeCloneCount();
if (cloneCount !== count) {
if (cloneCount < count || !count) {
event.emit(EVENT_REFRESH);
}
}
}
function generate(count) {
var slides = Slides2.get().slice();
var length = slides.length;
if (length) {
while (slides.length < count) {
push(slides, slides);
}
push(slides.slice(-count), slides.slice(0, count)).forEach(function(Slide2, index) {
var isHead = index < count;
var clone = cloneDeep(Slide2.slide, index);
isHead ? before(clone, slides[0].slide) : append(Elements2.list, clone);
push(clones, clone);
Slides2.register(clone, index - count + (isHead ? 0 : length), Slide2.index);
});
}
}
function cloneDeep(elm, index) {
var clone = elm.cloneNode(true);
addClass(clone, options.classes.clone);
clone.id = Splide2.root.id + "-clone" + pad(index + 1);
return clone;
}
function computeCloneCount() {
var clones2 = options.clones;
if (!Splide2.is(LOOP)) {
clones2 = 0;
} else if (isUndefined(clones2)) {
var fixedSize = options[resolve("fixedWidth")] && Components2.Layout.slideSize(0);
var fixedCount = fixedSize && ceil(rect(Elements2.track)[resolve("width")] / fixedSize);
clones2 = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage * MULTIPLIER;
}
return clones2;
}
return {
mount,
destroy
};
}
function Move(Splide2, Components2, options) {
var _EventInterface4 = EventInterface(Splide2), on = _EventInterface4.on, emit = _EventInterface4.emit;
var set = Splide2.state.set;
var _Components2$Layout = Components2.Layout, slideSize = _Components2$Layout.slideSize, getPadding = _Components2$Layout.getPadding, totalSize = _Components2$Layout.totalSize, listSize = _Components2$Layout.listSize, sliderSize = _Components2$Layout.sliderSize;
var _Components2$Directio = Components2.Direction, resolve = _Components2$Directio.resolve, orient = _Components2$Directio.orient;
var _Components2$Elements3 = Components2.Elements, list = _Components2$Elements3.list, track = _Components2$Elements3.track;
var Transition;
function mount() {
Transition = Components2.Transition;
on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition);
}
function reposition() {
if (!Components2.Controller.isBusy()) {
Components2.Scroll.cancel();
jump(Splide2.index);
Components2.Slides.update();
}
}
function move(dest, index, prev, callback) {
if (dest !== index && canShift(dest > prev)) {
cancel();
translate(shift(getPosition(), dest > prev), true);
}
set(MOVING);
emit(EVENT_MOVE, index, prev, dest);
Transition.start(index, function() {
set(IDLE);
emit(EVENT_MOVED, index, prev, dest);
callback && callback();
});
}
function jump(index) {
translate(toPosition(index, true));
}
function translate(position, preventLoop) {
if (!Splide2.is(FADE)) {
var destination = preventLoop ? position : loop(position);
style(list, "transform", "translate" + resolve("X") + "(" + destination + "px)");
position !== destination && emit(EVENT_SHIFTED);
}
}
function loop(position) {
if (Splide2.is(LOOP)) {
var index = toIndex(position);
var exceededMax = index > Components2.Controller.getEnd();
var exceededMin = index < 0;
if (exceededMin || exceededMax) {
position = shift(position, exceededMax);
}
}
return position;
}
function shift(position, backwards) {
var excess = position - getLimit(backwards);
var size = sliderSize();
position -= orient(size * (ceil(abs(excess) / size) || 1)) * (backwards ? 1 : -1);
return position;
}
function cancel() {
translate(getPosition(), true);
Transition.cancel();
}
function toIndex(position) {
var Slides2 = Components2.Slides.get();
var index = 0;
var minDistance = Infinity;
for (var i = 0; i < Slides2.length; i++) {
var slideIndex = Slides2[i].index;
var distance = abs(toPosition(slideIndex, true) - position);
if (distance <= minDistance) {
minDistance = distance;
index = slideIndex;
} else {
break;
}
}
return index;
}
function toPosition(index, trimming) {
var position = orient(totalSize(index - 1) - offset(index));
return trimming ? trim(position) : position;
}
function getPosition() {
var left = resolve("left");
return rect(list)[left] - rect(track)[left] + orient(getPadding(false));
}
function trim(position) {
if (options.trimSpace && Splide2.is(SLIDE)) {
position = clamp(position, 0, orient(sliderSize(true) - listSize()));
}
return position;
}
function offset(index) {
var focus2 = options.focus;
return focus2 === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus2 * slideSize(index) || 0;
}
function getLimit(max2) {
return toPosition(max2 ? Components2.Controller.getEnd() : 0, !!options.trimSpace);
}
function canShift(backwards) {
var shifted = orient(shift(getPosition(), backwards));
return backwards ? shifted >= 0 : shifted <= list[resolve("scrollWidth")] - rect(track)[resolve("width")];
}
function exceededLimit(max2, position) {
position = isUndefined(position) ? getPosition() : position;
var exceededMin = max2 !== true && orient(position) < orient(getLimit(false));
var exceededMax = max2 !== false && orient(position) > orient(getLimit(true));
return exceededMin || exceededMax;
}
return {
mount,
move,
jump,
translate,
shift,
cancel,
toIndex,
toPosition,
getPosition,
getLimit,
exceededLimit,
reposition
};
}
function Controller(Splide2, Components2, options) {
var _EventInterface5 = EventInterface(Splide2), on = _EventInterface5.on, emit = _EventInterface5.emit;
var Move2 = Components2.Move;
var getPosition = Move2.getPosition, getLimit = Move2.getLimit, toPosition = Move2.toPosition;
var _Components2$Slides = Components2.Slides, isEnough = _Components2$Slides.isEnough, getLength = _Components2$Slides.getLength;
var omitEnd = options.omitEnd;
var isLoop = Splide2.is(LOOP);
var isSlide = Splide2.is(SLIDE);
var getNext = apply(getAdjacent, false);
var getPrev = apply(getAdjacent, true);
var currIndex = options.start || 0;
var endIndex;
var prevIndex = currIndex;
var slideCount;
var perMove;
var perPage;
function mount() {
init();
on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], init);
on(EVENT_RESIZED, onResized);
}
function init() {
slideCount = getLength(true);
perMove = options.perMove;
perPage = options.perPage;
endIndex = getEnd();
var index = clamp(currIndex, 0, omitEnd ? endIndex : slideCount - 1);
if (index !== currIndex) {
currIndex = index;
Move2.reposition();
}
}
function onResized() {
if (endIndex !== getEnd()) {
emit(EVENT_END_INDEX_CHANGED);
}
}
function go(control, allowSameIndex, callback) {
if (!isBusy()) {
var dest = parse(control);
var index = loop(dest);
if (index > -1 && (allowSameIndex || index !== currIndex)) {
setIndex(index);
Move2.move(dest, index, prevIndex, callback);
}
}
}
function scroll(destination, duration, snap, callback) {
Components2.Scroll.scroll(destination, duration, snap, function() {
var index = loop(Move2.toIndex(getPosition()));
setIndex(omitEnd ? min(index, endIndex) : index);
callback && callback();
});
}
function parse(control) {
var index = currIndex;
if (isString(control)) {
var _ref = control.match(/([+\-<>])(\d+)?/) || [], indicator = _ref[1], number = _ref[2];
if (indicator === "+" || indicator === "-") {
index = computeDestIndex(currIndex + +("" + indicator + (+number || 1)), currIndex);
} else if (indicator === ">") {
index = number ? toIndex(+number) : getNext(true);
} else if (indicator === "<") {
index = getPrev(true);
}
} else {
index = isLoop ? control : clamp(control, 0, endIndex);
}
return index;
}
function getAdjacent(prev, destination) {
var number = perMove || (hasFocus() ? 1 : perPage);
var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex, !(perMove || hasFocus()));
if (dest === -1 && isSlide) {
if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) {
return prev ? 0 : endIndex;
}
}
return destination ? dest : loop(dest);
}
function computeDestIndex(dest, from, snapPage) {
if (isEnough() || hasFocus()) {
var index = computeMovableDestIndex(dest);
if (index !== dest) {
from = dest;
dest = index;
snapPage = false;
}
if (dest < 0 || dest > endIndex) {
if (!perMove && (between(0, dest, from, true) || between(endIndex, from, dest, true))) {
dest = toIndex(toPage(dest));
} else {
if (isLoop) {
dest = snapPage ? dest < 0 ? -(slideCount % perPage || perPage) : slideCount : dest;
} else if (options.rewind) {
dest = dest < 0 ? endIndex : 0;
} else {
dest = -1;
}
}
} else {
if (snapPage && dest !== from) {
dest = toIndex(toPage(from) + (dest < from ? -1 : 1));
}
}
} else {
dest = -1;
}
return dest;
}
function computeMovableDestIndex(dest) {
if (isSlide && options.trimSpace === "move" && dest !== currIndex) {
var position = getPosition();
while (position === toPosition(dest, true) && between(dest, 0, Splide2.length - 1, !options.rewind)) {
dest < currIndex ? --dest : ++dest;
}
}
return dest;
}
function loop(index) {
return isLoop ? (index + slideCount) % slideCount || 0 : index;
}
function getEnd() {
var end = slideCount - (hasFocus() || isLoop && perMove ? 1 : perPage);
while (omitEnd && end-- > 0) {
if (toPosition(slideCount - 1, true) !== toPosition(end, true)) {
end++;
break;
}
}
return clamp(end, 0, slideCount - 1);
}
function toIndex(page) {
return clamp(hasFocus() ? page : perPage * page, 0, endIndex);
}
function toPage(index) {
return hasFocus() ? min(index, endIndex) : floor((index >= endIndex ? slideCount - 1 : index) / perPage);
}
function toDest(destination) {
var closest2 = Move2.toIndex(destination);
return isSlide ? clamp(closest2, 0, endIndex) : closest2;
}
function setIndex(index) {
if (index !== currIndex) {
prevIndex = currIndex;
currIndex = index;
}
}
function getIndex(prev) {
return prev ? prevIndex : currIndex;
}
function hasFocus() {
return !isUndefined(options.focus) || options.isNavigation;
}
function isBusy() {
return Splide2.state.is([MOVING, SCROLLING]) && !!options.waitForTransition;
}
return {
mount,
go,
scroll,
getNext,
getPrev,
getAdjacent,
getEnd,
setIndex,
getIndex,
toIndex,
toPage,
toDest,
hasFocus,
isBusy
};
}
var XML_NAME_SPACE = "http://www.w3.org/2000/svg";
var PATH = "m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z";
var SIZE = 40;
function Arrows(Splide2, Components2, options) {
var event = EventInterface(Splide2);
var on = event.on, bind = event.bind, emit = event.emit;
var classes = options.classes, i18n = options.i18n;
var Elements2 = Components2.Elements, Controller2 = Components2.Controller;
var placeholder = Elements2.arrows, track = Elements2.track;
var wrapper = placeholder;
var prev = Elements2.prev;
var next = Elements2.next;
var created;
var wrapperClasses;
var arrows = {};
function mount() {
init();
on(EVENT_UPDATED, remount);
}
function remount() {
destroy();
mount();
}
function init() {
var enabled = options.arrows;
if (enabled && !(prev && next)) {
createArrows();
}
if (prev && next) {
assign(arrows, {
prev,
next
});
display(wrapper, enabled ? "" : "none");
addClass(wrapper, wrapperClasses = CLASS_ARROWS + "--" + options.direction);
if (enabled) {
listen();
update();
setAttribute([prev, next], ARIA_CONTROLS, track.id);
emit(EVENT_ARROWS_MOUNTED, prev, next);
}
}
}
function destroy() {
event.destroy();
removeClass(wrapper, wrapperClasses);
if (created) {
remove(placeholder ? [prev, next] : wrapper);
prev = next = null;
} else {
removeAttribute([prev, next], ALL_ATTRIBUTES);
}
}
function listen() {
on([EVENT_MOUNTED, EVENT_MOVED, EVENT_REFRESH, EVENT_SCROLLED, EVENT_END_INDEX_CHANGED], update);
bind(next, "click", apply(go, ">"));
bind(prev, "click", apply(go, "<"));
}
function go(control) {
Controller2.go(control, true);
}
function createArrows() {
wrapper = placeholder || create("div", classes.arrows);
prev = createArrow(true);
next = createArrow(false);
created = true;
append(wrapper, [prev, next]);
!placeholder && before(wrapper, track);
}
function createArrow(prev2) {
var arrow = '<button class="' + classes.arrow + " " + (prev2 ? classes.prev : classes.next) + '" type="button"><svg xmlns="' + XML_NAME_SPACE + '" viewBox="0 0 ' + SIZE + " " + SIZE + '" width="' + SIZE + '" height="' + SIZE + '" focusable="false"><path d="' + (options.arrowPath || PATH) + '" />';
return parseHtml(arrow);
}
function update() {
if (prev && next) {
var index = Splide2.index;
var prevIndex = Controller2.getPrev();
var nextIndex = Controller2.getNext();
var prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev;
var nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next;
prev.disabled = prevIndex < 0;
next.disabled = nextIndex < 0;
setAttribute(prev, ARIA_LABEL, prevLabel);
setAttribute(next, ARIA_LABEL, nextLabel);
emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex);
}
}
return {
arrows,
mount,
destroy,
update
};
}
var INTERVAL_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-interval";
function Autoplay(Splide2, Components2, options) {
var _EventInterface6 = EventInterface(Splide2), on = _EventInterface6.on, bind = _EventInterface6.bind, emit = _EventInterface6.emit;
var interval = RequestInterval(options.interval, Splide2.go.bind(Splide2, ">"), onAnimationFrame);
var isPaused = interval.isPaused;
var Elements2 = Components2.Elements, _Components2$Elements4 = Components2.Elements, root = _Components2$Elements4.root, toggle = _Components2$Elements4.toggle;
var autoplay = options.autoplay;
var hovered;
var focused;
var stopped = autoplay === "pause";
function mount() {
if (autoplay) {
listen();
toggle && setAttribute(toggle, ARIA_CONTROLS, Elements2.track.id);
stopped || play();
update();
}
}
function listen() {
if (options.pauseOnHover) {
bind(root, "mouseenter mouseleave", function(e) {
hovered = e.type === "mouseenter";
autoToggle();
});
}
if (options.pauseOnFocus) {
bind(root, "focusin focusout", function(e) {
focused = e.type === "focusin";
autoToggle();
});
}
if (toggle) {
bind(toggle, "click", function() {
stopped ? play() : pause(true);
});
}
on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind);
on(EVENT_MOVE, onMove);
}
function play() {
if (isPaused() && Components2.Slides.isEnough()) {
interval.start(!options.resetProgress);
focused = hovered = stopped = false;
update();
emit(EVENT_AUTOPLAY_PLAY);
}
}
function pause(stop) {
if (stop === void 0) {
stop = true;
}
stopped = !!stop;
update();
if (!isPaused()) {
interval.pause();
emit(EVENT_AUTOPLAY_PAUSE);
}
}
function autoToggle() {
if (!stopped) {
hovered || focused ? pause(false) : play();
}
}
function update() {
if (toggle) {
toggleClass(toggle, CLASS_ACTIVE, !stopped);
setAttribute(toggle, ARIA_LABEL, options.i18n[stopped ? "play" : "pause"]);
}
}
function onAnimationFrame(rate) {
var bar = Elements2.bar;
bar && style(bar, "width", rate * 100 + "%");
emit(EVENT_AUTOPLAY_PLAYING, rate);
}
function onMove(index) {
var Slide2 = Components2.Slides.getAt(index);
interval.set(Slide2 && +getAttribute(Slide2.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval);
}
return {
mount,
destroy: interval.cancel,
play,
pause,
isPaused
};
}
function Cover(Splide2, Components2, options) {
var _EventInterface7 = EventInterface(Splide2), on = _EventInterface7.on;
function mount() {
if (options.cover) {
on(EVENT_LAZYLOAD_LOADED, apply(toggle, true));
on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply(cover, true));
}
}
function cover(cover2) {
Components2.Slides.forEach(function(Slide2) {
var img = child(Slide2.container || Slide2.slide, "img");
if (img && img.src) {
toggle(cover2, img, Slide2);
}
});
}
function toggle(cover2, img, Slide2) {
Slide2.style("background", cover2 ? 'center/cover no-repeat url("' + img.src + '")' : "", true);
display(img, cover2 ? "none" : "");
}
return {
mount,
destroy: apply(cover, false)
};
}
var BOUNCE_DIFF_THRESHOLD = 10;
var BOUNCE_DURATION = 600;
var FRICTION_FACTOR = 0.6;
var BASE_VELOCITY = 1.5;
var MIN_DURATION = 800;
function Scroll(Splide2, Components2, options) {
var _EventInterface8 = EventInterface(Splide2), on = _EventInterface8.on, emit = _EventInterface8.emit;
var set = Splide2.state.set;
var Move2 = Components2.Move;
var getPosition = Move2.getPosition, getLimit = Move2.getLimit, exceededLimit = Move2.exceededLimit, translate = Move2.translate;
var isSlide = Splide2.is(SLIDE);
var interval;
var callback;
var friction = 1;
function mount() {
on(EVENT_MOVE, clear);
on([EVENT_UPDATED, EVENT_REFRESH], cancel);
}
function scroll(destination, duration, snap, onScrolled, noConstrain) {
var from = getPosition();
clear();
if (snap && (!isSlide || !exceededLimit())) {
var size = Components2.Layout.sliderSize();
var offset = sign(destination) * size * floor(abs(destination) / size) || 0;
destination = Move2.toPosition(Components2.Controller.toDest(destination % size)) + offset;
}
var noDistance = approximatelyEqual(from, destination, 1);
friction = 1;
duration = noDistance ? 0 : duration || max(abs(destination - from) / BASE_VELOCITY, MIN_DURATION);
callback = onScrolled;
interval = RequestInterval(duration, onEnd, apply(update, from, destination, noConstrain), 1);
set(SCROLLING);
emit(EVENT_SCROLL);
interval.start();
}
function onEnd() {
set(IDLE);
callback && callback();
emit(EVENT_SCROLLED);
}
function update(from, to, noConstrain, rate) {
var position = getPosition();
var target = from + (to - from) * easing(rate);
var diff = (target - position) * friction;
translate(position + diff);
if (isSlide && !noConstrain && exceededLimit()) {
friction *= FRICTION_FACTOR;
if (abs(diff) < BOUNCE_DIFF_THRESHOLD) {
scroll(getLimit(exceededLimit(true)), BOUNCE_DURATION, false, callback, true);
}
}
}
function clear() {
if (interval) {
interval.cancel();
}
}
function cancel() {
if (interval && !interval.isPaused()) {
clear();
onEnd();
}
}
function easing(t) {
var easingFunc = options.easingFunc;
return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4);
}
return {
mount,
destroy: clear,
scroll,
cancel
};
}
var SCROLL_LISTENER_OPTIONS = {
passive: false,
capture: true
};
function Drag(Splide2, Components2, options) {
var _EventInterface9 = EventInterface(Splide2), on = _EventInterface9.on, emit = _EventInterface9.emit, bind = _EventInterface9.bind, unbind = _EventInterface9.unbind;
var state = Splide2.state;
var Move2 = Components2.Move, Scroll2 = Components2.Scroll, Controller2 = Components2.Controller, track = Components2.Elements.track, reduce = Components2.Media.reduce;
var _Components2$Directio2 = Components2.Direction, resolve = _Components2$Directio2.resolve, orient = _Components2$Directio2.orient;
var getPosition = Move2.getPosition, exceededLimit = Move2.exceededLimit;
var basePosition;
var baseEvent;
var prevBaseEvent;
var isFree;
var dragging;
var exceeded = false;
var clickPrevented;
var disabled;
var target;
function mount() {
bind(track, POINTER_MOVE_EVENTS, noop, SCROLL_LISTENER_OPTIONS);
bind(track, POINTER_UP_EVENTS, noop, SCROLL_LISTENER_OPTIONS);
bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS);
bind(track, "click", onClick, {
capture: true
});
bind(track, "dragstart", prevent);
on([EVENT_MOUNTED, EVENT_UPDATED], init);
}
function init() {
var drag = options.drag;
disable(!drag);
isFree = drag === "free";
}
function onPointerDown(e) {
clickPrevented = false;
if (!disabled) {
var isTouch = isTouchEvent(e);
if (isDraggable(e.target) && (isTouch || !e.button)) {
if (!Controller2.isBusy()) {
target = isTouch ? track : window;
dragging = state.is([MOVING, SCROLLING]);
prevBaseEvent = null;
bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS);
bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS);
Move2.cancel();
Scroll2.cancel();
save(e);
} else {
prevent(e, true);
}
}
}
}
function onPointerMove(e) {
if (!state.is(DRAGGING)) {
state.set(DRAGGING);
emit(EVENT_DRAG);
}
if (e.cancelable) {
if (dragging) {
Move2.translate(basePosition + constrain(diffCoord(e)));
var expired = diffTime(e) > LOG_INTERVAL;
var hasExceeded = exceeded !== (exceeded = exceededLimit());
if (expired || hasExceeded) {
save(e);
}
clickPrevented = true;
emit(EVENT_DRAGGING);
prevent(e);
} else if (isSliderDirection(e)) {
dragging = shouldStart(e);
prevent(e);
}
}
}
function onPointerUp(e) {
if (state.is(DRAGGING)) {
state.set(IDLE);
emit(EVENT_DRAGGED);
}
if (dragging) {
move(e);
prevent(e);
}
unbind(target, POINTER_MOVE_EVENTS, onPointerMove);
unbind(target, POINTER_UP_EVENTS, onPointerUp);
dragging = false;
}
function onClick(e) {
if (!disabled && clickPrevented) {
prevent(e, true);
}
}
function save(e) {
prevBaseEvent = baseEvent;
baseEvent = e;
basePosition = getPosition();
}
function move(e) {
var velocity = computeVelocity(e);
var destination = computeDestination(velocity);
var rewind = options.rewind && options.rewindByDrag;
reduce(false);
if (isFree) {
Controller2.scroll(destination, 0, options.snap);
} else if (Splide2.is(FADE)) {
Controller2.go(orient(sign(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+");
} else if (Splide2.is(SLIDE) && exceeded && rewind) {
Controller2.go(exceededLimit(true) ? ">" : "<");
} else {
Controller2.go(Controller2.toDest(destination), true);
}
reduce(true);
}
function shouldStart(e) {
var thresholds = options.dragMinThreshold;
var isObj = isObject$1(thresholds);
var mouse = isObj && thresholds.mouse || 0;
var touch = (isObj ? thresholds.touch : +thresholds) || 10;
return abs(diffCoord(e)) > (isTouchEvent(e) ? touch : mouse);
}
function isSliderDirection(e) {
return abs(diffCoord(e)) > abs(diffCoord(e, true));
}
function computeVelocity(e) {
if (Splide2.is(LOOP) || !exceeded) {
var time = diffTime(e);
if (time && time < LOG_INTERVAL) {
return diffCoord(e) / time;
}
}
return 0;
}
function computeDestination(velocity) {
return getPosition() + sign(velocity) * min(abs(velocity) * (options.flickPower || 600), isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1));
}
function diffCoord(e, orthogonal) {
return coordOf(e, orthogonal) - coordOf(getBaseEvent(e), orthogonal);
}
function diffTime(e) {
return timeOf(e) - timeOf(getBaseEvent(e));
}
function getBaseEvent(e) {
return baseEvent === e && prevBaseEvent || baseEvent;
}
function coordOf(e, orthogonal) {
return (isTouchEvent(e) ? e.changedTouches[0] : e)["page" + resolve(orthogonal ? "Y" : "X")];
}
function constrain(diff) {
return diff / (exceeded && Splide2.is(SLIDE) ? FRICTION : 1);
}
function isDraggable(target2) {
var noDrag = options.noDrag;
return !matches(target2, "." + CLASS_PAGINATION_PAGE + ", ." + CLASS_ARROW) && (!noDrag || !matches(target2, noDrag));
}
function isTouchEvent(e) {
return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
}
function isDragging() {
return dragging;
}
function disable(value) {
disabled = value;
}
return {
mount,
disable,
isDragging
};
}
var NORMALIZATION_MAP = {
Spacebar: " ",
Right: ARROW_RIGHT,
Left: ARROW_LEFT,
Up: ARROW_UP,
Down: ARROW_DOWN
};
function normalizeKey(key) {
key = isString(key) ? key : key.key;
return NORMALIZATION_MAP[key] || key;
}
var KEYBOARD_EVENT = "keydown";
function Keyboard(Splide2, Components2, options) {
var _EventInterface10 = EventInterface(Splide2), on = _EventInterface10.on, bind = _EventInterface10.bind, unbind = _EventInterface10.unbind;
var root = Splide2.root;
var resolve = Components2.Direction.resolve;
var target;
var disabled;
function mount() {
init();
on(EVENT_UPDATED, destroy);
on(EVENT_UPDATED, init);
on(EVENT_MOVE, onMove);
}
function init() {
var keyboard = options.keyboard;
if (keyboard) {
target = keyboard === "global" ? window : root;
bind(target, KEYBOARD_EVENT, onKeydown);
}
}
function destroy() {
unbind(target, KEYBOARD_EVENT);
}
function disable(value) {
disabled = value;
}
function onMove() {
var _disabled = disabled;
disabled = true;
nextTick(function() {
disabled = _disabled;
});
}
function onKeydown(e) {
if (!disabled) {
var key = normalizeKey(e);
if (key === resolve(ARROW_LEFT)) {
Splide2.go("<");
} else if (key === resolve(ARROW_RIGHT)) {
Splide2.go(">");
}
}
}
return {
mount,
destroy,
disable
};
}
var SRC_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-lazy";
var SRCSET_DATA_ATTRIBUTE = SRC_DATA_ATTRIBUTE + "-srcset";
var IMAGE_SELECTOR = "[" + SRC_DATA_ATTRIBUTE + "], [" + SRCSET_DATA_ATTRIBUTE + "]";
function LazyLoad(Splide2, Components2, options) {
var _EventInterface11 = EventInterface(Splide2), on = _EventInterface11.on, off = _EventInterface11.off, bind = _EventInterface11.bind, emit = _EventInterface11.emit;
var isSequential = options.lazyLoad === "sequential";
var events = [EVENT_MOVED, EVENT_SCROLLED];
var entries = [];
function mount() {
if (options.lazyLoad) {
init();
on(EVENT_REFRESH, init);
}
}
function init() {
empty(entries);
register();
if (isSequential) {
loadNext();
} else {
off(events);
on(events, check);
check();
}
}
function register() {
Components2.Slides.forEach(function(Slide2) {
queryAll(Slide2.slide, IMAGE_SELECTOR).forEach(function(img) {
var src = getAttribute(img, SRC_DATA_ATTRIBUTE);
var srcset = getAttribute(img, SRCSET_DATA_ATTRIBUTE);
if (src !== img.src || srcset !== img.srcset) {
var className = options.classes.spinner;
var parent = img.parentElement;
var spinner = child(parent, "." + className) || create("span", className, parent);
entries.push([img, Slide2, spinner]);
img.src || display(img, "none");
}
});
});
}
function check() {
entries = entries.filter(function(data) {
var distance = options.perPage * ((options.preloadPages || 1) + 1) - 1;
return data[1].isWithin(Splide2.index, distance) ? load(data) : true;
});
entries.length || off(events);
}
function load(data) {
var img = data[0];
addClass(data[1].slide, CLASS_LOADING);
bind(img, "load error", apply(onLoad, data));
setAttribute(img, "src", getAttribute(img, SRC_DATA_ATTRIBUTE));
setAttribute(img, "srcset", getAttribute(img, SRCSET_DATA_ATTRIBUTE));
removeAttribute(img, SRC_DATA_ATTRIBUTE);
removeAttribute(img, SRCSET_DATA_ATTRIBUTE);
}
function onLoad(data, e) {
var img = data[0], Slide2 = data[1];
removeClass(Slide2.slide, CLASS_LOADING);
if (e.type !== "error") {
remove(data[2]);
display(img, "");
emit(EVENT_LAZYLOAD_LOADED, img, Slide2);
emit(EVENT_RESIZE);
}
isSequential && loadNext();
}
function loadNext() {
entries.length && load(entries.shift());
}
return {
mount,
destroy: apply(empty, entries),
check
};
}
function Pagination(Splide2, Components2, options) {
var event = EventInterface(Splide2);
var on = event.on, emit = event.emit, bind = event.bind;
var Slides2 = Components2.Slides, Elements2 = Components2.Elements, Controller2 = Components2.Controller;
var hasFocus = Controller2.hasFocus, getIndex = Controller2.getIndex, go = Controller2.go;
var resolve = Components2.Direction.resolve;
var placeholder = Elements2.pagination;
var items = [];
var list;
var paginationClasses;
function mount() {
destroy();
on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], mount);
var enabled = options.pagination;
placeholder && display(placeholder, enabled ? "" : "none");
if (enabled) {
on([EVENT_MOVE, EVENT_SCROLL, EVENT_SCROLLED], update);
createPagination();
update();
emit(EVENT_PAGINATION_MOUNTED, {
list,
items
}, getAt(Splide2.index));
}
}
function destroy() {
if (list) {
remove(placeholder ? slice(list.children) : list);
removeClass(list, paginationClasses);
empty(items);
list = null;
}
event.destroy();
}
function createPagination() {
var length = Splide2.length;
var classes = options.classes, i18n = options.i18n, perPage = options.perPage;
var max2 = hasFocus() ? Controller2.getEnd() + 1 : ceil(length / perPage);
list = placeholder || create("ul", classes.pagination, Elements2.track.parentElement);
addClass(list, paginationClasses = CLASS_PAGINATION + "--" + getDirection());
setAttribute(list, ROLE, "tablist");
setAttribute(list, ARIA_LABEL, i18n.select);
setAttribute(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : "");
for (var i = 0; i < max2; i++) {
var li = create("li", null, list);
var button = create("button", {
class: classes.page,
type: "button"
}, li);
var controls = Slides2.getIn(i).map(function(Slide2) {
return Slide2.slide.id;
});
var text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX;
bind(button, "click", apply(onClick, i));
if (options.paginationKeyboard) {
bind(button, "keydown", apply(onKeydown, i));
}
setAttribute(li, ROLE, "presentation");
setAttribute(button, ROLE, "tab");
setAttribute(button, ARIA_CONTROLS, controls.join(" "));
setAttribute(button, ARIA_LABEL, format(text, i + 1));
setAttribute(button, TAB_INDEX, -1);
items.push({
li,
button,
page: i
});
}
}
function onClick(page) {
go(">" + page, true);
}
function onKeydown(page, e) {
var length = items.length;
var key = normalizeKey(e);
var dir = getDirection();
var nextPage = -1;
if (key === resolve(ARROW_RIGHT, false, dir)) {
nextPage = ++page % length;
} else if (key === resolve(ARROW_LEFT, false, dir)) {
nextPage = (--page + length) % length;
} else if (key === "Home") {
nextPage = 0;
} else if (key === "End") {
nextPage = length - 1;
}
var item = items[nextPage];
if (item) {
focus(item.button);
go(">" + nextPage);
prevent(e, true);
}
}
function getDirection() {
return options.paginationDirection || options.direction;
}
function getAt(index) {
return items[Controller2.toPage(index)];
}
function update() {
var prev = getAt(getIndex(true));
var curr = getAt(getIndex());
if (prev) {
var button = prev.button;
removeClass(button, CLASS_ACTIVE);
removeAttribute(button, ARIA_SELECTED);
setAttribute(button, TAB_INDEX, -1);
}
if (curr) {
var _button = curr.button;
addClass(_button, CLASS_ACTIVE);
setAttribute(_button, ARIA_SELECTED, true);
setAttribute(_button, TAB_INDEX, "");
}
emit(EVENT_PAGINATION_UPDATED, {
list,
items
}, prev, curr);
}
return {
items,
mount,
destroy,
getAt,
update
};
}
var TRIGGER_KEYS = [" ", "Enter"];
function Sync(Splide2, Components2, options) {
var isNavigation = options.isNavigation, slideFocus = options.slideFocus;
var events = [];
function mount() {
Splide2.splides.forEach(function(target) {
if (!target.isParent) {
sync(Splide2, target.splide);
sync(target.splide, Splide2);
}
});
if (isNavigation) {
navigate();
}
}
function destroy() {
events.forEach(function(event) {
event.destroy();
});
empty(events);
}
function remount() {
destroy();
mount();
}
function sync(splide, target) {
var event = EventInterface(splide);
event.on(EVENT_MOVE, function(index, prev, dest) {
target.go(target.is(LOOP) ? dest : index);
});
events.push(event);
}
function navigate() {
var event = EventInterface(Splide2);
var on = event.on;
on(EVENT_CLICK, onClick);
on(EVENT_SLIDE_KEYDOWN, onKeydown);
on([EVENT_MOUNTED, EVENT_UPDATED], update);
events.push(event);
event.emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides);
}
function update() {
setAttribute(Components2.Elements.list, ARIA_ORIENTATION, options.direction === TTB ? "vertical" : "");
}
function onClick(Slide2) {
Splide2.go(Slide2.index);
}
function onKeydown(Slide2, e) {
if (includes(TRIGGER_KEYS, normalizeKey(e))) {
onClick(Slide2);
prevent(e);
}
}
return {
setup: apply(Components2.Media.set, {
slideFocus: isUndefined(slideFocus) ? isNavigation : slideFocus
}, true),
mount,
destroy,
remount
};
}
function Wheel(Splide2, Components2, options) {
var _EventInterface12 = EventInterface(Splide2), bind = _EventInterface12.bind;
var lastTime = 0;
function mount() {
if (options.wheel) {
bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS);
}
}
function onWheel(e) {
if (e.cancelable) {
var deltaY = e.deltaY;
var backwards = deltaY < 0;
var timeStamp = timeOf(e);
var _min = options.wheelMinThreshold || 0;
var sleep = options.wheelSleep || 0;
if (abs(deltaY) > _min && timeStamp - lastTime > sleep) {
Splide2.go(backwards ? "<" : ">");
lastTime = timeStamp;
}
shouldPrevent(backwards) && prevent(e);
}
}
function shouldPrevent(backwards) {
return !options.releaseWheel || Splide2.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1;
}
return {
mount
};
}
var SR_REMOVAL_DELAY = 90;
function Live(Splide2, Components2, options) {
var _EventInterface13 = EventInterface(Splide2), on = _EventInterface13.on;
var track = Components2.Elements.track;
var enabled = options.live && !options.isNavigation;
var sr = create("span", CLASS_SR);
var interval = RequestInterval(SR_REMOVAL_DELAY, apply(toggle, false));
function mount() {
if (enabled) {
disable(!Components2.Autoplay.isPaused());
setAttribute(track, ARIA_ATOMIC, true);
sr.textContent = "\u2026";
on(EVENT_AUTOPLAY_PLAY, apply(disable, true));
on(EVENT_AUTOPLAY_PAUSE, apply(disable, false));
on([EVENT_MOVED, EVENT_SCROLLED], apply(toggle, true));
}
}
function toggle(active) {
setAttribute(track, ARIA_BUSY, active);
if (active) {
append(track, sr);
interval.start();
} else {
remove(sr);
interval.cancel();
}
}
function destroy() {
removeAttribute(track, [ARIA_LIVE, ARIA_ATOMIC, ARIA_BUSY]);
remove(sr);
}
function disable(disabled) {
if (enabled) {
setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite");
}
}
return {
mount,
disable,
destroy
};
}
var ComponentConstructors = /* @__PURE__ */ Object.freeze({
__proto__: null,
Media,
Direction,
Elements,
Slides,
Layout,
Clones,
Move,
Controller,
Arrows,
Autoplay,
Cover,
Scroll,
Drag,
Keyboard,
LazyLoad,
Pagination,
Sync,
Wheel,
Live
});
var I18N = {
prev: "Previous slide",
next: "Next slide",
first: "Go to first slide",
last: "Go to last slide",
slideX: "Go to slide %s",
pageX: "Go to page %s",
play: "Start autoplay",
pause: "Pause autoplay",
carousel: "carousel",
slide: "slide",
select: "Select a slide to show",
slideLabel: "%s of %s"
};
var DEFAULTS = {
type: "slide",
role: "region",
speed: 400,
perPage: 1,
cloneStatus: true,
arrows: true,
pagination: true,
paginationKeyboard: true,
interval: 5e3,
pauseOnHover: true,
pauseOnFocus: true,
resetProgress: true,
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
drag: true,
direction: "ltr",
trimSpace: true,
focusableNodes: "a, button, textarea, input, select, iframe",
live: true,
classes: CLASSES,
i18n: I18N,
reducedMotion: {
speed: 0,
rewindSpeed: 0,
autoplay: "pause"
}
};
function Fade(Splide2, Components2, options) {
var Slides2 = Components2.Slides;
function mount() {
EventInterface(Splide2).on([EVENT_MOUNTED, EVENT_REFRESH], init);
}
function init() {
Slides2.forEach(function(Slide2) {
Slide2.style("transform", "translateX(-" + 100 * Slide2.index + "%)");
});
}
function start(index, done) {
Slides2.style("transition", "opacity " + options.speed + "ms " + options.easing);
nextTick(done);
}
return {
mount,
start,
cancel: noop
};
}
function Slide(Splide2, Components2, options) {
var Move2 = Components2.Move, Controller2 = Components2.Controller, Scroll2 = Components2.Scroll;
var list = Components2.Elements.list;
var transition = apply(style, list, "transition");
var endCallback;
function mount() {
EventInterface(Splide2).bind(list, "transitionend", function(e) {
if (e.target === list && endCallback) {
cancel();
endCallback();
}
});
}
function start(index, done) {
var destination = Move2.toPosition(index, true);
var position = Move2.getPosition();
var speed = getSpeed(index);
if (abs(destination - position) >= 1 && speed >= 1) {
if (options.useScroll) {
Scroll2.scroll(destination, speed, false, done);
} else {
transition("transform " + speed + "ms " + options.easing);
Move2.translate(destination, true);
endCallback = done;
}
} else {
Move2.jump(index);
done();
}
}
function cancel() {
transition("");
Scroll2.cancel();
}
function getSpeed(index) {
var rewindSpeed = options.rewindSpeed;
if (Splide2.is(SLIDE) && rewindSpeed) {
var prev = Controller2.getIndex(true);
var end = Controller2.getEnd();
if (prev === 0 && index >= end || prev >= end && index === 0) {
return rewindSpeed;
}
}
return options.speed;
}
return {
mount,
start,
cancel
};
}
var _Splide = /* @__PURE__ */ function() {
function _Splide2(target, options) {
this.event = EventInterface();
this.Components = {};
this.state = State(CREATED);
this.splides = [];
this._o = {};
this._E = {};
var root = isString(target) ? query(document, target) : target;
assert(root, root + " is invalid.");
this.root = root;
options = merge$1({
label: getAttribute(root, ARIA_LABEL) || "",
labelledby: getAttribute(root, ARIA_LABELLEDBY) || ""
}, DEFAULTS, _Splide2.defaults, options || {});
try {
merge$1(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE)));
} catch (e) {
assert(false, "Invalid JSON");
}
this._o = Object.create(merge$1({}, options));
}
var _proto = _Splide2.prototype;
_proto.mount = function mount(Extensions, Transition) {
var _this = this;
var state = this.state, Components2 = this.Components;
assert(state.is([CREATED, DESTROYED]), "Already mounted!");
state.set(CREATED);
this._C = Components2;
this._T = Transition || this._T || (this.is(FADE) ? Fade : Slide);
this._E = Extensions || this._E;
var Constructors = assign({}, ComponentConstructors, this._E, {
Transition: this._T
});
forOwn$1(Constructors, function(Component, key) {
var component = Component(_this, Components2, _this._o);
Components2[key] = component;
component.setup && component.setup();
});
forOwn$1(Components2, function(component) {
component.mount && component.mount();
});
this.emit(EVENT_MOUNTED);
addClass(this.root, CLASS_INITIALIZED);
state.set(IDLE);
this.emit(EVENT_READY);
return this;
};
_proto.sync = function sync(splide) {
this.splides.push({
splide
});
splide.splides.push({
splide: this,
isParent: true
});
if (this.state.is(IDLE)) {
this._C.Sync.remount();
splide.Components.Sync.remount();
}
return this;
};
_proto.go = function go(control) {
this._C.Controller.go(control);
return this;
};
_proto.on = function on(events, callback) {
this.event.on(events, callback);
return this;
};
_proto.off = function off(events) {
this.event.off(events);
return this;
};
_proto.emit = function emit(event) {
var _this$event;
(_this$event = this.event).emit.apply(_this$event, [event].concat(slice(arguments, 1)));
return this;
};
_proto.add = function add(slides, index) {
this._C.Slides.add(slides, index);
return this;
};
_proto.remove = function remove2(matcher) {
this._C.Slides.remove(matcher);
return this;
};
_proto.is = function is(type) {
return this._o.type === type;
};
_proto.refresh = function refresh() {
this.emit(EVENT_REFRESH);
return this;
};
_proto.destroy = function destroy(completely) {
if (completely === void 0) {
completely = true;
}
var event = this.event, state = this.state;
if (state.is(CREATED)) {
EventInterface(this).on(EVENT_READY, this.destroy.bind(this, completely));
} else {
forOwn$1(this._C, function(component) {
component.destroy && component.destroy(completely);
}, true);
event.emit(EVENT_DESTROY);
event.destroy();
completely && empty(this.splides);
state.set(DESTROYED);
}
return this;
};
_createClass(_Splide2, [{
key: "options",
get: function get() {
return this._o;
},
set: function set(options) {
this._C.Media.set(options, true, true);
}
}, {
key: "length",
get: function get() {
return this._C.Slides.getLength(true);
}
}, {
key: "index",
get: function get() {
return this._C.Controller.getIndex();
}
}]);
return _Splide2;
}();
var Splide$1 = _Splide;
Splide$1.defaults = {};
Splide$1.STATES = STATES;
const EVENTS = [
EVENT_ACTIVE,
EVENT_ARROWS_MOUNTED,
EVENT_ARROWS_UPDATED,
EVENT_AUTOPLAY_PAUSE,
EVENT_AUTOPLAY_PLAY,
EVENT_AUTOPLAY_PLAYING,
EVENT_CLICK,
EVENT_DESTROY,
EVENT_DRAG,
EVENT_DRAGGED,
EVENT_DRAGGING,
EVENT_HIDDEN,
EVENT_INACTIVE,
EVENT_LAZYLOAD_LOADED,
EVENT_MOUNTED,
EVENT_MOVE,
EVENT_MOVED,
EVENT_NAVIGATION_MOUNTED,
EVENT_PAGINATION_MOUNTED,
EVENT_PAGINATION_UPDATED,
EVENT_REFRESH,
EVENT_RESIZE,
EVENT_RESIZED,
EVENT_SCROLL,
EVENT_SCROLLED,
EVENT_UPDATED,
EVENT_VISIBLE
];
const SPLIDE_INJECTION_KEY = "splide";
function isObject(subject) {
return subject !== null && typeof subject === "object";
}
function forOwn(object, iteratee) {
if (object) {
const keys = Object.keys(object);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (key !== "__proto__") {
if (iteratee(object[key], key) === false) {
break;
}
}
}
}
return object;
}
function merge(object, source) {
const merged = object;
forOwn(source, (value, key) => {
if (Array.isArray(value)) {
merged[key] = value.slice();
} else if (isObject(value)) {
merged[key] = merge(isObject(merged[key]) ? merged[key] : {}, value);
} else {
merged[key] = value;
}
});
return merged;
}
const _sfc_main$2 = vue.defineComponent({
name: "SplideTrack",
setup() {
vue.onUpdated(() => {
var _a;
const splide = vue.inject(SPLIDE_INJECTION_KEY);
(_a = splide == null ? void 0 : splide.value) == null ? void 0 : _a.refresh();
});
}
});
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const _hoisted_1$1 = { class: "splide__track" };
const _hoisted_2 = { class: "splide__list" };
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
vue.createElementVNode("ul", _hoisted_2, [
vue.renderSlot(_ctx.$slots, "default")
])
]);
}
const SplideTrack = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
const _sfc_main$1 = vue.defineComponent({
name: "Splide",
emits: EVENTS.map((event) => `splide:${event}`),
components: { SplideTrack },
props: {
tag: {
default: "div",
type: String
},
options: {
default: {},
type: Object
},
extensions: Object,
transition: Function,
hasTrack: {
default: true,
type: Boolean
}
},
setup(props, context) {
const splide = vue.ref();
const root = vue.ref();
vue.onMounted(() => {
if (root.value) {
splide.value = new Splide$1(root.value, props.options);
bind(splide.value);
splide.value.mount(props.extensions, props.transition);
}
});
vue.onBeforeUnmount(() => {
var _a;
(_a = splide.value) == null ? void 0 : _a.destroy();
});
vue.watch(() => merge({}, props.options), (options) => {
if (splide.value) {
splide.value.options = options;
}
}, { deep: true });
vue.provide(SPLIDE_INJECTION_KEY, splide);
const index = vue.computed(() => {
var _a;
return ((_a = splide.value) == null ? void 0 : _a.index) || 0;
});
const length = vue.computed(() => {
var _a;
return ((_a = splide.value) == null ? void 0 : _a.length) || 0;
});
function go(control) {
var _a;
(_a = splide.value) == null ? void 0 : _a.go(control);
}
function sync(target) {
var _a;
(_a = splide.value) == null ? void 0 : _a.sync(target);
}
function bind(splide2) {
EVENTS.forEach((event) => {
splide2.on(event, (...args) => {
context.emit(`splide:${event}`, splide2, ...args);
});
});
}
return {
splide,
root,
index,
length,
go,
sync
};
}
});
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
const _component_SplideTrack = vue.resolveComponent("SplideTrack");
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
class: "splide",
ref: "root"
}, {
default: vue.withCtx(() => [
_ctx.hasTrack ? (vue.openBlock(), vue.createBlock(_component_SplideTrack, { key: 0 }, {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default")
]),
_: 3
})) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
]),
_: 3
}, 512);
}
const Splide = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
const _sfc_main = vue.defineComponent({
name: "SplideSlide"
});
const _hoisted_1 = { class: "splide__slide" };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("li", _hoisted_1, [
vue.renderSlot(_ctx.$slots, "default")
]);
}
const SplideSlide = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
const VueSplide = {
install(app) {
app.component(Splide.name, Splide);
app.component(SplideSlide.name, SplideSlide);
}
};
exports.Splide = Splide;
exports.SplideSlide = SplideSlide;
exports.SplideTrack = SplideTrack;
exports.default = VueSplide;
================================================
FILE: dist/js/vue-splide.esm.js
================================================
import { defineComponent, onUpdated, inject, openBlock, createElementBlock, createElementVNode, renderSlot, ref, onMounted, onBeforeUnmount, watch, provide, computed, resolveComponent, createBlock, resolveDynamicComponent, withCtx } from "vue";
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
/*!
* Splide.js
* Version : 4.1.3
* License : MIT
* Copyright: 2022 Naotoshi Fujita
*/
var MEDIA_PREFERS_REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
var CREATED = 1;
var MOUNTED = 2;
var IDLE = 3;
var MOVING = 4;
var SCROLLING = 5;
var DRAGGING = 6;
var DESTROYED = 7;
var STATES = {
CREATED,
MOUNTED,
IDLE,
MOVING,
SCROLLING,
DRAGGING,
DESTROYED
};
function empty(array) {
array.length = 0;
}
function slice(arrayLike, start, end) {
return Array.prototype.slice.call(arrayLike, start, end);
}
function apply(func) {
return func.bind.apply(func, [null].concat(slice(arguments, 1)));
}
var nextTick = setTimeout;
var noop = function noop2() {
};
function raf(func) {
return requestAnimationFrame(func);
}
function typeOf(type, subject) {
return typeof subject === type;
}
function isObject$1(subject) {
return !isNull(subject) && typeOf("object", subject);
}
var isArray = Array.isArray;
var isFunction = apply(typeOf, "function");
var isString = apply(typeOf, "string");
var isUndefined = apply(typeOf, "undefined");
function isNull(subject) {
return subject === null;
}
function isHTMLElement(subject) {
try {
return subject instanceof (subject.ownerDocument.defaultView || window).HTMLElement;
} catch (e) {
return false;
}
}
function toArray(value) {
return isArray(value) ? value : [value];
}
function forEach(values, iteratee) {
toArray(values).forEach(iteratee);
}
function includes(array, value) {
return array.indexOf(value) > -1;
}
function push(array, items) {
array.push.apply(array, toArray(items));
return array;
}
function toggleClass(elm, classes, add) {
if (elm) {
forEach(classes, function(name) {
if (name) {
elm.classList[add ? "add" : "remove"](name);
}
});
}
}
function addClass(elm, classes) {
toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true);
}
function append(parent, children2) {
forEach(children2, parent.appendChild.bind(parent));
}
function before(nodes, ref2) {
forEach(nodes, function(node) {
var parent = (ref2 || node).parentNode;
if (parent) {
parent.insertBefore(node, ref2);
}
});
}
function matches(elm, selector) {
return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector);
}
function children(parent, selector) {
var children2 = parent ? slice(parent.children) : [];
return selector ? children2.filter(function(child2) {
return matches(child2, selector);
}) : children2;
}
function child(parent, selector) {
return selector ? children(parent, selector)[0] : parent.firstElementChild;
}
var ownKeys = Object.keys;
function forOwn$1(object, iteratee, right) {
if (object) {
(right ? ownKeys(object).reverse() : ownKeys(object)).forEach(function(key) {
key !== "__proto__" && iteratee(object[key], key);
});
}
return object;
}
function assign(object) {
slice(arguments, 1).forEach(function(source) {
forOwn$1(source, function(value, key) {
object[key] = source[key];
});
});
return object;
}
function merge$1(object) {
slice(arguments, 1).forEach(function(source) {
forOwn$1(source, function(value, key) {
if (isArray(value)) {
object[key] = value.slice();
} else if (isObject$1(value)) {
object[key] = merge$1({}, isObject$1(object[key]) ? object[key] : {}, value);
} else {
object[key] = value;
}
});
});
return object;
}
function omit(object, keys) {
forEach(keys || ownKeys(object), function(key) {
delete object[key];
});
}
function removeAttribute(elms, attrs) {
forEach(elms, function(elm) {
forEach(attrs, function(attr) {
elm && elm.removeAttribute(attr);
});
});
}
function setAttribute(elms, attrs, value) {
if (isObject$1(attrs)) {
forOwn$1(attrs, function(value2, name) {
setAttribute(elms, name, value2);
});
} else {
forEach(elms, function(elm) {
isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value));
});
}
}
function create(tag, attrs, parent) {
var elm = document.createElement(tag);
if (attrs) {
isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs);
}
parent && append(parent, elm);
return elm;
}
function style(elm, prop, value) {
if (isUndefined(value)) {
return getComputedStyle(elm)[prop];
}
if (!isNull(value)) {
elm.style[prop] = "" + value;
}
}
function display(elm, display2) {
style(elm, "display", display2);
}
function focus(elm) {
elm["setActive"] && elm["setActive"]() || elm.focus({
preventScroll: true
});
}
function getAttribute(elm, attr) {
return elm.getAttribute(attr);
}
function hasClass(elm, className) {
return elm && elm.classList.contains(className);
}
function rect(target) {
return target.getBoundingClientRect();
}
function remove(nodes) {
forEach(nodes, function(node) {
if (node && node.parentNode) {
node.parentNode.removeChild(node);
}
});
}
function parseHtml(html) {
return child(new DOMParser().parseFromString(html, "text/html").body);
}
function prevent(e, stopPropagation) {
e.preventDefault();
if (stopPropagation) {
e.stopPropagation();
e.stopImmediatePropagation();
}
}
function query(parent, selector) {
return parent && parent.querySelector(selector);
}
function queryAll(parent, selector) {
return selector ? slice(parent.querySelectorAll(selector)) : [];
}
function removeClass(elm, classes) {
toggleClass(elm, classes, false);
}
function timeOf(e) {
return e.timeStamp;
}
function unit(value) {
return isString(value) ? value : value ? value + "px" : "";
}
var PROJECT_CODE = "splide";
var DATA_ATTRIBUTE = "data-" + PROJECT_CODE;
function assert(condition, message) {
if (!condition) {
throw new Error("[" + PROJECT_CODE + "] " + (message || ""));
}
}
var min = Math.min, max = Math.max, floor = Math.floor, ceil = Math.ceil, abs = Math.abs;
function approximatelyEqual(x, y, epsilon) {
return abs(x - y) < epsilon;
}
function between(number, x, y, exclusive) {
var minimum = min(x, y);
var maximum = max(x, y);
return exclusive ? minimum < number && number < maximum : minimum <= number && number <= maximum;
}
function clamp(number, x, y) {
var minimum = min(x, y);
var maximum = max(x, y);
return min(max(minimum, number), maximum);
}
function sign(x) {
return +(x > 0) - +(x < 0);
}
function format(string, replacements) {
forEach(replacements, function(replacement) {
string = string.replace("%s", "" + replacement);
});
return string;
}
function pad(number) {
return number < 10 ? "0" + number : "" + number;
}
var ids = {};
function uniqueId(prefix) {
return "" + prefix + pad(ids[prefix] = (ids[prefix] || 0) + 1);
}
function EventBinder() {
var listeners = [];
function bind(targets, events, callback, options) {
forEachEvent(targets, events, function(target, event, namespace) {
var isEventTarget = "addEventListener" in target;
var remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback);
isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback);
listeners.push([target, event, namespace, callback, remover]);
});
}
function unbind(targets, events, callback) {
forEachEvent(targets, events, function(target, event, namespace) {
listeners = listeners.filter(function(listener) {
if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) {
listener[4]();
return false;
}
return true;
});
});
}
function dispatch(target, type, detail) {
var e;
var bubbles = true;
if (typeof CustomEvent === "function") {
e = new CustomEvent(type, {
bubbles,
detail
});
} else {
e = document.createEvent("CustomEvent");
e.initCustomEvent(type, bubbles, false, detail);
}
target.dispatchEvent(e);
return e;
}
function forEachEvent(targets, events, iteratee) {
forEach(targets, function(target) {
target && forEach(events, function(events2) {
events2.split(" ").forEach(function(eventNS) {
var fragment = eventNS.split(".");
iteratee(target, fragment[0], fragment[1]);
});
});
});
}
function destroy() {
listeners.forEach(function(data) {
data[4]();
});
empty(listeners);
}
return {
bind,
unbind,
dispatch,
destroy
};
}
var EVENT_MOUNTED = "mounted";
var EVENT_READY = "ready";
var EVENT_MOVE = "move";
var EVENT_MOVED = "moved";
var EVENT_CLICK = "click";
var EVENT_ACTIVE = "active";
var EVENT_INACTIVE = "inactive";
var EVENT_VISIBLE = "visible";
var EVENT_HIDDEN = "hidden";
var EVENT_REFRESH = "refresh";
var EVENT_UPDATED = "updated";
var EVENT_RESIZE = "resize";
var EVENT_RESIZED = "resized";
var EVENT_DRAG = "drag";
var EVENT_DRAGGING = "dragging";
var EVENT_DRAGGED = "dragged";
var EVENT_SCROLL = "scroll";
var EVENT_SCROLLED = "scrolled";
var EVENT_OVERFLOW = "overflow";
var EVENT_DESTROY = "destroy";
var EVENT_ARROWS_MOUNTED = "arrows:mounted";
var EVENT_ARROWS_UPDATED = "arrows:updated";
var EVENT_PAGINATION_MOUNTED = "pagination:mounted";
var EVENT_PAGINATION_UPDATED = "pagination:updated";
var EVENT_NAVIGATION_MOUNTED = "navigation:mounted";
var EVENT_AUTOPLAY_PLAY = "autoplay:play";
var EVENT_AUTOPLAY_PLAYING = "autoplay:playing";
var EVENT_AUTOPLAY_PAUSE = "autoplay:pause";
var EVENT_LAZYLOAD_LOADED = "lazyload:loaded";
var EVENT_SLIDE_KEYDOWN = "sk";
var EVENT_SHIFTED = "sh";
var EVENT_END_INDEX_CHANGED = "ei";
function EventInterface(Splide2) {
var bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment();
var binder = EventBinder();
function on(events, callback) {
binder.bind(bus, toArray(events).join(" "), function(e) {
callback.apply(callback, isArray(e.detail) ? e.detail : []);
});
}
function emit(event) {
binder.dispatch(bus, event, slice(arguments, 1));
}
if (Splide2) {
Splide2.event.on(EVENT_DESTROY, binder.destroy);
}
return assign(binder, {
bus,
on,
off: apply(binder.unbind, bus),
emit
});
}
function RequestInterval(interval, onInterval, onUpdate, limit) {
var now = Date.now;
var startTime;
var rate = 0;
var id;
var paused = true;
var count = 0;
function update() {
if (!paused) {
rate = interval ? min((now() - startTime) / interval, 1) : 1;
onUpdate && onUpdate(rate);
if (rate >= 1) {
onInterval();
startTime = now();
if (limit && ++count >= limit) {
return pause();
}
}
id = raf(update);
}
}
function start(resume) {
resume || cancel();
startTime = now() - (resume ? rate * interval : 0);
paused = false;
id = raf(update);
}
function pause() {
paused = true;
}
function rewind() {
startTime = now();
rate = 0;
if (onUpdate) {
onUpdate(rate);
}
}
function cancel() {
id && cancelAnimationFrame(id);
rate = 0;
id = 0;
paused = true;
}
function set(time) {
interval = time;
}
function isPaused() {
return paused;
}
return {
start,
rewind,
pause,
cancel,
set,
isPaused
};
}
function State(initialState) {
var state = initialState;
function set(value) {
state = value;
}
function is(states) {
return includes(toArray(states), state);
}
return {
set,
is
};
}
function Throttle(func, duration) {
var interval = RequestInterval(duration || 0, func, null, 1);
return function() {
interval.isPaused() && interval.start();
};
}
function Media(Splide2, Components2, options) {
var state = Splide2.state;
var breakpoints = options.breakpoints || {};
var reducedMotion = options.reducedMotion || {};
var binder = EventBinder();
var queries = [];
function setup() {
var isMin = options.mediaQuery === "min";
ownKeys(breakpoints).sort(function(n, m) {
return isMin ? +n - +m : +m - +n;
}).forEach(function(key) {
register(breakpoints[key], "(" + (isMin ? "min" : "max") + "-width:" + key + "px)");
});
register(reducedMotion, MEDIA_PREFERS_REDUCED_MOTION);
update();
}
function destroy(completely) {
if (completely) {
binder.destroy();
}
}
function register(options2, query2) {
var queryList = matchMedia(query2);
binder.bind(queryList, "change", update);
queries.push([options2, queryList]);
}
function update() {
var destroyed = state.is(DESTROYED);
var direction = options.direction;
var merged = queries.reduce(function(merged2, entry) {
return merge$1(merged2, entry[1].matches ? entry[0] : {});
}, {});
omit(options);
set(merged);
if (options.destroy) {
Splide2.destroy(options.destroy === "completely");
} else if (destroyed) {
destroy(true);
Splide2.mount();
} else {
direction !== options.direction && Splide2.refresh();
}
}
function reduce(enable) {
if (matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches) {
enable ? merge$1(options, reducedMotion) : omit(options, ownKeys(reducedMotion));
}
}
function set(opts, base, notify) {
merge$1(options, opts);
base && merge$1(Object.getPrototypeOf(options), opts);
if (notify || !state.is(CREATED)) {
Splide2.emit(EVENT_UPDATED, options);
}
}
return {
setup,
destroy,
reduce,
set
};
}
var ARROW = "Arrow";
var ARROW_LEFT = ARROW + "Left";
var ARROW_RIGHT = ARROW + "Right";
var ARROW_UP = ARROW + "Up";
var ARROW_DOWN = ARROW + "Down";
var RTL = "rtl";
var TTB = "ttb";
var ORIENTATION_MAP = {
width: ["height"],
left: ["top", "right"],
right: ["bottom", "left"],
x: ["y"],
X: ["Y"],
Y: ["X"],
ArrowLeft: [ARROW_UP, ARROW_RIGHT],
ArrowRight: [ARROW_DOWN, ARROW_LEFT]
};
function Direction(Splide2, Components2, options) {
function resolve(prop, axisOnly, direction) {
direction = direction || options.direction;
var index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1;
return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, function(match, offset) {
var replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match;
return offset > 0 ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement;
});
}
function orient(value) {
return value * (options.direction === RTL ? 1 : -1);
}
return {
resolve,
orient
};
}
var ROLE = "role";
var TAB_INDEX = "tabindex";
var DISABLED = "disabled";
var ARIA_PREFIX = "aria-";
var ARIA_CONTROLS = ARIA_PREFIX + "controls";
var ARIA_CURRENT = ARIA_PREFIX + "current";
var ARIA_SELECTED = ARIA_PREFIX + "selected";
var ARIA_LABEL = ARIA_PREFIX + "label";
var ARIA_LABELLEDBY = ARIA_PREFIX + "labelledby";
var ARIA_HIDDEN = ARIA_PREFIX + "hidden";
var ARIA_ORIENTATION = ARIA_PREFIX + "orientation";
var ARIA_ROLEDESCRIPTION = ARIA_PREFIX + "roledescription";
var ARIA_LIVE = ARIA_PREFIX + "live";
var ARIA_BUSY = ARIA_PREFIX + "busy";
var ARIA_ATOMIC = ARIA_PREFIX + "atomic";
var ALL_ATTRIBUTES = [ROLE, TAB_INDEX, DISABLED, ARIA_CONTROLS, ARIA_CURRENT, ARIA_LABEL, ARIA_LABELLEDBY, ARIA_HIDDEN, ARIA_ORIENTATION, ARIA_ROLEDESCRIPTION];
var CLASS_PREFIX = PROJECT_CODE + "__";
var STATUS_CLASS_PREFIX = "is-";
var CLASS_ROOT = PROJECT_CODE;
var CLASS_TRACK = CLASS_PREFIX + "track";
var CLASS_LIST = CLASS_PREFIX + "list";
var CLASS_SLIDE = CLASS_PREFIX + "slide";
var CLASS_CLONE = CLASS_SLIDE + "--clone";
var CLASS_CONTAINER = CLASS_SLIDE + "__container";
var CLASS_ARROWS = CLASS_PREFIX + "arrows";
var CLASS_ARROW = CLASS_PREFIX + "arrow";
var CLASS_ARROW_PREV = CLASS_ARROW + "--prev";
var CLASS_ARROW_NEXT = CLASS_ARROW + "--next";
var CLASS_PAGINATION = CLASS_PREFIX + "pagination";
var CLASS_PAGINATION_PAGE = CLASS_PAGINATION + "__page";
var CLASS_PROGRESS = CLASS_PREFIX + "progress";
var CLASS_PROGRESS_BAR = CLASS_PROGRESS + "__bar";
var CLASS_TOGGLE = CLASS_PREFIX + "toggle";
var CLASS_SPINNER = CLASS_PREFIX + "spinner";
var CLASS_SR = CLASS_PREFIX + "sr";
var CLASS_INITIALIZED = STATUS_CLASS_PREFIX + "initialized";
var CLASS_ACTIVE = STATUS_CLASS_PREFIX + "active";
var CLASS_PREV = STATUS_CLASS_PREFIX + "prev";
var CLASS_NEXT = STATUS_CLASS_PREFIX + "next";
var CLASS_VISIBLE = STATUS_CLASS_PREFIX + "visible";
var CLASS_LOADING = STATUS_CLASS_PREFIX + "loading";
var CLASS_FOCUS_IN = STATUS_CLASS_PREFIX + "focus-in";
var CLASS_OVERFLOW = STATUS_CLASS_PREFIX + "overflow";
var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING, CLASS_FOCUS_IN, CLASS_OVERFLOW];
var CLASSES = {
slide: CLASS_SLIDE,
clone: CLASS_CLONE,
arrows: CLASS_ARROWS,
arrow: CLASS_ARROW,
prev: CLASS_ARROW_PREV,
next: CLASS_ARROW_NEXT,
pagination: CLASS_PAGINATION,
page: CLASS_PAGINATION_PAGE,
spinner: CLASS_SPINNER
};
function closest(from, selector) {
if (isFunction(from.closest)) {
return from.closest(selector);
}
var elm = from;
while (elm && elm.nodeType === 1) {
if (matches(elm, selector)) {
break;
}
elm = elm.parentElement;
}
return elm;
}
var FRICTION = 5;
var LOG_INTERVAL = 200;
var POINTER_DOWN_EVENTS = "touchstart mousedown";
var POINTER_MOVE_EVENTS = "touchmove mousemove";
var POINTER_UP_EVENTS = "touchend touchcancel mouseup click";
function Elements(Splide2, Components2, options) {
var _EventInterface = EventInterface(Splide2), on = _EventInterface.on, bind = _EventInterface.bind;
var root = Splide2.root;
var i18n = options.i18n;
var elements = {};
var slides = [];
var rootClasses = [];
var trackClasses = [];
var track;
var list;
var isUsingKey;
function setup() {
collect();
init();
update();
}
function mount() {
on(EVENT_REFRESH, destroy);
on(EVENT_REFRESH, setup);
on(EVENT_UPDATED, update);
bind(document, POINTER_DOWN_EVENTS + " keydown", function(e) {
isUsingKey = e.type === "keydown";
}, {
capture: true
});
bind(root, "focusin", function() {
toggleClass(root, CLASS_FOCUS_IN, !!isUsingKey);
});
}
function destroy(completely) {
var attrs = ALL_ATTRIBUTES.concat("style");
empty(slides);
removeClass(root, rootClasses);
removeClass(track, trackClasses);
removeAttribute([track, list], attrs);
removeAttribute(root, completely ? attrs : ["style", ARIA_ROLEDESCRIPTION]);
}
function update() {
removeClass(root, rootClasses);
removeClass(track, trackClasses);
rootClasses = getClasses(CLASS_ROOT);
trackClasses = getClasses(CLASS_TRACK);
addClass(root, rootClasses);
addClass(track, trackClasses);
setAttribute(root, ARIA_LABEL, options.label);
setAttribute(root, ARIA_LABELLEDBY, options.labelledby);
}
function collect() {
track = find("." + CLASS_TRACK);
list = child(track, "." + CLASS_LIST);
assert(track && list, "A track/list element is missing.");
push(slides, children(list, "." + CLASS_SLIDE + ":not(." + CLASS_CLONE + ")"));
forOwn$1({
arrows: CLASS_ARROWS,
pagination: CLASS_PAGINATION,
prev: CLASS_ARROW_PREV,
next: CLASS_ARROW_NEXT,
bar: CLASS_PROGRESS_BAR,
toggle: CLASS_TOGGLE
}, function(className, key) {
elements[key] = find("." + className);
});
assign(elements, {
root,
track,
list,
slides
});
}
function init() {
var id = root.id || uniqueId(PROJECT_CODE);
var role = options.role;
root.id = id;
track.id = track.id || id + "-track";
list.id = list.id || id + "-list";
if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) {
setAttribute(root, ROLE, role);
}
setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel);
setAttribute(list, ROLE, "presentation");
}
function find(selector) {
var elm = query(root, selector);
return elm && closest(elm, "." + CLASS_ROOT) === root ? elm : void 0;
}
function getClasses(base) {
return [base + "--" + options.type, base + "--" + options.direction, options.drag && base + "--draggable", options.isNavigation && base + "--nav", base === CLASS_ROOT && CLASS_ACTIVE];
}
return assign(elements, {
setup,
mount,
destroy
});
}
var SLIDE = "slide";
var LOOP = "loop";
var FADE = "fade";
function Slide$1(Splide2, index, slideIndex, slide) {
var event = EventInterface(Splide2);
var on = event.on, emit = event.emit, bind = event.bind;
var Components = Splide2.Components, root = Splide2.root, options = Splide2.options;
var isNavigation = options.isNavigation, updateOnMove = options.updateOnMove, i18n = options.i18n, pagination = options.pagination, slideFocus = options.slideFocus;
var resolve = Components.Direction.resolve;
var styles = getAttribute(slide, "style");
var label = getAttribute(slide, ARIA_LABEL);
var isClone = slideIndex > -1;
var container = child(slide, "." + CLASS_CONTAINER);
var destroyed;
function mount() {
if (!isClone) {
slide.id = root.id + "-slide" + pad(index + 1);
setAttribute(slide, ROLE, pagination ? "tabpanel" : "group");
setAttribute(slide, ARIA_ROLEDESCRIPTION, i18n.slide);
setAttribute(slide, ARIA_LABEL, label || format(i18n.slideLabel, [index + 1, Splide2.length]));
}
listen();
}
function listen() {
bind(slide, "click", apply(emit, EVENT_CLICK, self));
bind(slide, "keydown", apply(emit, EVENT_SLIDE_KEYDOWN, self));
on([EVENT_MOVED, EVENT_SHIFTED, EVENT_SCROLLED], update);
on(EVENT_NAVIGATION_MOUNTED, initNavigation);
if (updateOnMove) {
on(EVENT_MOVE, onMove);
}
}
function destroy() {
destroyed = true;
event.destroy();
removeClass(slide, STATUS_CLASSES);
removeAttribute(slide, ALL_ATTRIBUTES);
setAttribute(slide, "style", styles);
setAttribute(slide, ARIA_LABEL, label || "");
}
function initNavigation() {
var controls = Splide2.splides.map(function(target) {
var Slide2 = target.splide.Components.Slides.getAt(index);
return Slide2 ? Slide2.slide.id : "";
}).join(" ");
setAttribute(slide, ARIA_LABEL, format(i18n.slideX, (isClone ? slideIndex : index) + 1));
setAttribute(slide, ARIA_CONTROLS, controls);
setAttribute(slide, ROLE, slideFocus ? "button" : "");
slideFocus && removeAttribute(slide, ARIA_ROLEDESCRIPTION);
}
function onMove() {
if (!destroyed) {
update();
}
}
function update() {
if (!destroyed) {
var curr = Splide2.index;
updateActivity();
updateVisibility();
toggleClass(slide, CLASS_PREV, index === curr - 1);
toggleClass(slide, CLASS_NEXT, index === curr + 1);
}
}
function updateActivity() {
var active = isActive();
if (active !== hasClass(slide, CLASS_ACTIVE)) {
toggleClass(slide, CLASS_ACTIVE, active);
setAttribute(slide, ARIA_CURRENT, isNavigation && active || "");
emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self);
}
}
function updateVisibility() {
var visible = isVisible();
var hidden = !visible && (!isActive() || isClone);
if (!Splide2.state.is([MOVING, SCROLLING])) {
setAttribute(slide, ARIA_HIDDEN, hidden || "");
}
setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : "");
if (slideFocus) {
setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);
}
if (visible !== hasClass(slide, CLASS_VISIBLE)) {
toggleClass(slide, CLASS_VISIBLE, visible);
emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self);
}
if (!visible && document.activeElement === slide) {
var Slide2 = Components.Slides.getAt(Splide2.index);
Slide2 && focus(Slide2.slide);
}
}
function style$1(prop, value, useContainer) {
style(useContainer && container || slide, prop, value);
}
function isActive() {
var curr = Splide2.index;
return curr === index || options.cloneStatus && curr === slideIndex;
}
function isVisible() {
if (Splide2.is(FADE)) {
return isActive();
}
var trackRect = rect(Components.Elements.track);
var slideRect = rect(slide);
var left = resolve("left", true);
var right = resolve("right", true);
return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]);
}
function isWithin(from, distance) {
var diff = abs(from - index);
if (!isClone && (options.rewind || Splide2.is(LOOP))) {
diff = min(diff, Splide2.length - diff);
}
return diff <= distance;
}
var self = {
index,
slideIndex,
slide,
container,
isClone,
mount,
destroy,
update,
style: style$1,
isWithin
};
return self;
}
function Slides(Splide2, Components2, options) {
var _EventInterface2 = EventInterface(Splide2), on = _EventInterface2.on, emit = _EventInterface2.emit, bind = _EventInterface2.bind;
var _Components2$Elements = Components2.Elements, slides = _Components2$Elements.slides, list = _Components2$Elements.list;
var Slides2 = [];
function mount() {
init();
on(EVENT_REFRESH, destroy);
on(EVENT_REFRESH, init);
}
function init() {
slides.forEach(function(slide, index) {
register(slide, index, -1);
});
}
function destroy() {
forEach$1(function(Slide2) {
Slide2.destroy();
});
empty(Slides2);
}
function update() {
forEach$1(function(Slide2) {
Slide2.update();
});
}
function register(slide, index, slideIndex) {
var object = Slide$1(Splide2, index, slideIndex, slide);
object.mount();
Slides2.push(object);
Slides2.sort(function(Slide1, Slide2) {
return Slide1.index - Slide2.index;
});
}
function get(excludeClones) {
return excludeClones ? filter(function(Slide2) {
return !Slide2.isClone;
}) : Slides2;
}
function getIn(page) {
var Controller2 = Components2.Controller;
var index = Controller2.toIndex(page);
var max2 = Controller2.hasFocus() ? 1 : options.perPage;
return filter(function(Slide2) {
return between(Slide2.index, index, index + max2 - 1);
});
}
function getAt(index) {
return filter(index)[0];
}
function add(items, index) {
forEach(items, function(slide) {
if (isString(slide)) {
slide = parseHtml(slide);
}
if (isHTMLElement(slide)) {
var ref2 = slides[index];
ref2 ? before(slide, ref2) : append(list, slide);
addClass(slide, options.classes.slide);
observeImages(slide, apply(emit, EVENT_RESIZE));
}
});
emit(EVENT_REFRESH);
}
function remove$1(matcher) {
remove(filter(matcher).map(function(Slide2) {
return Slide2.slide;
}));
emit(EVENT_REFRESH);
}
function forEach$1(iteratee, excludeClones) {
get(excludeClones).forEach(iteratee);
}
function filter(matcher) {
return Slides2.filter(isFunction(matcher) ? matcher : function(Slide2) {
return isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index);
});
}
function style2(prop, value, useContainer) {
forEach$1(function(Slide2) {
Slide2.style(prop, value, useContainer);
});
}
function observeImages(elm, callback) {
var images = queryAll(elm, "img");
var length = images.length;
if (length) {
images.forEach(function(img) {
bind(img, "load error", function() {
if (!--length) {
callback();
}
});
});
} else {
callback();
}
}
function getLength(excludeClones) {
return excludeClones ? slides.length : Slides2.length;
}
function isEnough() {
return Slides2.length > options.perPage;
}
return {
mount,
destroy,
update,
register,
get,
getIn,
getAt,
add,
remove: remove$1,
forEach: forEach$1,
filter,
style: style2,
getLength,
isEnough
};
}
function Layout(Splide2, Components2, options) {
var _EventInterface3 = EventInterface(Splide2), on = _EventInterface3.on, bind = _EventInterface3.bind, emit = _EventInterface3.emit;
var Slides2 = Components2.Slides;
var resolve = Components2.Direction.resolve;
var _Components2$Elements2 = Components2.Elements, root = _Components2$Elements2.root, track = _Components2$Elements2.track, list = _Components2$Elements2.list;
var getAt = Slides2.getAt, styleSlides = Slides2.style;
var vertical;
var rootRect;
var overflow;
function mount() {
init();
bind(window, "resize load", Throttle(apply(emit, EVENT_RESIZE)));
on([EVENT_UPDATED, EVENT_REFRESH], init);
on(EVENT_RESIZE, resize);
}
function init() {
vertical = options.direction === TTB;
style(root, "maxWidth", unit(options.width));
style(track, resolve("paddingLeft"), cssPadding(false));
style(track, resolve("paddingRight"), cssPadding(true));
resize(true);
}
function resize(force) {
var newRect = rect(root);
if (force || rootRect.width !== newRect.width || rootRect.height !== newRect.height) {
style(track, "height", cssTrackHeight());
styleSlides(resolve("marginRight"), unit(options.gap));
styleSlides("width", cssSlideWidth());
styleSlides("height", cssSlideHeight(), true);
rootRect = newRect;
emit(EVENT_RESIZED);
if (overflow !== (overflow = isOverflow())) {
toggleClass(root, CLASS_OVERFLOW, overflow);
emit(EVENT_OVERFLOW, overflow);
}
}
}
function cssPadding(right) {
var padding = options.padding;
var prop = resolve(right ? "right" : "left");
return padding && unit(padding[prop] || (isObject$1(padding) ? 0 : padding)) || "0px";
}
function cssTrackHeight() {
var height = "";
if (vertical) {
height = cssHeight();
assert(height, "height or heightRatio is missing.");
height = "calc(" + height + " - " + cssPadding(false) + " - " + cssPadding(true) + ")";
}
return height;
}
function cssHeight() {
return unit(options.height || rect(list).width * options.heightRatio);
}
function cssSlideWidth() {
return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
}
function cssSlideHeight() {
return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight());
}
function cssSlideSize() {
var gap = unit(options.gap);
return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")";
}
function listSize() {
return rect(list)[resolve("width")];
}
function slideSize(index, withoutGap) {
var Slide2 = getAt(index || 0);
return Slide2 ? rect(Slide2.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0;
}
function totalSize(index, withoutGap) {
var Slide2 = getAt(index);
if (Slide2) {
var right = rect(Slide2.slide)[resolve("right")];
var left = rect(list)[resolve("left")];
return abs(right - left) + (withoutGap ? 0 : getGap());
}
return 0;
}
function sliderSize(withoutGap) {
return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, withoutGap);
}
function getGap() {
var Slide2 = getAt(0);
return Slide2 && parseFloat(style(Slide2.slide, resolve("marginRight"))) || 0;
}
function getPadding(right) {
return parseFloat(style(track, resolve("padding" + (right ? "Right" : "Left")))) || 0;
}
function isOverflow() {
return Splide2.is(FADE) || sliderSize(true) > listSize();
}
return {
mount,
resize,
listSize,
slideSize,
sliderSize,
totalSize,
getPadding,
isOverflow
};
}
var MULTIPLIER = 2;
function Clones(Splide2, Components2, options) {
var event = EventInterface(Splide2);
var on = event.on;
var Elements2 = Components2.Elements, Slides2 = Components2.Slides;
var resolve = Components2.Direction.resolve;
var clones = [];
var cloneCount;
function mount() {
on(EVENT_REFRESH, remount);
on([EVENT_UPDATED, EVENT_RESIZE], observe);
if (cloneCount = computeCloneCount()) {
generate(cloneCount);
Components2.Layout.resize(true);
}
}
function remount() {
destroy();
mount();
}
function destroy() {
remove(clones);
empty(clones);
event.destroy();
}
function observe() {
var count = computeCloneCount();
if (cloneCount !== count) {
if (cloneCount < count || !count) {
event.emit(EVENT_REFRESH);
}
}
}
function generate(count) {
var slides = Slides2.get().slice();
var length = slides.length;
if (length) {
while (slides.length < count) {
push(slides, slides);
}
push(slides.slice(-count), slides.slice(0, count)).forEach(function(Slide2, index) {
var isHead = index < count;
var clone = cloneDeep(Slide2.slide, index);
isHead ? before(clone, slides[0].slide) : append(Elements2.list, clone);
push(clones, clone);
Slides2.register(clone, index - count + (isHead ? 0 : length), Slide2.index);
});
}
}
function cloneDeep(elm, index) {
var clone = elm.cloneNode(true);
addClass(clone, options.classes.clone);
clone.id = Splide2.root.id + "-clone" + pad(index + 1);
return clone;
}
function computeCloneCount() {
var clones2 = options.clones;
if (!Splide2.is(LOOP)) {
clones2 = 0;
} else if (isUndefined(clones2)) {
var fixedSize = options[resolve("fixedWidth")] && Components2.Layout.slideSize(0);
var fixedCount = fixedSize && ceil(rect(Elements2.track)[resolve("width")] / fixedSize);
clones2 = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage * MULTIPLIER;
}
return clones2;
}
return {
mount,
destroy
};
}
function Move(Splide2, Components2, options) {
var _EventInterface4 = EventInterface(Splide2), on = _EventInterface4.on, emit = _EventInterface4.emit;
var set = Splide2.state.set;
var _Components2$Layout = Components2.Layout, slideSize = _Components2$Layout.slideSize, getPadding = _Components2$Layout.getPadding, totalSize = _Components2$Layout.totalSize, listSize = _Components2$Layout.listSize, sliderSize = _Components2$Layout.sliderSize;
var _Components2$Directio = Components2.Direction, resolve = _Components2$Directio.resolve, orient = _Components2$Directio.orient;
var _Components2$Elements3 = Components2.Elements, list = _Components2$Elements3.list, track = _Components2$Elements3.track;
var Transition;
function mount() {
Transition = Components2.Transition;
on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition);
}
function reposition() {
if (!Components2.Controller.isBusy()) {
Components2.Scroll.cancel();
jump(Splide2.index);
Components2.Slides.update();
}
}
function move(dest, index, prev, callback) {
if (dest !== index && canShift(dest > prev)) {
cancel();
translate(shift(getPosition(), dest > prev), true);
}
set(MOVING);
emit(EVENT_MOVE, index, prev, dest);
Transition.start(index, function() {
set(IDLE);
emit(EVENT_MOVED, index, prev, dest);
callback && callback();
});
}
function jump(index) {
translate(toPosition(index, true));
}
function translate(position, preventLoop) {
if (!Splide2.is(FADE)) {
var destination = preventLoop ? position : loop(position);
style(list, "transform", "translate" + resolve("X") + "(" + destination + "px)");
position !== destination && emit(EVENT_SHIFTED);
}
}
function loop(position) {
if (Splide2.is(LOOP)) {
var index = toIndex(position);
var exceededMax = index > Components2.Controller.getEnd();
var exceededMin = index < 0;
if (exceededMin || exceededMax) {
position = shift(position, exceededMax);
}
}
return position;
}
function shift(position, backwards) {
var excess = position - getLimit(backwards);
var size = sliderSize();
position -= orient(size * (ceil(abs(excess) / size) || 1)) * (backwards ? 1 : -1);
return position;
}
function cancel() {
translate(getPosition(), true);
Transition.cancel();
}
function toIndex(position) {
var Slides2 = Components2.Slides.get();
var index = 0;
var minDistance = Infinity;
for (var i = 0; i < Slides2.length; i++) {
var slideIndex = Slides2[i].index;
var distance = abs(toPosition(slideIndex, true) - position);
if (distance <= minDistance) {
minDistance = distance;
index = slideIndex;
} else {
break;
}
}
return index;
}
function toPosition(index, trimming) {
var position = orient(totalSize(index - 1) - offset(index));
return trimming ? trim(position) : position;
}
function getPosition() {
var left = resolve("left");
return rect(list)[left] - rect(track)[left] + orient(getPadding(false));
}
function trim(position) {
if (options.trimSpace && Splide2.is(SLIDE)) {
position = clamp(position, 0, orient(sliderSize(true) - listSize()));
}
return position;
}
function offset(index) {
var focus2 = options.focus;
return focus2 === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus2 * slideSize(index) || 0;
}
function getLimit(max2) {
return toPosition(max2 ? Components2.Controller.getEnd() : 0, !!options.trimSpace);
}
function canShift(backwards) {
var shifted = orient(shift(getPosition(), backwards));
return backwards ? shifted >= 0 : shifted <= list[resolve("scrollWidth")] - rect(track)[resolve("width")];
}
function exceededLimit(max2, position) {
position = isUndefined(position) ? getPosition() : position;
var exceededMin = max2 !== true && orient(position) < orient(getLimit(false));
var exceededMax = max2 !== false && orient(position) > orient(getLimit(true));
return exceededMin || exceededMax;
}
return {
mount,
move,
jump,
translate,
shift,
cancel,
toIndex,
toPosition,
getPosition,
getLimit,
exceededLimit,
reposition
};
}
function Controller(Splide2, Components2, options) {
var _EventInterface5 = EventInterface(Splide2), on = _EventInterface5.on, emit = _EventInterface5.emit;
var Move2 = Components2.Move;
var getPosition = Move2.getPosition, getLimit = Move2.getLimit, toPosition = Move2.toPosition;
var _Components2$Slides = Components2.Slides, isEnough = _Components2$Slides.isEnough, getLength = _Components2$Slides.getLength;
var omitEnd = options.omitEnd;
var isLoop = Splide2.is(LOOP);
var isSlide = Splide2.is(SLIDE);
var getNext = apply(getAdjacent, false);
var getPrev = apply(getAdjacent, true);
var currIndex = options.start || 0;
var endIndex;
var prevIndex = currIndex;
var slideCount;
var perMove;
var perPage;
function mount() {
init();
on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], init);
on(EVENT_RESIZED, onResized);
}
function init() {
slideCount = getLength(true);
perMove = options.perMove;
perPage = options.perPage;
endIndex = getEnd();
var index = clamp(currIndex, 0, omitEnd ? endIndex : slideCount - 1);
if (index !== currIndex) {
currIndex = index;
Move2.reposition();
}
}
function onResized() {
if (endIndex !== getEnd()) {
emit(EVENT_END_INDEX_CHANGED);
}
}
function go(control, allowSameIndex, callback) {
if (!isBusy()) {
var dest = parse(control);
var index = loop(dest);
if (index > -1 && (allowSameIndex || index !== currIndex)) {
setIndex(index);
Move2.move(dest, index, prevIndex, callback);
}
}
}
function scroll(destination, duration, snap, callback) {
Components2.Scroll.scroll(destination, duration, snap, function() {
var index = loop(Move2.toIndex(getPosition()));
setIndex(omitEnd ? min(index, endIndex) : index);
callback && callback();
});
}
function parse(control) {
var index = currIndex;
if (isString(control)) {
var _ref = control.match(/([+\-<>])(\d+)?/) || [], indicator = _ref[1], number = _ref[2];
if (indicator === "+" || indicator === "-") {
index = computeDestIndex(currIndex + +("" + indicator + (+number || 1)), currIndex);
} else if (indicator === ">") {
index = number ? toIndex(+number) : getNext(true);
} else if (indicator === "<") {
index = getPrev(true);
}
} else {
index = isLoop ? control : clamp(control, 0, endIndex);
}
return index;
}
function getAdjacent(prev, destination) {
var number = perMove || (hasFocus() ? 1 : perPage);
var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex, !(perMove || hasFocus()));
if (dest === -1 && isSlide) {
if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) {
return prev ? 0 : endIndex;
}
}
return destination ? dest : loop(dest);
}
function computeDestIndex(dest, from, snapPage) {
if (isEnough() || hasFocus()) {
var index = computeMovableDestIndex(dest);
if (index !== dest) {
from = dest;
dest = index;
snapPage = false;
}
if (dest < 0 || dest > endIndex) {
if (!perMove && (between(0, dest, from, true) || between(endIndex, from, dest, true))) {
dest = toIndex(toPage(dest));
} else {
if (isLoop) {
dest = snapPage ? dest < 0 ? -(slideCount % perPage || perPage) : slideCount : dest;
} else if (options.rewind) {
dest = dest < 0 ? endIndex : 0;
} else {
dest = -1;
}
}
} else {
if (snapPage && dest !== from) {
dest = toIndex(toPage(from) + (dest < from ? -1 : 1));
}
}
} else {
dest = -1;
}
return dest;
}
function computeMovableDestIndex(dest) {
if (isSlide && options.trimSpace === "move" && dest !== currIndex) {
var position = getPosition();
while (position === toPosition(dest, true) && between(dest, 0, Splide2.length - 1, !options.rewind)) {
dest < currIndex ? --dest : ++dest;
}
}
return dest;
}
function loop(index) {
return isLoop ? (index + slideCount) % slideCount || 0 : index;
}
function getEnd() {
var end = slideCount - (hasFocus() || isLoop && perMove ? 1 : perPage);
while (omitEnd && end-- > 0) {
if (toPosition(slideCount - 1, true) !== toPosition(end, true)) {
end++;
break;
}
}
return clamp(end, 0, slideCount - 1);
}
function toIndex(page) {
return clamp(hasFocus() ? page : perPage * page, 0, endIndex);
}
function toPage(index) {
return hasFocus() ? min(index, endIndex) : floor((index >= endIndex ? slideCount - 1 : index) / perPage);
}
function toDest(destination) {
var closest2 = Move2.toIndex(destination);
return isSlide ? clamp(closest2, 0, endIndex) : closest2;
}
function setIndex(index) {
if (index !== currIndex) {
prevIndex = currIndex;
currIndex = index;
}
}
function getIndex(prev) {
return prev ? prevIndex : currIndex;
}
function hasFocus() {
return !isUndefined(options.focus) || options.isNavigation;
}
function isBusy() {
return Splide2.state.is([MOVING, SCROLLING]) && !!options.waitForTransition;
}
return {
mount,
go,
scroll,
getNext,
getPrev,
getAdjacent,
getEnd,
setIndex,
getIndex,
toIndex,
toPage,
toDest,
hasFocus,
isBusy
};
}
var XML_NAME_SPACE = "http://www.w3.org/2000/svg";
var PATH = "m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z";
var SIZE = 40;
function Arrows(Splide2, Components2, options) {
var event = EventInterface(Splide2);
var on = event.on, bind = event.bind, emit = event.emit;
var classes = options.classes, i18n = options.i18n;
var Elements2 = Components2.Elements, Controller2 = Components2.Controller;
var placeholder = Elements2.arrows, track = Elements2.track;
var wrapper = placeholder;
var prev = Elements2.prev;
var next = Elements2.next;
var created;
var wrapperClasses;
var arrows = {};
function mount() {
init();
on(EVENT_UPDATED, remount);
}
function remount() {
destroy();
mount();
}
function init() {
var enabled = options.arrows;
if (enabled && !(prev && next)) {
createArrows();
}
if (prev && next) {
assign(arrows, {
prev,
next
});
display(wrapper, enabled ? "" : "none");
addClass(wrapper, wrapperClasses = CLASS_ARROWS + "--" + options.direction);
if (enabled) {
listen();
update();
setAttribute([prev, next], ARIA_CONTROLS, track.id);
emit(EVENT_ARROWS_MOUNTED, prev, next);
}
}
}
function destroy() {
event.destroy();
removeClass(wrapper, wrapperClasses);
if (created) {
remove(placeholder ? [prev, next] : wrapper);
prev = next = null;
} else {
removeAttribute([prev, next], ALL_ATTRIBUTES);
}
}
function listen() {
on([EVENT_MOUNTED, EVENT_MOVED, EVENT_REFRESH, EVENT_SCROLLED, EVENT_END_INDEX_CHANGED], update);
bind(next, "click", apply(go, ">"));
bind(prev, "click", apply(go, "<"));
}
function go(control) {
Controller2.go(control, true);
}
function createArrows() {
wrapper = placeholder || create("div", classes.arrows);
prev = createArrow(true);
next = createArrow(false);
created = true;
append(wrapper, [prev, next]);
!placeholder && before(wrapper, track);
}
function createArrow(prev2) {
var arrow = '<button class="' + classes.arrow + " " + (prev2 ? classes.prev : classes.next) + '" type="button"><svg xmlns="' + XML_NAME_SPACE + '" viewBox="0 0 ' + SIZE + " " + SIZE + '" width="' + SIZE + '" height="' + SIZE + '" focusable="false"><path d="' + (options.arrowPath || PATH) + '" />';
return parseHtml(arrow);
}
function update() {
if (prev && next) {
var index = Splide2.index;
var prevIndex = Controller2.getPrev();
var nextIndex = Controller2.getNext();
var prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev;
var nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next;
prev.disabled = prevIndex < 0;
next.disabled = nextIndex < 0;
setAttribute(prev, ARIA_LABEL, prevLabel);
setAttribute(next, ARIA_LABEL, nextLabel);
emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex);
}
}
return {
arrows,
mount,
destroy,
update
};
}
var INTERVAL_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-interval";
function Autoplay(Splide2, Components2, options) {
var _EventInterface6 = EventInterface(Splide2), on = _EventInterface6.on, bind = _EventInterface6.bind, emit = _EventInterface6.emit;
var interval = RequestInterval(options.interval, Splide2.go.bind(Splide2, ">"), onAnimationFrame);
var isPaused = interval.isPaused;
var Elements2 = Components2.Elements, _Components2$Elements4 = Components2.Elements, root = _Components2$Elements4.root, toggle = _Components2$Elements4.toggle;
var autoplay = options.autoplay;
var hovered;
var focused;
var stopped = autoplay === "pause";
function mount() {
if (autoplay) {
listen();
toggle && setAttribute(toggle, ARIA_CONTROLS, Elements2.track.id);
stopped || play();
update();
}
}
function listen() {
if (options.pauseOnHover) {
bind(root, "mouseenter mouseleave", function(e) {
hovered = e.type === "mouseenter";
autoToggle();
});
}
if (options.pauseOnFocus) {
bind(root, "focusin focusout", function(e) {
focused = e.type === "focusin";
autoToggle();
});
}
if (toggle) {
bind(toggle, "click", function() {
stopped ? play() : pause(true);
});
}
on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind);
on(EVENT_MOVE, onMove);
}
function play() {
if (isPaused() && Components2.Slides.isEnough()) {
interval.start(!options.resetProgress);
focused = hovered = stopped = false;
update();
emit(EVENT_AUTOPLAY_PLAY);
}
}
function pause(stop) {
if (stop === void 0) {
stop = true;
}
stopped = !!stop;
update();
if (!isPaused()) {
interval.pause();
emit(EVENT_AUTOPLAY_PAUSE);
}
}
function autoToggle() {
if (!stopped) {
hovered || focused ? pause(false) : play();
}
}
function update() {
if (toggle) {
toggleClass(toggle, CLASS_ACTIVE, !stopped);
setAttribute(toggle, ARIA_LABEL, options.i18n[stopped ? "play" : "pause"]);
}
}
function onAnimationFrame(rate) {
var bar = Elements2.bar;
bar && style(bar, "width", rate * 100 + "%");
emit(EVENT_AUTOPLAY_PLAYING, rate);
}
function onMove(index) {
var Slide2 = Components2.Slides.getAt(index);
interval.set(Slide2 && +getAttribute(Slide2.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval);
}
return {
mount,
destroy: interval.cancel,
play,
pause,
isPaused
};
}
function Cover(Splide2, Components2, options) {
var _EventInterface7 = EventInterface(Splide2), on = _EventInterface7.on;
function mount() {
if (options.cover) {
on(EVENT_LAZYLOAD_LOADED, apply(toggle, true));
on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply(cover, true));
}
}
function cover(cover2) {
Components2.Slides.forEach(function(Slide2) {
var img = child(Slide2.container || Slide2.slide, "img");
if (img && img.src) {
toggle(cover2, img, Slide2);
}
});
}
function toggle(cover2, img, Slide2) {
Slide2.style("background", cover2 ? 'center/cover no-repeat url("' + img.src + '")' : "", true);
display(img, cover2 ? "none" : "");
}
return {
mount,
destroy: apply(cover, false)
};
}
var BOUNCE_DIFF_THRESHOLD = 10;
var BOUNCE_DURATION = 600;
var FRICTION_FACTOR = 0.6;
var BASE_VELOCITY = 1.5;
var MIN_DURATION = 800;
function Scroll(Splide2, Components2, options) {
var _EventInterface8 = EventInterface(Splide2), on = _EventInterface8.on, emit = _EventInterface8.emit;
var set = Splide2.state.set;
var Move2 = Components2.Move;
var getPosition = Move2.getPosition, getLimit = Move2.getLimit, exceededLimit = Move2.exceededLimit, translate = Move2.translate;
var isSlide = Splide2.is(SLIDE);
var interval;
var callback;
var friction = 1;
function mount() {
on(EVENT_MOVE, clear);
on([EVENT_UPDATED, EVENT_REFRESH], cancel);
}
function scroll(destination, duration, snap, onScrolled, noConstrain) {
var from = getPosition();
clear();
if (snap && (!isSlide || !exceededLimit())) {
var size = Components2.Layout.sliderSize();
var offset = sign(destination) * size * floor(abs(destination) / size) || 0;
destination = Move2.toPosition(Components2.Controller.toDest(destination % size)) + offset;
}
var noDistance = approximatelyEqual(from, destination, 1);
friction = 1;
duration = noDistance ? 0 : duration || max(abs(destination - from) / BASE_VELOCITY, MIN_DURATION);
callback = onScrolled;
interval = RequestInterval(duration, onEnd, apply(update, from, destination, noConstrain), 1);
set(SCROLLING);
emit(EVENT_SCROLL);
interval.start();
}
function onEnd() {
set(IDLE);
callback && callback();
emit(EVENT_SCROLLED);
}
function update(from, to, noConstrain, rate) {
var position = getPosition();
var target = from + (to - from) * easing(rate);
var diff = (target - position) * friction;
translate(position + diff);
if (isSlide && !noConstrain && exceededLimit()) {
friction *= FRICTION_FACTOR;
if (abs(diff) < BOUNCE_DIFF_THRESHOLD) {
scroll(getLimit(exceededLimit(true)), BOUNCE_DURATION, false, callback, true);
}
}
}
function clear() {
if (interval) {
interval.cancel();
}
}
function cancel() {
if (interval && !interval.isPaused()) {
clear();
onEnd();
}
}
function easing(t) {
var easingFunc = options.easingFunc;
return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4);
}
return {
mount,
destroy: clear,
scroll,
cancel
};
}
var SCROLL_LISTENER_OPTIONS = {
passive: false,
capture: true
};
function Drag(Splide2, Components2, options) {
var _EventInterface9 = EventInterface(Splide2), on = _EventInterface9.on, emit = _EventInterface9.emit, bind = _EventInterface9.bind, unbind = _EventInterface9.unbind;
var state = Splide2.state;
var Move2 = Components2.Move, Scroll2 = Components2.Scroll, Controller2 = Components2.Controller, track = Components2.Elements.track, reduce = Components2.Media.reduce;
var _Components2$Directio2 = Components2.Direction, resolve = _Components2$Directio2.resolve, orient = _Components2$Directio2.orient;
var getPosition = Move2.getPosition, exceededLimit = Move2.exceededLimit;
var basePosition;
var baseEvent;
var prevBaseEvent;
var isFree;
var dragging;
var exceeded = false;
var clickPrevented;
var disabled;
var target;
function mount() {
bind(track, POINTER_MOVE_EVENTS, noop, SCROLL_LISTENER_OPTIONS);
bind(track, POINTER_UP_EVENTS, noop, SCROLL_LISTENER_OPTIONS);
bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS);
bind(track, "click", onClick, {
capture: true
});
bind(track, "dragstart", prevent);
on([EVENT_MOUNTED, EVENT_UPDATED], init);
}
function init() {
var drag = options.drag;
disable(!drag);
isFree = drag === "free";
}
function onPointerDown(e) {
clickPrevented = false;
if (!disabled) {
var isTouch = isTouchEvent(e);
if (isDraggable(e.target) && (isTouch || !e.button)) {
if (!Controller2.isBusy()) {
target = isTouch ? track : window;
dragging = state.is([MOVING, SCROLLING]);
prevBaseEvent = null;
bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS);
bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS);
Move2.cancel();
Scroll2.cancel();
save(e);
} else {
prevent(e, true);
}
}
}
}
function onPointerMove(e) {
if (!state.is(DRAGGING)) {
state.set(DRAGGING);
emit(EVENT_DRAG);
}
if (e.cancelable) {
if (dragging) {
Move2.translate(basePosition + constrain(diffCoord(e)));
var expired = diffTime(e) > LOG_INTERVAL;
var hasExceeded = exceeded !== (exceeded = exceededLimit());
if (expired || hasExceeded) {
save(e);
}
clickPrevented = true;
emit(EVENT_DRAGGING);
prevent(e);
} else if (isSliderDirection(e)) {
dragging = shouldStart(e);
prevent(e);
}
}
}
function onPointerUp(e) {
if (state.is(DRAGGING)) {
state.set(IDLE);
emit(EVENT_DRAGGED);
}
if (dragging) {
move(e);
prevent(e);
}
unbind(target, POINTER_MOVE_EVENTS, onPointerMove);
unbind(target, POINTER_UP_EVENTS, onPointerUp);
dragging = false;
}
function onClick(e) {
if (!disabled && clickPrevented) {
prevent(e, true);
}
}
function save(e) {
prevBaseEvent = baseEvent;
baseEvent = e;
basePosition = getPosition();
}
function move(e) {
var velocity = computeVelocity(e);
var destination = computeDestination(velocity);
var rewind = options.rewind && options.rewindByDrag;
reduce(false);
if (isFree) {
Controller2.scroll(destination, 0, options.snap);
} else if (Splide2.is(FADE)) {
Controller2.go(orient(sign(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+");
} else if (Splide2.is(SLIDE) && exceeded && rewind) {
Controller2.go(exceededLimit(true) ? ">" : "<");
} else {
Controller2.go(Controller2.toDest(destination), true);
}
reduce(true);
}
function shouldStart(e) {
var thresholds = options.dragMinThreshold;
var isObj = isObject$1(thresholds);
var mouse = isObj && thresholds.mouse || 0;
var touch = (isObj ? thresholds.touch : +thresholds) || 10;
return abs(diffCoord(e)) > (isTouchEvent(e) ? touch : mouse);
}
function isSliderDirection(e) {
return abs(diffCoord(e)) > abs(diffCoord(e, true));
}
function computeVelocity(e) {
if (Splide2.is(LOOP) || !exceeded) {
var time = diffTime(e);
if (time && time < LOG_INTERVAL) {
return diffCoord(e) / time;
}
}
return 0;
}
function computeDestination(velocity) {
return getPosition() + sign(velocity) * min(abs(velocity) * (options.flickPower || 600), isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1));
}
function diffCoord(e, orthogonal) {
return coordOf(e, orthogonal) - coordOf(getBaseEvent(e), orthogonal);
}
function diffTime(e) {
return timeOf(e) - timeOf(getBaseEvent(e));
}
function getBaseEvent(e) {
return baseEvent === e && prevBaseEvent || baseEvent;
}
function coordOf(e, orthogonal) {
return (isTouchEvent(e) ? e.changedTouches[0] : e)["page" + resolve(orthogonal ? "Y" : "X")];
}
function constrain(diff) {
return diff / (exceeded && Splide2.is(SLIDE) ? FRICTION : 1);
}
function isDraggable(target2) {
var noDrag = options.noDrag;
return !matches(target2, "." + CLASS_PAGINATION_PAGE + ", ." + CLASS_ARROW) && (!noDrag || !matches(target2, noDrag));
}
function isTouchEvent(e) {
return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
}
function isDragging() {
return dragging;
}
function disable(value) {
disabled = value;
}
return {
mount,
disable,
isDragging
};
}
var NORMALIZATION_MAP = {
Spacebar: " ",
Right: ARROW_RIGHT,
Left: ARROW_LEFT,
Up: ARROW_UP,
Down: ARROW_DOWN
};
function normalizeKey(key) {
key = isString(key) ? key : key.key;
return NORMALIZATION_MAP[key] || key;
}
var KEYBOARD_EVENT = "keydown";
function Keyboard(Splide2, Components2, options) {
var _EventInterface10 = EventInterface(Splide2), on = _EventInterface10.on, bind = _EventInterface10.bind, unbind = _EventInterface10.unbind;
var root = Splide2.root;
var resolve = Components2.Direction.resolve;
var target;
var disabled;
function mount() {
init();
on(EVENT_UPDATED, destroy);
on(EVENT_UPDATED, init);
on(EVENT_MOVE, onMove);
}
function init() {
var keyboard = options.keyboard;
if (keyboard) {
target = keyboard === "global" ? window : root;
bind(target, KEYBOARD_EVENT, onKeydown);
}
}
function destroy() {
unbind(target, KEYBOARD_EVENT);
}
function disable(value) {
disabled = value;
}
function onMove() {
var _disabled = disabled;
disabled = true;
nextTick(function() {
disabled = _disabled;
});
}
function onKeydown(e) {
if (!disabled) {
var key = normalizeKey(e);
if (key === resolve(ARROW_LEFT)) {
Splide2.go("<");
} else if (key === resolve(ARROW_RIGHT)) {
Splide2.go(">");
}
}
}
return {
mount,
destroy,
disable
};
}
var SRC_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-lazy";
var SRCSET_DATA_ATTRIBUTE = SRC_DATA_ATTRIBUTE + "-srcset";
var IMAGE_SELECTOR = "[" + SRC_DATA_ATTRIBUTE + "], [" + SRCSET_DATA_ATTRIBUTE + "]";
function LazyLoad(Splide2, Components2, options) {
var _EventInterface11 = EventInterface(Splide2), on = _EventInterface11.on, off = _EventInterface11.off, bind = _EventInterface11.bind, emit = _EventInterface11.emit;
var isSequential = options.lazyLoad === "sequential";
var events = [EVENT_MOVED, EVENT_SCROLLED];
var entries = [];
function mount() {
if (options.lazyLoad) {
init();
on(EVENT_REFRESH, init);
}
}
function init() {
empty(entries);
register();
if (isSequential) {
loadNext();
} else {
off(events);
on(events, check);
check();
}
}
function register() {
Components2.Slides.forEach(function(Slide2) {
queryAll(Slide2.slide, IMAGE_SELECTOR).forEach(function(img) {
var src = getAttribute(img, SRC_DATA_ATTRIBUTE);
var srcset = getAttribute(img, SRCSET_DATA_ATTRIBUTE);
if (src !== img.src || srcset !== img.srcset) {
var className = options.classes.spinner;
var parent = img.parentElement;
var spinner = child(parent, "." + className) || create("span", className, parent);
entries.push([img, Slide2, spinner]);
img.src || display(img, "none");
}
});
});
}
function check() {
entries = entries.filter(function(data) {
var distance = options.perPage * ((options.preloadPages || 1) + 1) - 1;
return data[1].isWithin(Splide2.index, distance) ? load(data) : true;
});
entries.length || off(events);
}
function load(data) {
var img = data[0];
addClass(data[1].slide, CLASS_LOADING);
bind(img, "load error", apply(onLoad, data));
setAttribute(img, "src", getAttribute(img, SRC_DATA_ATTRIBUTE));
setAttribute(img, "srcset", getAttribute(img, SRCSET_DATA_ATTRIBUTE));
removeAttribute(img, SRC_DATA_ATTRIBUTE);
removeAttribute(img, SRCSET_DATA_ATTRIBUTE);
}
function onLoad(data, e) {
var img = data[0], Slide2 = data[1];
removeClass(Slide2.slide, CLASS_LOADING);
if (e.type !== "error") {
remove(data[2]);
display(img, "");
emit(EVENT_LAZYLOAD_LOADED, img, Slide2);
emit(EVENT_RESIZE);
}
isSequential && loadNext();
}
function loadNext() {
entries.length && load(entries.shift());
}
return {
mount,
destroy: apply(empty, entries),
check
};
}
function Pagination(Splide2, Components2, options) {
var event = EventInterface(Splide2);
var on = event.on, emit = event.emit, bind = event.bind;
var Slides2 = Components2.Slides, Elements2 = Components2.Elements, Controller2 = Components2.Controller;
var hasFocus = Controller2.hasFocus, getIndex = Controller2.getIndex, go = Controller2.go;
var resolve = Components2.Direction.resolve;
var placeholder = Elements2.pagination;
var items = [];
var list;
var paginationClasses;
function mount() {
destroy();
on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], mount);
var enabled = options.pagination;
placeholder && display(placeholder, enabled ? "" : "none");
if (enabled) {
on([EVENT_MOVE, EVENT_SCROLL, EVENT_SCROLLED], update);
createPagination();
update();
emit(EVENT_PAGINATION_MOUNTED, {
list,
items
}, getAt(Splide2.index));
}
}
function destroy() {
if (list) {
remove(placeholder ? slice(list.children) : list);
removeClass(list, paginationClasses);
empty(items);
list = null;
}
event.destroy();
}
function createPagination() {
var length = Splide2.length;
var classes = options.classes, i18n = options.i18n, perPage = options.perPage;
var max2 = hasFocus() ? Controller2.getEnd() + 1 : ceil(length / perPage);
list = placeholder || create("ul", classes.pagination, Elements2.track.parentElement);
addClass(list, paginationClasses = CLASS_PAGINATION + "--" + getDirection());
setAttribute(list, ROLE, "tablist");
setAttribute(list, ARIA_LABEL, i18n.select);
setAttribute(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : "");
for (var i = 0; i < max2; i++) {
var li = create("li", null, list);
var button = create("button", {
class: classes.page,
type: "button"
}, li);
var controls = Slides2.getIn(i).map(function(Slide2) {
return Slide2.slide.id;
});
var text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX;
bind(button, "click", apply(onClick, i));
if (options.paginationKeyboard) {
bind(button, "keydown", apply(onKeydown, i));
}
setAttribute(li, ROLE, "presentation");
setAttribute(button, ROLE, "tab");
setAttribute(button, ARIA_CONTROLS, controls.join(" "));
setAttribute(button, ARIA_LABEL, format(text, i + 1));
setAttribute(button, TAB_INDEX, -1);
items.push({
li,
button,
page: i
});
}
}
function onClick(page) {
go(">" + page, true);
}
function onKeydown(page, e) {
var length = items.length;
var key = normalizeKey(e);
var dir = getDirection();
var nextPage = -1;
if (key === resolve(ARROW_RIGHT, false, dir)) {
nextPage = ++page % length;
} else if (key === resolve(ARROW_LEFT, false, dir)) {
nextPage = (--page + length) % length;
} else if (key === "Home") {
nextPage = 0;
} else if (key === "End") {
nextPage = length - 1;
}
var item = items[nextPage];
if (item) {
focus(item.button);
go(">" + nextPage);
prevent(e, true);
}
}
function getDirection() {
return options.paginationDirection || options.direction;
}
function getAt(index) {
return items[Controller2.toPage(index)];
}
function update() {
var prev = getAt(getIndex(true));
var curr = getAt(getIndex());
if (prev) {
var button = prev.button;
removeClass(button, CLASS_ACTIVE);
removeAttribute(button, ARIA_SELECTED);
setAttribute(button, TAB_INDEX, -1);
}
if (curr) {
var _button = curr.button;
addClass(_button, CLASS_ACTIVE);
setAttribute(_button, ARIA_SELECTED, true);
setAttribute(_button, TAB_INDEX, "");
}
emit(EVENT_PAGINATION_UPDATED, {
list,
items
}, prev, curr);
}
return {
items,
mount,
destroy,
getAt,
update
};
}
var TRIGGER_KEYS = [" ", "Enter"];
function Sync(Splide2, Components2, options) {
var isNavigation = options.isNavigation, slideFocus = options.slideFocus;
var events = [];
function mount() {
Splide2.splides.forEach(function(target) {
if (!target.isParent) {
sync(Splide2, target.splide);
sync(target.splide, Splide2);
}
});
if (isNavigation) {
navigate();
}
}
function destroy() {
events.forEach(function(event) {
event.destroy();
});
empty(events);
}
function remount() {
destroy();
mount();
}
function sync(splide, target) {
var event = EventInterface(splide);
event.on(EVENT_MOVE, function(index, prev, dest) {
target.go(target.is(LOOP) ? dest : index);
});
events.push(event);
}
function navigate() {
var event = EventInterface(Splide2);
var on = event.on;
on(EVENT_CLICK, onClick);
on(EVENT_SLIDE_KEYDOWN, onKeydown);
on([EVENT_MOUNTED, EVENT_UPDATED], update);
events.push(event);
event.emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides);
}
function update() {
setAttribute(Components2.Elements.list, ARIA_ORIENTATION, options.direction === TTB ? "vertical" : "");
}
function onClick(Slide2) {
Splide2.go(Slide2.index);
}
function onKeydown(Slide2, e) {
if (includes(TRIGGER_KEYS, normalizeKey(e))) {
onClick(Slide2);
prevent(e);
}
}
return {
setup: apply(Components2.Media.set, {
slideFocus: isUndefined(slideFocus) ? isNavigation : slideFocus
}, true),
mount,
destroy,
remount
};
}
function Wheel(Splide2, Components2, options) {
var _EventInterface12 = EventInterface(Splide2), bind = _EventInterface12.bind;
var lastTime = 0;
function mount() {
if (options.wheel) {
bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS);
}
}
function onWheel(e) {
if (e.cancelable) {
var deltaY = e.deltaY;
var backwards = deltaY < 0;
var timeStamp = timeOf(e);
var _min = options.wheelMinThreshold || 0;
var sleep = options.wheelSleep || 0;
if (abs(deltaY) > _min && timeStamp - lastTime > sleep) {
Splide2.go(backwards ? "<" : ">");
lastTime = timeStamp;
}
shouldPrevent(backwards) && prevent(e);
}
}
function shouldPrevent(backwards) {
return !options.releaseWheel || Splide2.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1;
}
return {
mount
};
}
var SR_REMOVAL_DELAY = 90;
function Live(Splide2, Components2, options) {
var _EventInterface13 = EventInterface(Splide2), on = _EventInterface13.on;
var track = Components2.Elements.track;
var enabled = options.live && !options.isNavigation;
var sr = create("span", CLASS_SR);
var interval = RequestInterval(SR_REMOVAL_DELAY, apply(toggle, false));
function mount() {
if (enabled) {
disable(!Components2.Autoplay.isPaused());
setAttribute(track, ARIA_ATOMIC, true);
sr.textContent = "\u2026";
on(EVENT_AUTOPLAY_PLAY, apply(disable, true));
on(EVENT_AUTOPLAY_PAUSE, apply(disable, false));
on([EVENT_MOVED, EVENT_SCROLLED], apply(toggle, true));
}
}
function toggle(active) {
setAttribute(track, ARIA_BUSY, active);
if (active) {
append(track, sr);
interval.start();
} else {
remove(sr);
interval.cancel();
}
}
function destroy() {
removeAttribute(track, [ARIA_LIVE, ARIA_ATOMIC, ARIA_BUSY]);
remove(sr);
}
function disable(disabled) {
if (enabled) {
setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite");
}
}
return {
mount,
disable,
destroy
};
}
var ComponentConstructors = /* @__PURE__ */ Object.freeze({
__proto__: null,
Media,
Direction,
Elements,
Slides,
Layout,
Clones,
Move,
Controller,
Arrows,
Autoplay,
Cover,
Scroll,
Drag,
Keyboard,
LazyLoad,
Pagination,
Sync,
Wheel,
Live
});
var I18N = {
prev: "Previous slide",
next: "Next slide",
first: "Go to first slide",
last: "Go to last slide",
slideX: "Go to slide %s",
pageX: "Go to page %s",
play: "Start autoplay",
pause: "Pause autoplay",
carousel: "carousel",
slide: "slide",
select: "Select a slide to show",
slideLabel: "%s of %s"
};
var DEFAULTS = {
type: "slide",
role: "region",
speed: 400,
perPage: 1,
cloneStatus: true,
arrows: true,
pagination: true,
paginationKeyboard: true,
interval: 5e3,
pauseOnHover: true,
pauseOnFocus: true,
resetProgress: true,
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
drag: true,
direction: "ltr",
trimSpace: true,
focusableNodes: "a, button, textarea, input, select, iframe",
live: true,
classes: CLASSES,
i18n: I18N,
reducedMotion: {
speed: 0,
rewindSpeed: 0,
autoplay: "pause"
}
};
function Fade(Splide2, Components2, options) {
var Slides2 = Components2.Slides;
function mount() {
EventInterface(Splide2).on([EVENT_MOUNTED, EVENT_REFRESH], init);
}
function init() {
Slides2.forEach(function(Slide2) {
Slide2.style("transform", "translateX(-" + 100 * Slide2.index + "%)");
});
}
function start(index, done) {
Slides2.style("transition", "opacity " + options.speed + "ms " + options.easing);
nextTick(done);
}
return {
mount,
start,
cancel: noop
};
}
function Slide(Splide2, Components2, options) {
var Move2 = Components2.Move, Controller2 = Components2.Controller, Scroll2 = Components2.Scroll;
var list = Components2.Elements.list;
var transition = apply(style, list, "transition");
var endCallback;
function mount() {
EventInterface(Splide2).bind(list, "transitionend", function(e) {
if (e.target === list && endCallback) {
cancel();
endCallback();
}
});
}
function start(index, done) {
var destination = Move2.toPosition(index, true);
var position = Move2.getPosition();
var speed = getSpeed(index);
if (abs(destination - position) >= 1 && speed >= 1) {
if (options.useScroll) {
Scroll2.scroll(destination, speed, false, done);
} else {
transition("transform " + speed + "ms " + options.easing);
Move2.translate(destination, true);
endCallback = done;
}
} else {
Move2.jump(index);
done();
}
}
function cancel() {
transition("");
Scroll2.cancel();
}
function getSpeed(index) {
var rewindSpeed = options.rewindSpeed;
if (Splide2.is(SLIDE) && rewindSpeed) {
var prev = Controller2.getIndex(true);
var end = Controller2.getEnd();
if (prev === 0 && index >= end || prev >= end && index === 0) {
return rewindSpeed;
}
}
return options.speed;
}
return {
mount,
start,
cancel
};
}
var _Splide = /* @__PURE__ */ function() {
function _Splide2(target, options) {
this.event = EventInterface();
this.Components = {};
this.state = State(CREATED);
this.splides = [];
this._o = {};
this._E = {};
var root = isString(target) ? query(document, target) : target;
assert(root, root + " is invalid.");
this.root = root;
options = merge$1({
label: getAttribute(root, ARIA_LABEL) || "",
labelledby: getAttribute(root, ARIA_LABELLEDBY) || ""
}, DEFAULTS, _Splide2.defaults, options || {});
try {
merge$1(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE)));
} catch (e) {
assert(false, "Invalid JSON");
}
this._o = Object.create(merge$1({}, options));
}
var _proto = _Splide2.prototype;
_proto.mount = function mount(Extensions, Transition) {
var _this = this;
var state = this.state, Components2 = this.Components;
assert(state.is([CREATED, DESTROYED]), "Already mounted!");
state.set(CREATED);
this._C = Components2;
this._T = Transition || this._T || (this.is(FADE) ? Fade : Slide);
this._E = Extensions || this._E;
var Constructors = assign({}, ComponentConstructors, this._E, {
Transition: this._T
});
forOwn$1(Constructors, function(Component, key) {
var component = Component(_this, Components2, _this._o);
Components2[key] = component;
component.setup && component.setup();
});
forOwn$1(Components2, function(component) {
component.mount && component.mount();
});
this.emit(EVENT_MOUNTED);
addClass(this.root, CLASS_INITIALIZED);
state.set(IDLE);
this.emit(EVENT_READY);
return this;
};
_proto.sync = function sync(splide) {
this.splides.push({
splide
});
splide.splides.push({
splide: this,
isParent: true
});
if (this.state.is(IDLE)) {
this._C.Sync.remount();
splide.Components.Sync.remount();
}
return this;
};
_proto.go = function go(control) {
this._C.Controller.go(control);
return this;
};
_proto.on = function on(events, callback) {
this.event.on(events, callback);
return this;
};
_proto.off = function off(events) {
this.event.off(events);
return this;
};
_proto.emit = function emit(event) {
var _this$event;
(_this$event = this.event).emit.apply(_this$event, [event].concat(slice(arguments, 1)));
return this;
};
_proto.add = function add(slides, index) {
this._C.Slides.add(slides, index);
return this;
};
_proto.remove = function remove2(matcher) {
this._C.Slides.remove(matcher);
return this;
};
_proto.is = function is(type) {
return this._o.type === type;
};
_proto.refresh = function refresh() {
this.emit(EVENT_REFRESH);
return this;
};
_proto.destroy = function destroy(completely) {
if (completely === void 0) {
completely = true;
}
var event = this.event, state = this.state;
if (state.is(CREATED)) {
EventInterface(this).on(EVENT_READY, this.destroy.bind(this, completely));
} else {
forOwn$1(this._C, function(component) {
component.destroy && component.destroy(completely);
}, true);
event.emit(EVENT_DESTROY);
event.destroy();
completely && empty(this.splides);
state.set(DESTROYED);
}
return this;
};
_createClass(_Splide2, [{
key: "options",
get: function get() {
return this._o;
},
set: function set(options) {
this._C.Media.set(options, true, true);
}
}, {
key: "length",
get: function get() {
return this._C.Slides.getLength(true);
}
}, {
key: "index",
get: function get() {
return this._C.Controller.getIndex();
}
}]);
return _Splide2;
}();
var Splide$1 = _Splide;
Splide$1.defaults = {};
Splide$1.STATES = STATES;
const EVENTS = [
EVENT_ACTIVE,
EVENT_ARROWS_MOUNTED,
EVENT_ARROWS_UPDATED,
EVENT_AUTOPLAY_PAUSE,
EVENT_AUTOPLAY_PLAY,
EVENT_AUTOPLAY_PLAYING,
EVENT_CLICK,
EVENT_DESTROY,
EVENT_DRAG,
EVENT_DRAGGED,
EVENT_DRAGGING,
EVENT_HIDDEN,
EVENT_INACTIVE,
EVENT_LAZYLOAD_LOADED,
EVENT_MOUNTED,
EVENT_MOVE,
EVENT_MOVED,
EVENT_NAVIGATION_MOUNTED,
EVENT_PAGINATION_MOUNTED,
EVENT_PAGINATION_UPDATED,
EVENT_REFRESH,
EVENT_RESIZE,
EVENT_RESIZED,
EVENT_SCROLL,
EVENT_SCROLLED,
EVENT_UPDATED,
EVENT_VISIBLE
];
const SPLIDE_INJECTION_KEY = "splide";
function isObject(subject) {
return subject !== null && typeof subject === "object";
}
function forOwn(object, iteratee) {
if (object) {
const keys = Object.keys(object);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (key !== "__proto__") {
if (iteratee(object[key], key) === false) {
break;
}
}
}
}
return object;
}
function merge(object, source) {
const merged = object;
forOwn(source, (value, key) => {
if (Array.isArray(value)) {
merged[key] = value.slice();
} else if (isObject(value)) {
merged[key] = merge(isObject(merged[key]) ? merged[key] : {}, value);
} else {
merged[key] = value;
}
});
return merged;
}
const _sfc_main$2 = defineComponent({
name: "SplideTrack",
setup() {
onUpdated(() => {
var _a;
const splide = inject(SPLIDE_INJECTION_KEY);
(_a = splide == null ? void 0 : splide.value) == null ? void 0 : _a.refresh();
});
}
});
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const _hoisted_1$1 = { class: "splide__track" };
const _hoisted_2 = { class: "splide__list" };
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", _hoisted_1$1, [
createElementVNode("ul", _hoisted_2, [
renderSlot(_ctx.$slots, "default")
])
]);
}
const SplideTrack = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
const _sfc_main$1 = defineComponent({
name: "Splide",
emits: EVENTS.map((event) => `splide:${event}`),
components: { SplideTrack },
props: {
tag: {
default: "div",
type: String
},
options: {
default: {},
type: Object
},
extensions: Object,
transition: Function,
hasTrack: {
default: true,
type: Boolean
}
},
setup(props, context) {
const splide = ref();
const root = ref();
onMounted(() => {
if (root.value) {
splide.value = new Splide$1(root.value, props.options);
bind(splide.value);
splide.value.mount(props.extensions, props.transition);
}
});
onBeforeUnmount(() => {
var _a;
(_a = splide.value) == null ? void 0 : _a.destroy();
});
watch(() => merge({}, props.options), (options) => {
if (splide.value) {
splide.value.options = options;
}
}, { deep: true });
provide(SPLIDE_INJECTION_KEY, splide);
const index = computed(() => {
var _a;
return ((_a = splide.value) == null ? void 0 : _a.index) || 0;
});
const length = computed(() => {
var _a;
return ((_a = splide.value) == null ? void 0 : _a.length) || 0;
});
function go(control) {
var _a;
(_a = splide.value) == null ? void 0 : _a.go(control);
}
function sync(target) {
var _a;
(_a = splide.value) == null ? void 0 : _a.sync(target);
}
function bind(splide2) {
EVENTS.forEach((event) => {
splide2.on(event, (...args) => {
context.emit(`splide:${event}`, splide2, ...args);
});
});
}
return {
splide,
root,
index,
length,
go,
sync
};
}
});
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
const _component_SplideTrack = resolveComponent("SplideTrack");
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
class: "splide",
ref: "root"
}, {
default: withCtx(() => [
_ctx.hasTrack ? (openBlock(), createBlock(_component_SplideTrack, { key: 0 }, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
})) : renderSlot(_ctx.$slots, "default", { key: 1 })
]),
_: 3
}, 512);
}
const Splide = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
const _sfc_main = defineComponent({
name: "SplideSlide"
});
const _hoisted_1 = { class: "splide__slide" };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("li", _hoisted_1, [
renderSlot(_ctx.$slots, "default")
]);
}
const SplideSlide = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
const VueSplide = {
install(app) {
app.component(Splide.name, Splide);
app.component(SplideSlide.name, SplideSlide);
}
};
export {
Splide,
SplideSlide,
SplideTrack,
VueSplide as default
};
================================================
FILE: examples/.gitignore
================================================
node_modules
.DS_Store
dist
dist-ssr
*.local
================================================
FILE: examples/README.md
================================================
Examples for [Vue Splide](https://github.com/Splidejs/vue-splide).
================================================
FILE: examples/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="icon" type="image/png" href="./src/assets/favicon.png">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap" rel="stylesheet">
<title>Vue Splide Example</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
================================================
FILE: examples/package.json
================================================
{
"name": "vue-splide-example",
"version": "1.0.0",
"private": true,
"dependencies": {
"@splidejs/splide-extension-video": "^0.7.1",
"@splidejs/vue-splide": "file:..",
"vue": "^3.2.38"
},
"devDependencies": {
"@types/node": "^18.7.14",
"@vitejs/plugin-vue": "^3.0.3",
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vue-tsc": "^0.40.5"
},
"scripts": {
"develop": "vite",
"build": "vite build",
"build:all": "vue-tsc --noEmit && vite build",
"serve": "vite preview"
}
}
================================================
FILE: examples/src/App.vue
================================================
<template>
<BasicExample />
<hr>
<AutoplayExample />
<hr>
<ReactivityExample />
<hr>
<DynamicSlidesExample />
<hr>
<ThumbnailsExample />
<hr>
<VideoExample />
</template>
<script setup lang="ts">
import AutoplayExample from './components/AutoplayExample.vue';
import BasicExample from './components/BasicExample.vue';
import DynamicSlidesExample from './components/DynamicSlideExample.vue';
import ReactivityExample from './components/ReactivityExample.vue';
import ThumbnailsExample from './components/ThumbnailsExample.vue';
import VideoExample from './components/VideoExample.vue';
import '@splidejs/vue-splide/css';
</script>
<style>
body {
font-family: 'Poppins', sans-serif;
padding: 5rem 0;
}
h1 {
text-align: center;
}
hr {
width: 200px;
max-width: 50%;
margin: 4rem auto;
}
button {
font-family: inherit;
}
.wrapper {
max-width: 600px;
margin: 0 auto;
}
.splide__slide {
background: #eee;
}
.splide__slide img {
width: 100%;
height: 100%;
object-fit: cover;
}
.splide--nav {
margin-top: 1rem;
}
</style>
================================================
FILE: examples/src/components/AutoplayExample.vue
================================================
<template>
<div class="wrapper">
<h2 id="autoplay-example-heading">Autoplay</h2>
<Splide
aria-labelledby="autoplay-example-heading"
:options="options"
:has-track="false"
>
<div style="position: relative">
<SplideTrack>
<SplideSlide v-for="slide in slides" :key="slide.alt">
<img :src="slide.src" :alt="slide.alt">
</SplideSlide>
</SplideTrack>
</div>
<div class="splide__progress">
<div class="splide__progress__bar">
</div>
</div>
<button class="splide__toggle">
<span class="splide__toggle__play">Play</span>
<span class="splide__toggle__pause">Pause</span>
</button>
</Splide>
</div>
</template>
<script lang="ts">
import { Splide, SplideSlide, SplideTrack, Options } from '@splidejs/vue-splide';
import { defineComponent } from 'vue';
import { generateSlides } from '../utils';
export default defineComponent( {
name: 'AutoplayExample',
components: {
Splide,
SplideTrack,
SplideSlide,
},
setup() {
const slides = generateSlides();
const options: Options = {
rewind : true,
gap : '1rem',
autoplay: true,
height : '15rem',
};
return {
slides,
options,
}
},
} );
</script>
================================================
FILE: examples/src/components/BasicExample.vue
================================================
<template>
<div class="wrapper">
<h2 id="basic-example-heading">Basic</h2>
<Splide
aria-labelledby="basic-example-heading"
v-if="enabled"
:options="options"
@splide:mounted="onSplideMounted"
@splide:move="onSplideMove"
>
<SplideSlide v-for="slide in slides" :key="slide.alt">
<img :src="slide.src" :alt="slide.alt">
</SplideSlide>
</Splide>
<button @click="enabled = ! enabled">
{{ enabled ? 'Hide Slider' : 'Show Slider' }}
</button>
</div>
</template>
<script lang="ts">
import { Splide as Core } from '@splidejs/splide';
import { Splide, SplideSlide } from '@splidejs/vue-splide'
import { defineComponent, ref } from 'vue';
import { generateSlides } from '../utils';
export default defineComponent( {
name: 'BasicExample',
components: {
Splide,
SplideSlide,
},
setup() {
const slides = generateSlides();
const options = {
rewind : true,
perPage: 2,
gap : '1rem',
height : '15rem',
breakpoints: {
1000: {
perPage: 1,
},
},
};
const enabled = ref<boolean>( true );
const onSplideMounted = ( splide: Core ) => console.log( splide.length );
const onSplideMove = ( splide: Core, index: number ) => console.log( 'move to', index );
return {
slides,
options,
onSplideMounted,
onSplideMove,
enabled,
}
},
} );
</script>
================================================
FILE: examples/src/components/DynamicSlideExample.vue
================================================
<template>
<div class="wrapper">
<h2 id="dynamic-slides-example-heading">Dynamic Slides</h2>
<Splide
class="splide--dynamic"
aria-labelledby="dynamic-slides-example-heading"
:options="options"
:has-track="false"
>
<div style="position: relative">
<SplideTrack>
<SplideSlide v-for="slide in slides" :key="slide.alt">
<img :src="slide.src" :alt="slide.alt">
</SplideSlide>
</SplideTrack>
</div>
<div class="controls">
<button @click="add">Add</button>
<button @click="remove">Remove</button>
</div>
</Splide>
</div>
</template>
<script lang="ts">
import { Options, Splide, SplideSlide, SplideTrack } from '@splidejs/vue-splide';
import { defineComponent, ref } from 'vue';
import { generateSlides } from '../utils';
export default defineComponent( {
name: 'DynamicSlidesExample',
components: {
Splide,
SplideTrack,
SplideSlide,
},
setup() {
const slides = ref<ReturnType<typeof generateSlides>>( generateSlides( 1 ) );
const options: Options = {
rewind : true,
perPage: 3,
gap : '1rem',
height : '15rem',
};
function add(): void {
slides.value.push( ...generateSlides( 1, slides.value.length ) );
}
function remove(): void {
--slides.value.length;
}
return {
slides,
options,
add,
remove,
}
},
} );
</script>
<style>
.splide--dynamic .splide__list {
min-height: 15rem;
}
</style>
================================================
FILE: examples/src/components/ReactivityExample.vue
================================================
<template>
<div class="wrapper">
<h2 id="reactivity-example-heading">Reactivity Example</h2>
<div style="margin-bottom: 1rem">
<label>
<span>gap:</span>
<input type="number" min="0" max="20" v-model="options.gap"/>
px
</label>
<label>
<span>perPage:</span>
<input type="number" min="1" max="5" v-model="options.perPage"/>
</label>
<label>
<span>height:</span>
<input
type="number"
min="5"
max="20"
:value="typeof options.height === 'string' ? parseInt( options.height ) : 5"
@input="onHeightChange"
/>
rem
</label>
</div>
<Splide :options="options" aria-labelledby="reactivity-example-heading">
<SplideSlide v-for="slide in slides" :key="slide.alt">
<img :src="slide.src" :alt="slide.alt">
</SplideSlide>
</Splide>
</div>
</template>
<script lang="ts">
import { Options, Splide, SplideSlide } from '@splidejs/vue-splide';
import { defineComponent, reactive, ref } from 'vue';
import { generateSlides } from '../utils';
export default defineComponent( {
name: 'ReactiveExample',
components: {
Splide,
SplideSlide,
},
setup() {
// Do not change readonly options later, such as `type`, `preloadPages`, etc.
const options = reactive<Options>( {
perPage: 2,
gap : 0,
height : '10rem',
rewind : true,
} );
function onHeightChange( e: Event ): void {
options.height = `${ ( e.target as HTMLInputElement ).value || 5 }rem`;
}
return {
slides: generateSlides(),
options,
onHeightChange,
}
},
} );
</script>
<style scoped>
label span {
margin-right: .5rem;
}
input {
height: 1.5rem;
width: 4rem;
font-family: inherit;
}
label {
margin-right: 1rem;
}
</style>
================================================
FILE: examples/src/components/ThumbnailsExample.vue
================================================
<template>
<div class="wrapper">
<h2 id="thumbnail-example-heading">Thumbnails</h2>
<Splide
aria-labelledby="thumbnail-example-heading"
:options="mainOptions"
ref="main"
>
<SplideSlide v-for="slide in slides" :key="slide.alt">
<img :src="slide.src" :alt="slide.alt">
</SplideSlide>
</Splide>
<Splide
aria-label="The carousel with thumbnails. Selecting a thumbnail will change the main carousel"
:options="thumbsOptions"
ref="thumbs"
>
<SplideSlide v-for="slide in slides" :key="slide.alt">
<img :src="slide.src" :alt="slide.alt">
</SplideSlide>
</Splide>
</div>
</template>
<script lang="ts">
import { Splide, SplideSlide, Options } from '@splidejs/vue-splide';
import { defineComponent, onMounted, ref } from 'vue';
import { generateSlides } from '../utils';
export default defineComponent( {
name: 'ThumbnailsExample',
components: {
Splide,
SplideSlide,
},
setup() {
const main = ref<InstanceType<typeof Splide>>();
const thumbs = ref<InstanceType<typeof Splide>>();
const slides = generateSlides();
const mainOptions: Options = {
type : 'loop',
perPage : 2,
perMove : 1,
gap : '1rem',
pagination: false,
};
const thumbsOptions: Options = {
type : 'slide',
rewind : true,
gap : '1rem',
pagination : false,
fixedWidth : 110,
fixedHeight : 70,
cover : true,
focus : 'center',
isNavigation: true,
updateOnMove: true,
};
onMounted( () => {
const thumbsSplide = thumbs.value?.splide;
if ( thumbsSplide ) {
main.value?.sync( thumbsSplide );
}
} );
return {
slides,
main,
thumbs,
mainOptions,
thumbsOptions,
}
},
} );
</script>
================================================
FILE: examples/src/components/VideoExample.vue
================================================
<template>
<div class="wrapper">
<h2 id="video-example-heading">Video</h2>
<Splide
aria-labelledby="video-example-heading"
:options="options"
:extensions="extensions"
>
<SplideSlide v-for="( id, index ) in videos" :key="id" :data-splide-youtube="id">
<img
:src="`https://i3.ytimg.com/vi/${ id }/maxresdefault.jpg`"
:alt="`YouTube Sample ${ index + 1 }`"
>
</SplideSlide>
</Splide>
</div>
</template>
<script lang="ts">
import { Splide, SplideSlide } from '@splidejs/vue-splide';
import { Video } from '@splidejs/splide-extension-video';
import { defineComponent } from 'vue';
import '@splidejs/splide-extension-video/dist/css/splide-extension-video.min.css';
export default defineComponent( {
name: 'VideoExample',
components: {
Splide,
SplideSlide,
},
setup() {
const videos = [ '3GNQL3alB-Y', 'xLJ2QQDrN9k', 'cdz__ojQOuU', 'oS6N_ZBFDZE' ];
const options = {
rewind : true,
heightRatio: 0.5625,
};
return {
videos,
options,
extensions: { Video },
}
},
} );
</script>
================================================
FILE: examples/src/env.d.ts
================================================
/// <reference types="vite/client" />
declare module '*.vue' {
import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
================================================
FILE: examples/src/main.ts
================================================
import { createApp } from 'vue';
import App from './App.vue';
// import VueSplide from '@splidejs/vue-splide';
const app = createApp( App );
// For global install
// app.use( VueSplide );
app.mount( '#app' );
================================================
FILE: examples/src/utils/generateSlides/generateSlides.ts
================================================
/**
* Return an array with objects containing data of sample images.
*
* @param length - Optional. A number of slides.
* @param sig - Optional. The signature for getting a different image.
*
* @return An array with objects for sample images.
*/
export function generateSlides( length = 10, sig = 0 ): Array<{ src: string, alt: string }> {
return Array.from( { length } ).map( ( value, index ) => {
index = sig || index;
return {
src: `https://source.unsplash.com/random/800x450?sig=${ index }`,
alt: `Image ${ index }`,
};
} );
}
================================================
FILE: examples/src/utils/index.ts
================================================
export { generateSlides } from './generateSlides/generateSlides';
================================================
FILE: examples/tsconfig.json
================================================
{
"compilerOptions": {
"target": "esnext",
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"skipLibCheck": true,
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"allowJs": true,
"lib": [
"esnext",
"dom"
]
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue"
]
}
================================================
FILE: examples/vite.config.ts
================================================
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
export default defineConfig( {
base: './',
plugins: [ vue() ],
resolve: {
alias: [
{ find: 'vue', replacement: path.resolve( './node_modules/vue' ) },
],
}
} );
================================================
FILE: jest.config.js
================================================
module.exports = {
rootDir: './src',
transform: {
'^.+\\.[tj]s$': 'ts-jest',
},
testEnvironment: 'jsdom',
};
================================================
FILE: package.json
================================================
{
"name": "@splidejs/vue-splide",
"version": "0.6.12",
"description": "The Splide component for Vue.",
"author": "Naotoshi Fujita",
"license": "MIT",
"main": "dist/js/vue-splide.cjs.js",
"module": "dist/js/vue-splide.esm.js",
"types": "src/js/index.ts",
"keywords": [
"splide",
"slider",
"carousel",
"slideshow",
"lightweight",
"touch",
"responsive",
"vue"
],
"repository": {
"type": "git",
"url": "https://github.com/Splidejs/vue-splide.git"
},
"bugs": {
"url": "https://github.com/Splidejs/vue-splide/issues"
},
"devDependencies": {
"@types/jest": "^29.0.0",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"@vitejs/plugin-vue": "^3.1.0",
"eslint": "^8.23.0",
"eslint-plugin-vue": "^9.4.0",
"fs-extra": "^10.1.0",
"gh-pages": "^4.0.0",
"jest": "^29.0.2",
"ts-jest": "next",
"typescript": "^4.8.2",
"vite": "^3.1.0",
"vue": "^3.2.38",
"vue-tsc": "^0.40.9"
},
"scripts": {
"develop": "vite build",
"check:type": "vue-tsc --noEmit",
"build": "vite build --watch false",
"build:all": "npm run check:type && npm run build && node scripts/copy-css.js",
"test": "jest",
"eslint": "eslint src",
"deploy": "gh-pages -d examples/dist"
},
"exports": {
".": {
"require": "./dist/js/vue-splide.cjs.js",
"import": "./dist/js/vue-splide.esm.js",
"default": "./dist/js/vue-splide.esm.js"
},
"./css": "./dist/css/splide.min.css",
"./css/core": "./dist/css/splide-core.min.css",
"./css/*": "./dist/css/themes/splide-*.min.css"
},
"dependencies": {
"@splidejs/splide": "^4.1.3"
}
}
================================================
FILE: scripts/copy-css.js
================================================
const fs = require( 'fs-extra' );
async function copy() {
await fs.copy( './node_modules/@splidejs/splide/dist/css', './dist/css', { overwrite: true } );
}
copy().catch( console.error )
================================================
FILE: src/js/build/iife.ts
================================================
export { VueSplide as default } from '../plugin/plugin';
================================================
FILE: src/js/components/Splide/Splide.vue
================================================
<template>
<component :is="tag" class="splide" ref="root">
<SplideTrack v-if="hasTrack">
<slot></slot>
</SplideTrack>
<slot v-else></slot>
</component>
</template>
<script lang="ts">
import { ComponentConstructor, Options, Splide } from '@splidejs/splide';
import { computed, defineComponent, onBeforeUnmount, onMounted, PropType, provide, Ref, ref, watch } from 'vue';
import { EVENTS } from '../../constants/events';
import { SPLIDE_INJECTION_KEY } from '../../constants/keys';
import { merge } from '../../utils';
import SplideTrack from '../SplideTrack/SplideTrack.vue';
/**
* The component for the Splide root element.
*
* @since 0.4.0
*/
export default defineComponent( {
name: 'Splide',
emits: EVENTS.map( event => `splide:${ event }` ),
components: { SplideTrack },
props: {
/**
* Changes the tag name.
*/
tag: {
default: 'div',
type : String,
},
/**
* Options for Splide instance.
*/
options: {
default: {},
type : Object as PropType<Options>,
},
/**
* Registers extension components.
*/
extensions: Object as PropType<Record<string, ComponentConstructor>>,
/**
* Registers a transition component.
*/
transition: Function as PropType<ComponentConstructor>,
/**
* Determines whether to render a track element or not.
*/
hasTrack: {
default: true,
type : Boolean,
},
},
setup( props, context ) {
const splide = ref<Splide>();
const root = ref<HTMLElement>();
onMounted( () => {
if ( root.value ) {
splide.value = new Splide( root.value, props.options );
bind( splide.value );
splide.value.mount( props.extensions, props.transition );
}
} );
onBeforeUnmount( () => {
splide.value?.destroy();
} );
watch( () => merge( {}, props.options ), options => {
if ( splide.value ) {
splide.value.options = options;
}
}, { deep: true } );
provide<Ref<Splide | undefined>>( SPLIDE_INJECTION_KEY, splide );
/**
* Returns the current index.
*/
const index = computed( () => splide.value?.index || 0 );
/**
* Returns the latest number of slides.
*/
const length = computed( () => splide.value?.length || 0 );
/**
* Goes to the slide specified by the control.
*
* @see `Splide#go()`
*
* @param control - A control pattern.
*/
function go( control: number | string ): void {
splide.value?.go( control );
}
/**
* Registers another splide instance to sync.
*
* @param target - A target to sync.
*/
function sync( target: Splide ): void {
splide.value?.sync( target );
}
/**
* Listens to splide events and propagates them as Vue events.
*
* @private
*
* @param splide - A splide instance.
*/
function bind( splide: Splide ): void {
EVENTS.forEach( event => {
splide.on( event, ( ...args: any[] ) => {
context.emit( `splide:${ event }`, splide, ...args );
} );
} );
}
return {
splide,
root,
index,
length,
go,
sync,
}
},
} );
</script>
================================================
FILE: src/js/components/SplideSlide/SplideSlide.vue
================================================
<template>
<li class="splide__slide">
<slot></slot>
</li>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
/**
* The component for each slide.
*
* @since 0.4.0
*/
export default defineComponent( {
name: 'SplideSlide',
} );
</script>
================================================
FILE: src/js/components/SplideTrack/SplideTrack.vue
================================================
<template>
<div class="splide__track">
<ul class="splide__list">
<slot></slot>
</ul>
</div>
</template>
<script lang="ts">
import { defineComponent, onUpdated, inject, Ref } from 'vue';
import { SPLIDE_INJECTION_KEY } from '../../constants/keys';
import { Splide } from '@splidejs/splide';
/**
* The component for the Splide track element.
*
* @since 0.6.0
*/
export default defineComponent( {
name: 'SplideTrack',
setup() {
onUpdated( () => {
const splide = inject<Ref<Splide | undefined>>( SPLIDE_INJECTION_KEY );
splide?.value?.refresh();
} );
}
} );
</script>
================================================
FILE: src/js/components/index.ts
================================================
export { default as Splide } from './Splide/Splide.vue';
export { default as SplideTrack } from './SplideTrack/SplideTrack.vue';
export { default as SplideSlide } from './SplideSlide/SplideSlide.vue';
================================================
FILE: src/js/constants/events.ts
================================================
import {
EVENT_ACTIVE,
EVENT_ARROWS_MOUNTED,
EVENT_ARROWS_UPDATED,
EVENT_AUTOPLAY_PAUSE,
EVENT_AUTOPLAY_PLAY,
EVENT_AUTOPLAY_PLAYING,
EVENT_CLICK,
EVENT_DESTROY,
EVENT_DRAG,
EVENT_DRAGGED,
EVENT_DRAGGING,
EVENT_HIDDEN,
EVENT_INACTIVE,
EVENT_LAZYLOAD_LOADED,
EVENT_MOUNTED,
EVENT_MOVE,
EVENT_MOVED,
EVENT_NAVIGATION_MOUNTED,
EVENT_PAGINATION_MOUNTED,
EVENT_PAGINATION_UPDATED,
EVENT_REFRESH,
EVENT_RESIZE,
EVENT_RESIZED,
EVENT_SCROLL,
EVENT_SCROLLED,
EVENT_UPDATED,
EVENT_VISIBLE,
EventMap,
} from '@splidejs/splide';
export const EVENTS: Array<keyof EventMap> = [
EVENT_ACTIVE,
EVENT_ARROWS_MOUNTED,
EVENT_ARROWS_UPDATED,
EVENT_AUTOPLAY_PAUSE,
EVENT_AUTOPLAY_PLAY,
EVENT_AUTOPLAY_PLAYING,
EVENT_CLICK,
EVENT_DESTROY,
EVENT_DRAG,
EVENT_DRAGGED,
EVENT_DRAGGING,
EVENT_HIDDEN,
EVENT_INACTIVE,
EVENT_LAZYLOAD_LOADED,
EVENT_MOUNTED,
EVENT_MOVE,
EVENT_MOVED,
EVENT_NAVIGATION_MOUNTED,
EVENT_PAGINATION_MOUNTED,
EVENT_PAGINATION_UPDATED,
EVENT_REFRESH,
EVENT_RESIZE,
EVENT_RESIZED,
EVENT_SCROLL,
EVENT_SCROLLED,
EVENT_UPDATED,
EVENT_VISIBLE,
];
================================================
FILE: src/js/constants/keys.ts
================================================
/**
* The injection key for a splide instance.
*
* @since 0.6.0
*/
export const SPLIDE_INJECTION_KEY = 'splide';
================================================
FILE: src/js/env.d.ts
================================================
/// <reference types="vite/client" />
declare module '*.vue' {
import { D
gitextract_hmr2hzg6/ ├── .babelrc ├── .editorconfig ├── .eslintrc ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── BUG_REPORT.yml │ │ └── config.yml │ └── pull_request_template.md ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── dist/ │ └── js/ │ ├── vue-splide.cjs.js │ └── vue-splide.esm.js ├── examples/ │ ├── .gitignore │ ├── README.md │ ├── index.html │ ├── package.json │ ├── src/ │ │ ├── App.vue │ │ ├── components/ │ │ │ ├── AutoplayExample.vue │ │ │ ├── BasicExample.vue │ │ │ ├── DynamicSlideExample.vue │ │ │ ├── ReactivityExample.vue │ │ │ ├── ThumbnailsExample.vue │ │ │ └── VideoExample.vue │ │ ├── env.d.ts │ │ ├── main.ts │ │ └── utils/ │ │ ├── generateSlides/ │ │ │ └── generateSlides.ts │ │ └── index.ts │ ├── tsconfig.json │ └── vite.config.ts ├── jest.config.js ├── package.json ├── scripts/ │ └── copy-css.js ├── src/ │ └── js/ │ ├── build/ │ │ └── iife.ts │ ├── components/ │ │ ├── Splide/ │ │ │ └── Splide.vue │ │ ├── SplideSlide/ │ │ │ └── SplideSlide.vue │ │ ├── SplideTrack/ │ │ │ └── SplideTrack.vue │ │ └── index.ts │ ├── constants/ │ │ ├── events.ts │ │ └── keys.ts │ ├── env.d.ts │ ├── index.ts │ ├── plugin/ │ │ └── plugin.ts │ └── utils/ │ ├── forOwn/ │ │ ├── forOwn.ts │ │ └── test/ │ │ └── forOwn.test.ts │ ├── index.ts │ ├── isEqualShallow/ │ │ ├── isEqualShallow.ts │ │ └── test/ │ │ └── isEqualShallow.test.ts │ ├── isObject/ │ │ ├── isObject.ts │ │ └── test/ │ │ └── isObject.test.ts │ └── merge/ │ ├── merge.test.ts │ └── merge.ts ├── tsconfig.json ├── vite/ │ └── vite.config.iife.ts └── vite.config.ts
SYMBOL INDEX (193 symbols across 11 files)
FILE: dist/js/vue-splide.cjs.js
function _defineProperties (line 4) | function _defineProperties(target, props) {
function _createClass (line 14) | function _createClass(Constructor, protoProps, staticProps) {
function empty (line 45) | function empty(array) {
function slice (line 48) | function slice(arrayLike, start, end) {
function apply (line 51) | function apply(func) {
function raf (line 57) | function raf(func) {
function typeOf (line 60) | function typeOf(type, subject) {
function isObject$1 (line 63) | function isObject$1(subject) {
function isNull (line 70) | function isNull(subject) {
function isHTMLElement (line 73) | function isHTMLElement(subject) {
function toArray (line 80) | function toArray(value) {
function forEach (line 83) | function forEach(values, iteratee) {
function includes (line 86) | function includes(array, value) {
function push (line 89) | function push(array, items) {
function toggleClass (line 93) | function toggleClass(elm, classes, add) {
function addClass (line 102) | function addClass(elm, classes) {
function append (line 105) | function append(parent, children2) {
function before (line 108) | function before(nodes, ref) {
function matches (line 116) | function matches(elm, selector) {
function children (line 119) | function children(parent, selector) {
function child (line 125) | function child(parent, selector) {
function forOwn$1 (line 129) | function forOwn$1(object, iteratee, right) {
function assign (line 137) | function assign(object) {
function merge$1 (line 145) | function merge$1(object) {
function omit (line 159) | function omit(object, keys) {
function removeAttribute (line 164) | function removeAttribute(elms, attrs) {
function setAttribute (line 171) | function setAttribute(elms, attrs, value) {
function create (line 182) | function create(tag, attrs, parent) {
function style (line 190) | function style(elm, prop, value) {
function display (line 198) | function display(elm, display2) {
function focus (line 201) | function focus(elm) {
function getAttribute (line 206) | function getAttribute(elm, attr) {
function hasClass (line 209) | function hasClass(elm, className) {
function rect (line 212) | function rect(target) {
function remove (line 215) | function remove(nodes) {
function parseHtml (line 222) | function parseHtml(html) {
function prevent (line 225) | function prevent(e, stopPropagation) {
function query (line 232) | function query(parent, selector) {
function queryAll (line 235) | function queryAll(parent, selector) {
function removeClass (line 238) | function removeClass(elm, classes) {
function timeOf (line 241) | function timeOf(e) {
function unit (line 244) | function unit(value) {
function assert (line 249) | function assert(condition, message) {
function approximatelyEqual (line 255) | function approximatelyEqual(x, y, epsilon) {
function between (line 258) | function between(number, x, y, exclusive) {
function clamp (line 263) | function clamp(number, x, y) {
function sign (line 268) | function sign(x) {
function format (line 271) | function format(string, replacements) {
function pad (line 277) | function pad(number) {
function uniqueId (line 281) | function uniqueId(prefix) {
function EventBinder (line 284) | function EventBinder() {
function EventInterface (line 375) | function EventInterface(Splide2) {
function RequestInterval (line 396) | function RequestInterval(interval, onInterval, onUpdate, limit) {
function State (line 454) | function State(initialState) {
function Throttle (line 467) | function Throttle(func, duration) {
function Media (line 473) | function Media(Splide2, Components2, options) {
function Direction (line 552) | function Direction(Splide2, Components2, options) {
function closest (line 624) | function closest(from, selector) {
function Elements (line 642) | function Elements(Splide2, Components2, options) {
function Slide$1 (line 739) | function Slide$1(Splide2, index, slideIndex, slide) {
function Slides (line 865) | function Slides(Splide2, Components2, options) {
function Layout (line 985) | function Layout(Splide2, Components2, options) {
function Clones (line 1090) | function Clones(Splide2, Components2, options) {
function Move (line 1160) | function Move(Splide2, Components2, options) {
function Controller (line 1284) | function Controller(Splide2, Components2, options) {
function Arrows (line 1461) | function Arrows(Splide2, Components2, options) {
function Autoplay (line 1553) | function Autoplay(Splide2, Components2, options) {
function Cover (line 1638) | function Cover(Splide2, Components2, options) {
function Scroll (line 1668) | function Scroll(Splide2, Components2, options) {
function Drag (line 1741) | function Drag(Splide2, Components2, options) {
function normalizeKey (line 1915) | function normalizeKey(key) {
function Keyboard (line 1920) | function Keyboard(Splide2, Components2, options) {
function LazyLoad (line 1971) | function LazyLoad(Splide2, Components2, options) {
function Pagination (line 2044) | function Pagination(Splide2, Components2, options) {
function Sync (line 2172) | function Sync(Splide2, Components2, options) {
function Wheel (line 2233) | function Wheel(Splide2, Components2, options) {
function Live (line 2263) | function Live(Splide2, Components2, options) {
function Fade (line 2367) | function Fade(Splide2, Components2, options) {
function Slide (line 2387) | function Slide(Splide2, Components2, options) {
function _Splide2 (line 2439) | function _Splide2(target, options) {
constant EVENTS (line 2574) | const EVENTS = [
constant SPLIDE_INJECTION_KEY (line 2603) | const SPLIDE_INJECTION_KEY = "splide";
function isObject (line 2604) | function isObject(subject) {
function forOwn (line 2607) | function forOwn(object, iteratee) {
function merge (line 2621) | function merge(object, source) {
method setup (line 2636) | setup() {
function _sfc_render$2 (line 2653) | function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
method setup (line 2681) | setup(props, context) {
function _sfc_render$1 (line 2734) | function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
function _sfc_render (line 2756) | function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
method install (line 2763) | install(app) {
FILE: dist/js/vue-splide.esm.js
function _defineProperties (line 2) | function _defineProperties(target, props) {
function _createClass (line 12) | function _createClass(Constructor, protoProps, staticProps) {
function empty (line 43) | function empty(array) {
function slice (line 46) | function slice(arrayLike, start, end) {
function apply (line 49) | function apply(func) {
function raf (line 55) | function raf(func) {
function typeOf (line 58) | function typeOf(type, subject) {
function isObject$1 (line 61) | function isObject$1(subject) {
function isNull (line 68) | function isNull(subject) {
function isHTMLElement (line 71) | function isHTMLElement(subject) {
function toArray (line 78) | function toArray(value) {
function forEach (line 81) | function forEach(values, iteratee) {
function includes (line 84) | function includes(array, value) {
function push (line 87) | function push(array, items) {
function toggleClass (line 91) | function toggleClass(elm, classes, add) {
function addClass (line 100) | function addClass(elm, classes) {
function append (line 103) | function append(parent, children2) {
function before (line 106) | function before(nodes, ref2) {
function matches (line 114) | function matches(elm, selector) {
function children (line 117) | function children(parent, selector) {
function child (line 123) | function child(parent, selector) {
function forOwn$1 (line 127) | function forOwn$1(object, iteratee, right) {
function assign (line 135) | function assign(object) {
function merge$1 (line 143) | function merge$1(object) {
function omit (line 157) | function omit(object, keys) {
function removeAttribute (line 162) | function removeAttribute(elms, attrs) {
function setAttribute (line 169) | function setAttribute(elms, attrs, value) {
function create (line 180) | function create(tag, attrs, parent) {
function style (line 188) | function style(elm, prop, value) {
function display (line 196) | function display(elm, display2) {
function focus (line 199) | function focus(elm) {
function getAttribute (line 204) | function getAttribute(elm, attr) {
function hasClass (line 207) | function hasClass(elm, className) {
function rect (line 210) | function rect(target) {
function remove (line 213) | function remove(nodes) {
function parseHtml (line 220) | function parseHtml(html) {
function prevent (line 223) | function prevent(e, stopPropagation) {
function query (line 230) | function query(parent, selector) {
function queryAll (line 233) | function queryAll(parent, selector) {
function removeClass (line 236) | function removeClass(elm, classes) {
function timeOf (line 239) | function timeOf(e) {
function unit (line 242) | function unit(value) {
function assert (line 247) | function assert(condition, message) {
function approximatelyEqual (line 253) | function approximatelyEqual(x, y, epsilon) {
function between (line 256) | function between(number, x, y, exclusive) {
function clamp (line 261) | function clamp(number, x, y) {
function sign (line 266) | function sign(x) {
function format (line 269) | function format(string, replacements) {
function pad (line 275) | function pad(number) {
function uniqueId (line 279) | function uniqueId(prefix) {
function EventBinder (line 282) | function EventBinder() {
function EventInterface (line 373) | function EventInterface(Splide2) {
function RequestInterval (line 394) | function RequestInterval(interval, onInterval, onUpdate, limit) {
function State (line 452) | function State(initialState) {
function Throttle (line 465) | function Throttle(func, duration) {
function Media (line 471) | function Media(Splide2, Components2, options) {
function Direction (line 550) | function Direction(Splide2, Components2, options) {
function closest (line 622) | function closest(from, selector) {
function Elements (line 640) | function Elements(Splide2, Components2, options) {
function Slide$1 (line 737) | function Slide$1(Splide2, index, slideIndex, slide) {
function Slides (line 863) | function Slides(Splide2, Components2, options) {
function Layout (line 983) | function Layout(Splide2, Components2, options) {
function Clones (line 1088) | function Clones(Splide2, Components2, options) {
function Move (line 1158) | function Move(Splide2, Components2, options) {
function Controller (line 1282) | function Controller(Splide2, Components2, options) {
function Arrows (line 1459) | function Arrows(Splide2, Components2, options) {
function Autoplay (line 1551) | function Autoplay(Splide2, Components2, options) {
function Cover (line 1636) | function Cover(Splide2, Components2, options) {
function Scroll (line 1666) | function Scroll(Splide2, Components2, options) {
function Drag (line 1739) | function Drag(Splide2, Components2, options) {
function normalizeKey (line 1913) | function normalizeKey(key) {
function Keyboard (line 1918) | function Keyboard(Splide2, Components2, options) {
function LazyLoad (line 1969) | function LazyLoad(Splide2, Components2, options) {
function Pagination (line 2042) | function Pagination(Splide2, Components2, options) {
function Sync (line 2170) | function Sync(Splide2, Components2, options) {
function Wheel (line 2231) | function Wheel(Splide2, Components2, options) {
function Live (line 2261) | function Live(Splide2, Components2, options) {
function Fade (line 2365) | function Fade(Splide2, Components2, options) {
function Slide (line 2385) | function Slide(Splide2, Components2, options) {
function _Splide2 (line 2437) | function _Splide2(target, options) {
constant EVENTS (line 2572) | const EVENTS = [
constant SPLIDE_INJECTION_KEY (line 2601) | const SPLIDE_INJECTION_KEY = "splide";
function isObject (line 2602) | function isObject(subject) {
function forOwn (line 2605) | function forOwn(object, iteratee) {
function merge (line 2619) | function merge(object, source) {
method setup (line 2634) | setup() {
function _sfc_render$2 (line 2651) | function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
method setup (line 2679) | setup(props, context) {
function _sfc_render$1 (line 2732) | function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
function _sfc_render (line 2754) | function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
method install (line 2761) | install(app) {
FILE: examples/src/utils/generateSlides/generateSlides.ts
function generateSlides (line 9) | function generateSlides( length = 10, sig = 0 ): Array<{ src: string, al...
FILE: scripts/copy-css.js
function copy (line 3) | async function copy() {
FILE: src/js/constants/events.ts
constant EVENTS (line 33) | const EVENTS: Array<keyof EventMap> = [
FILE: src/js/constants/keys.ts
constant SPLIDE_INJECTION_KEY (line 6) | const SPLIDE_INJECTION_KEY = 'splide';
FILE: src/js/plugin/plugin.ts
method install (line 6) | install( app: App ): void {
FILE: src/js/utils/forOwn/forOwn.ts
function forOwn (line 9) | function forOwn<T extends object>(
FILE: src/js/utils/isEqualShallow/isEqualShallow.ts
function isEqualShallow (line 9) | function isEqualShallow( array1: unknown[], array2: unknown[] ): boolean {
FILE: src/js/utils/isObject/isObject.ts
function isObject (line 8) | function isObject( subject: unknown ): subject is object {
FILE: src/js/utils/merge/merge.ts
type Merge (line 13) | type Merge<T extends object, U extends object> = Omit<T, keyof U> & {
type Cast (line 23) | type Cast<T, U> = T extends U ? T : U;
function merge (line 34) | function merge<T extends object, U extends object>( object: T, source: U...
Condensed preview — 55 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (214K chars).
[
{
"path": ".babelrc",
"chars": 46,
"preview": "{\n \"presets\": [\n \"@babel/preset-env\"\n ]\n}"
},
{
"path": ".editorconfig",
"chars": 147,
"preview": "root = true\n\n[*]\nindent_style = space\nindent_size = 2\ncharset = utf-8\nend_of_line = lf\ntrim_trailing_whitespace = true\ni"
},
{
"path": ".eslintrc",
"chars": 2072,
"preview": "{\n \"extends\": [\n \"eslint:recommended\",\n \"plugin:@typescript-eslint/recommended\",\n \"plugin:vue/vue3-recommended"
},
{
"path": ".github/FUNDING.yml",
"chars": 22,
"preview": "github: NaotoshiFujita"
},
{
"path": ".github/ISSUE_TEMPLATE/BUG_REPORT.yml",
"chars": 1870,
"preview": "name: Bug Report\ndescription: Create a bug report.\nlabels: [ \"bug\" ]\nbody:\n - type: markdown\n attributes:\n valu"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 28,
"preview": "blank_issues_enabled: false\n"
},
{
"path": ".github/pull_request_template.md",
"chars": 173,
"preview": "<!--\n Please make sure to add a new issue before you send PR!\n-->\n\n## Related Issues\n\n<!--\n Link to the issue\n-->\n\n## "
},
{
"path": ".gitignore",
"chars": 28,
"preview": "node_modules/\n.idea/\nlocal/\n"
},
{
"path": ".npmignore",
"chars": 69,
"preview": "node_modules/\nimages/\nexamples/\nlocal/\n.idea/\n.github/\n.editorconfig\n"
},
{
"path": "LICENSE",
"chars": 1081,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2020 Naotoshi Fujita\n\nPermission is hereby granted, free of charge, to any person o"
},
{
"path": "README.md",
"chars": 1710,
"preview": "<div align=\"center\">\n <a href=\"https://splidejs.com\" target=\"_blank\">\n <img width=\"70\" src=\"images/logo.svg\">\n </"
},
{
"path": "dist/js/vue-splide.cjs.js",
"chars": 83103,
"preview": "\"use strict\";\nObject.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: \"Module\" } "
},
{
"path": "dist/js/vue-splide.esm.js",
"chars": 83033,
"preview": "import { defineComponent, onUpdated, inject, openBlock, createElementBlock, createElementVNode, renderSlot, ref, onMount"
},
{
"path": "examples/.gitignore",
"chars": 45,
"preview": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
},
{
"path": "examples/README.md",
"chars": 67,
"preview": "Examples for [Vue Splide](https://github.com/Splidejs/vue-splide).\n"
},
{
"path": "examples/index.html",
"chars": 621,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/package.json",
"chars": 530,
"preview": "{\n \"name\": \"vue-splide-example\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"dependencies\": {\n \"@splidejs/splide-ext"
},
{
"path": "examples/src/App.vue",
"chars": 1072,
"preview": "<template>\n <BasicExample />\n <hr>\n <AutoplayExample />\n <hr>\n <ReactivityExample />\n <hr>\n <DynamicSlidesExample"
},
{
"path": "examples/src/components/AutoplayExample.vue",
"chars": 1320,
"preview": "<template>\n <div class=\"wrapper\">\n <h2 id=\"autoplay-example-heading\">Autoplay</h2>\n\n <Splide\n aria-labelledb"
},
{
"path": "examples/src/components/BasicExample.vue",
"chars": 1465,
"preview": "<template>\n <div class=\"wrapper\">\n <h2 id=\"basic-example-heading\">Basic</h2>\n\n <Splide\n aria-labelledby=\"bas"
},
{
"path": "examples/src/components/DynamicSlideExample.vue",
"chars": 1545,
"preview": "<template>\n <div class=\"wrapper\">\n <h2 id=\"dynamic-slides-example-heading\">Dynamic Slides</h2>\n\n <Splide\n cl"
},
{
"path": "examples/src/components/ReactivityExample.vue",
"chars": 1873,
"preview": "<template>\n <div class=\"wrapper\">\n <h2 id=\"reactivity-example-heading\">Reactivity Example</h2>\n\n <div style=\"marg"
},
{
"path": "examples/src/components/ThumbnailsExample.vue",
"chars": 1902,
"preview": "<template>\n <div class=\"wrapper\">\n <h2 id=\"thumbnail-example-heading\">Thumbnails</h2>\n\n <Splide\n aria-labell"
},
{
"path": "examples/src/components/VideoExample.vue",
"chars": 1134,
"preview": "<template>\n <div class=\"wrapper\">\n <h2 id=\"video-example-heading\">Video</h2>\n\n <Splide\n aria-labelledby=\"vid"
},
{
"path": "examples/src/env.d.ts",
"chars": 276,
"preview": "/// <reference types=\"vite/client\" />\n\ndeclare module '*.vue' {\n import { DefineComponent } from 'vue'\n // eslint-disa"
},
{
"path": "examples/src/main.ts",
"chars": 211,
"preview": "import { createApp } from 'vue';\nimport App from './App.vue';\n// import VueSplide from '@splidejs/vue-splide';\n\n\nconst a"
},
{
"path": "examples/src/utils/generateSlides/generateSlides.ts",
"chars": 569,
"preview": "/**\n * Return an array with objects containing data of sample images.\n *\n * @param length - Optional. A number of slides"
},
{
"path": "examples/src/utils/index.ts",
"chars": 66,
"preview": "export { generateSlides } from './generateSlides/generateSlides';\n"
},
{
"path": "examples/tsconfig.json",
"chars": 427,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"target\": \"esnext\",\n\t\t\"useDefineForClassFields\": true,\n\t\t\"module\": \"esnext\",\n\t\t\"moduleResoluti"
},
{
"path": "examples/vite.config.ts",
"chars": 284,
"preview": "import { defineConfig } from 'vite';\nimport vue from '@vitejs/plugin-vue';\nimport path from 'path';\n\n\nexport default def"
},
{
"path": "jest.config.js",
"chars": 121,
"preview": "module.exports = {\n rootDir: './src',\n transform: {\n '^.+\\\\.[tj]s$': 'ts-jest',\n },\n testEnvironment: 'jsdom',\n};"
},
{
"path": "package.json",
"chars": 1718,
"preview": "{\n \"name\": \"@splidejs/vue-splide\",\n \"version\": \"0.6.12\",\n \"description\": \"The Splide component for Vue.\",\n \"author\":"
},
{
"path": "scripts/copy-css.js",
"chars": 190,
"preview": "const fs = require( 'fs-extra' );\n\nasync function copy() {\n await fs.copy( './node_modules/@splidejs/splide/dist/css', "
},
{
"path": "src/js/build/iife.ts",
"chars": 57,
"preview": "export { VueSplide as default } from '../plugin/plugin';\n"
},
{
"path": "src/js/components/Splide/Splide.vue",
"chars": 3271,
"preview": "<template>\n <component :is=\"tag\" class=\"splide\" ref=\"root\">\n <SplideTrack v-if=\"hasTrack\">\n <slot></slot>\n <"
},
{
"path": "src/js/components/SplideSlide/SplideSlide.vue",
"chars": 271,
"preview": "<template>\n <li class=\"splide__slide\">\n <slot></slot>\n </li>\n</template>\n\n<script lang=\"ts\">\nimport { defineCompone"
},
{
"path": "src/js/components/SplideTrack/SplideTrack.vue",
"chars": 615,
"preview": "<template>\n <div class=\"splide__track\">\n <ul class=\"splide__list\">\n <slot></slot>\n </ul>\n </div>\n</template"
},
{
"path": "src/js/components/index.ts",
"chars": 201,
"preview": "export { default as Splide } from './Splide/Splide.vue';\nexport { default as SplideTrack } from './SplideTrack/SplideTra"
},
{
"path": "src/js/constants/events.ts",
"chars": 1150,
"preview": "import {\n EVENT_ACTIVE,\n EVENT_ARROWS_MOUNTED,\n EVENT_ARROWS_UPDATED,\n EVENT_AUTOPLAY_PAUSE,\n EVENT_AUTOPLAY_PLAY,\n"
},
{
"path": "src/js/constants/keys.ts",
"chars": 117,
"preview": "/**\n * The injection key for a splide instance.\n *\n * @since 0.6.0\n */\nexport const SPLIDE_INJECTION_KEY = 'splide';\n"
},
{
"path": "src/js/env.d.ts",
"chars": 279,
"preview": "/// <reference types=\"vite/client\" />\n\ndeclare module '*.vue' {\n import { DefineComponent } from 'vue';\n // eslint-dis"
},
{
"path": "src/js/index.ts",
"chars": 135,
"preview": "export * from './components';\nexport { VueSplide as default } from './plugin/plugin';\nexport type { Options } from '@spl"
},
{
"path": "src/js/plugin/plugin.ts",
"chars": 241,
"preview": "import { App } from 'vue';\nimport { Splide, SplideSlide } from '../components';\n\n\nexport const VueSplide = {\n install( "
},
{
"path": "src/js/utils/forOwn/forOwn.ts",
"chars": 721,
"preview": "/**\n * Iterates over the provided object by own enumerable keys with calling the iteratee function.\n *\n * @param object "
},
{
"path": "src/js/utils/forOwn/test/forOwn.test.ts",
"chars": 0,
"preview": ""
},
{
"path": "src/js/utils/index.ts",
"chars": 218,
"preview": "export { isEqualShallow } from './isEqualShallow/isEqualShallow';\nexport { isObject } from './isObject/isObject';\n"
},
{
"path": "src/js/utils/isEqualShallow/isEqualShallow.ts",
"chars": 418,
"preview": "/**\n * Checks if provided two arrays are shallowly equal or not.\n *\n * @param array1 - An array to test.\n * @param array"
},
{
"path": "src/js/utils/isEqualShallow/test/isEqualShallow.test.ts",
"chars": 1022,
"preview": "import { isEqualShallow } from '../isEqualShallow';\n\n\ndescribe( 'isEqualShallow', () => {\n test( 'can check if 2 arrays"
},
{
"path": "src/js/utils/isObject/isObject.ts",
"chars": 301,
"preview": "/**\n * Checks if the given subject is an object or not.\n *\n * @param subject - A subject to check.\n *\n * @return `true` "
},
{
"path": "src/js/utils/isObject/test/isObject.test.ts",
"chars": 493,
"preview": "import { isObject } from '../isObject';\n\n\ndescribe( 'isObject', () => {\n test( 'can return `true` if the subject is an "
},
{
"path": "src/js/utils/merge/merge.test.ts",
"chars": 0,
"preview": ""
},
{
"path": "src/js/utils/merge/merge.ts",
"chars": 1409,
"preview": "import { forOwn } from '../forOwn/forOwn';\nimport { isObject } from '../isObject/isObject';\n\n\n/**\n * Merges U to T.\n *\n "
},
{
"path": "tsconfig.json",
"chars": 553,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"esnext\",\n \"useDefineForClassFields\": true,\n \"strict\": true,\n \"jsx\": \"pr"
},
{
"path": "vite/vite.config.iife.ts",
"chars": 702,
"preview": "import { defineConfig } from 'vite';\nimport vue from '@vitejs/plugin-vue';\nimport babel from '@rollup/plugin-babel';\n\n\ne"
},
{
"path": "vite.config.ts",
"chars": 686,
"preview": "import { defineConfig } from 'vite';\nimport vue from '@vitejs/plugin-vue';\n\n\nexport default defineConfig( {\n build: {\n\t"
}
]
About this extraction
This page contains the full source code of the Splidejs/vue-splide GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 55 files (197.0 KB), approximately 55.6k tokens, and a symbol index with 193 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.