Free javascript Hosting


dynamic-carousel.js

Uploaded on Mar 09 2022 14:01 by sushil.mishra

/*!
* Copyright (c) 2022 Bonzai Digital Pte. Ltd., All rights reserved.
*/

var DynamicCarousel = (function () {
'use strict';

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);

if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);

if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}

keys.push.apply(keys, symbols);
}

return keys;
}

function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};

if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}

return target;
}

function _typeof(obj) {
"@babel/helpers - typeof";

if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}

return _typeof(obj);
}

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}

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);
return Constructor;
}

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}

return obj;
}

function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}

subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}

function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};

return _setPrototypeOf(o, p);
}

function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;

try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}

function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}

return _construct.apply(null, arguments);
}

function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}

function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;

_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;

if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}

if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);

_cache.set(Class, Wrapper);
}

function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}

Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};

return _wrapNativeSuper(Class);
}

function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}

return self;
}

function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}

return _assertThisInitialized(self);
}

function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();

return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;

if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;

result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}

return _possibleConstructorReturn(this, result);
};
}

function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}

function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}

function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}

function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}

function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;

for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];

return arr2;
}

function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

/**
* SSR Window 4.0.0
* Better handling for window object in SSR environment
* https://github.com/nolimits4web/ssr-window
*
* Copyright 2021, Vladimir Kharlampidi
*
* Licensed under MIT
*
* Released on: August 25, 2021
*/

/* eslint-disable no-param-reassign */
function isObject$1(obj) {
return obj !== null && _typeof(obj) === 'object' && 'constructor' in obj && obj.constructor === Object;
}

function extend$1() {
var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var src = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
Object.keys(src).forEach(function (key) {
if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) {
extend$1(target[key], src[key]);
}
});
}

var ssrDocument = {
body: {},
addEventListener: function addEventListener() {},
removeEventListener: function removeEventListener() {},
activeElement: {
blur: function blur() {},
nodeName: ''
},
querySelector: function querySelector() {
return null;
},
querySelectorAll: function querySelectorAll() {
return [];
},
getElementById: function getElementById() {
return null;
},
createEvent: function createEvent() {
return {
initEvent: function initEvent() {}
};
},
createElement: function createElement() {
return {
children: [],
childNodes: [],
style: {},
setAttribute: function setAttribute() {},
getElementsByTagName: function getElementsByTagName() {
return [];
}
};
},
createElementNS: function createElementNS() {
return {};
},
importNode: function importNode() {
return null;
},
location: {
hash: '',
host: '',
hostname: '',
href: '',
origin: '',
pathname: '',
protocol: '',
search: ''
}
};

function getDocument() {
var doc = typeof document !== 'undefined' ? document : {};
extend$1(doc, ssrDocument);
return doc;
}

var ssrWindow = {
document: ssrDocument,
navigator: {
userAgent: ''
},
location: {
hash: '',
host: '',
hostname: '',
href: '',
origin: '',
pathname: '',
protocol: '',
search: ''
},
history: {
replaceState: function replaceState() {},
pushState: function pushState() {},
go: function go() {},
back: function back() {}
},
CustomEvent: function CustomEvent() {
return this;
},
addEventListener: function addEventListener() {},
removeEventListener: function removeEventListener() {},
getComputedStyle: function getComputedStyle() {
return {
getPropertyValue: function getPropertyValue() {
return '';
}
};
},
Image: function Image() {},
Date: function Date() {},
screen: {},
setTimeout: function setTimeout() {},
clearTimeout: function clearTimeout() {},
matchMedia: function matchMedia() {
return {};
},
requestAnimationFrame: function requestAnimationFrame(callback) {
if (typeof setTimeout === 'undefined') {
callback();
return null;
}

return setTimeout(callback, 0);
},
cancelAnimationFrame: function cancelAnimationFrame(id) {
if (typeof setTimeout === 'undefined') {
return;
}

clearTimeout(id);
}
};

function getWindow() {
var win = typeof window !== 'undefined' ? window : {};
extend$1(win, ssrWindow);
return win;
}

/* eslint-disable no-proto */

function makeReactive(obj) {
var proto = obj.__proto__;
Object.defineProperty(obj, '__proto__', {
get: function get() {
return proto;
},
set: function set(value) {
proto.__proto__ = value;
}
});
}

var Dom7 = /*#__PURE__*/function (_Array) {
_inherits(Dom7, _Array);

var _super = _createSuper(Dom7);

function Dom7(items) {
var _this;

_classCallCheck(this, Dom7);

_this = _super.call.apply(_super, [this].concat(_toConsumableArray(items || [])));
makeReactive(_assertThisInitialized(_this));
return _this;
}

return Dom7;
}( /*#__PURE__*/_wrapNativeSuper(Array));

function arrayFlat() {
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var res = [];
arr.forEach(function (el) {
if (Array.isArray(el)) {
res.push.apply(res, _toConsumableArray(arrayFlat(el)));
} else {
res.push(el);
}
});
return res;
}

function arrayFilter(arr, callback) {
return Array.prototype.filter.call(arr, callback);
}

function arrayUnique(arr) {
var uniqueArray = [];

for (var i = 0; i < arr.length; i += 1) {
if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
}

return uniqueArray;
}


function qsa(selector, context) {
if (typeof selector !== 'string') {
return [selector];
}

var a = [];
var res = context.querySelectorAll(selector);

for (var i = 0; i < res.length; i += 1) {
a.push(res[i]);
}

return a;
}

function $(selector, context) {
var window = getWindow();
var document = getDocument();
var arr = [];

if (!context && selector instanceof Dom7) {
return selector;
}

if (!selector) {
return new Dom7(arr);
}

if (typeof selector === 'string') {
var _html = selector.trim();

if (_html.indexOf('<') >= 0 && _html.indexOf('>') >= 0) {
var toCreate = 'div';
if (_html.indexOf('<li') === 0) toCreate = 'ul';
if (_html.indexOf('<tr') === 0) toCreate = 'tbody';
if (_html.indexOf('<td') === 0 || _html.indexOf('<th') === 0) toCreate = 'tr';
if (_html.indexOf('<tbody') === 0) toCreate = 'table';
if (_html.indexOf('<option') === 0) toCreate = 'select';
var tempParent = document.createElement(toCreate);
tempParent.innerHTML = _html;

for (var i = 0; i < tempParent.childNodes.length; i += 1) {
arr.push(tempParent.childNodes[i]);
}
} else {
arr = qsa(selector.trim(), context || document);
} // arr = qsa(selector, document);

} else if (selector.nodeType || selector === window || selector === document) {
arr.push(selector);
} else if (Array.isArray(selector)) {
if (selector instanceof Dom7) return selector;
arr = selector;
}

return new Dom7(arrayUnique(arr));
}

$.fn = Dom7.prototype; // eslint-disable-next-line

function addClass() {
for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
classes[_key] = arguments[_key];
}

var classNames = arrayFlat(classes.map(function (c) {
return c.split(' ');
}));
this.forEach(function (el) {
var _el$classList;

(_el$classList = el.classList).add.apply(_el$classList, _toConsumableArray(classNames));
});
return this;
}

function removeClass() {
for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
classes[_key2] = arguments[_key2];
}

var classNames = arrayFlat(classes.map(function (c) {
return c.split(' ');
}));
this.forEach(function (el) {
var _el$classList2;

(_el$classList2 = el.classList).remove.apply(_el$classList2, _toConsumableArray(classNames));
});
return this;
}

function toggleClass() {
for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
classes[_key3] = arguments[_key3];
}

var classNames = arrayFlat(classes.map(function (c) {
return c.split(' ');
}));
this.forEach(function (el) {
classNames.forEach(function (className) {
el.classList.toggle(className);
});
});
}

function hasClass() {
for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
classes[_key4] = arguments[_key4];
}

var classNames = arrayFlat(classes.map(function (c) {
return c.split(' ');
}));
return arrayFilter(this, function (el) {
return classNames.filter(function (className) {
return el.classList.contains(className);
}).length > 0;
}).length > 0;
}

function attr(attrs, value) {
if (arguments.length === 1 && typeof attrs === 'string') {
// Get attr
if (this[0]) return this[0].getAttribute(attrs);
return undefined;
} // Set attrs


for (var i = 0; i < this.length; i += 1) {
if (arguments.length === 2) {
// String
this[i].setAttribute(attrs, value);
} else {
// Object
for (var attrName in attrs) {
this[i][attrName] = attrs[attrName];
this[i].setAttribute(attrName, attrs[attrName]);
}
}
}

return this;
}

function removeAttr(attr) {
for (var i = 0; i < this.length; i += 1) {
this[i].removeAttribute(attr);
}

return this;
}

function transform(transform) {
for (var i = 0; i < this.length; i += 1) {
this[i].style.transform = transform;
}

return this;
}

function transition$1(duration) {
for (var i = 0; i < this.length; i += 1) {
this[i].style.transitionDuration = typeof duration !== 'string' ? "".concat(duration, "ms") : duration;
}

return this;
}

function on() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}

var eventType = args[0],
targetSelector = args[1],
listener = args[2],
capture = args[3];

if (typeof args[1] === 'function') {
eventType = args[0];
listener = args[1];
capture = args[2];
targetSelector = undefined;
}

if (!capture) capture = false;

function handleLiveEvent(e) {
var target = e.target;
if (!target) return;
var eventData = e.target.dom7EventData || [];

if (eventData.indexOf(e) < 0) {
eventData.unshift(e);
}

if ($(target).is(targetSelector)) listener.apply(target, eventData);else {
var _parents = $(target).parents(); // eslint-disable-line


for (var k = 0; k < _parents.length; k += 1) {
if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);
}
}
}

function handleEvent(e) {
var eventData = e && e.target ? e.target.dom7EventData || [] : [];

if (eventData.indexOf(e) < 0) {
eventData.unshift(e);
}

listener.apply(this, eventData);
}

var events = eventType.split(' ');
var j;

for (var i = 0; i < this.length; i += 1) {
var el = this[i];

if (!targetSelector) {
for (j = 0; j < events.length; j += 1) {
var event = events[j];
if (!el.dom7Listeners) el.dom7Listeners = {};
if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
el.dom7Listeners[event].push({
listener: listener,
proxyListener: handleEvent
});
el.addEventListener(event, handleEvent, capture);
}
} else {
// Live events
for (j = 0; j < events.length; j += 1) {
var _event = events[j];
if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];

el.dom7LiveListeners[_event].push({
listener: listener,
proxyListener: handleLiveEvent
});

el.addEventListener(_event, handleLiveEvent, capture);
}
}
}

return this;
}

function off() {
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
}

var eventType = args[0],
targetSelector = args[1],
listener = args[2],
capture = args[3];

if (typeof args[1] === 'function') {
eventType = args[0];
listener = args[1];
capture = args[2];
targetSelector = undefined;
}

if (!capture) capture = false;
var events = eventType.split(' ');

for (var i = 0; i < events.length; i += 1) {
var event = events[i];

for (var j = 0; j < this.length; j += 1) {
var el = this[j];
var handlers = void 0;

if (!targetSelector && el.dom7Listeners) {
handlers = el.dom7Listeners[event];
} else if (targetSelector && el.dom7LiveListeners) {
handlers = el.dom7LiveListeners[event];
}

if (handlers && handlers.length) {
for (var k = handlers.length - 1; k >= 0; k -= 1) {
var handler = handlers[k];

if (listener && handler.listener === listener) {
el.removeEventListener(event, handler.proxyListener, capture);
handlers.splice(k, 1);
} else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
el.removeEventListener(event, handler.proxyListener, capture);
handlers.splice(k, 1);
} else if (!listener) {
el.removeEventListener(event, handler.proxyListener, capture);
handlers.splice(k, 1);
}
}
}
}
}

return this;
}

function trigger() {
var window = getWindow();

for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
args[_key9] = arguments[_key9];
}

var events = args[0].split(' ');
var eventData = args[1];

for (var i = 0; i < events.length; i += 1) {
var event = events[i];

for (var j = 0; j < this.length; j += 1) {
var el = this[j];

if (window.CustomEvent) {
var evt = new window.CustomEvent(event, {
detail: eventData,
bubbles: true,
cancelable: true
});
el.dom7EventData = args.filter(function (data, dataIndex) {
return dataIndex > 0;
});
el.dispatchEvent(evt);
el.dom7EventData = [];
delete el.dom7EventData;
}
}
}

return this;
}

function transitionEnd$1(callback) {
var dom = this;

function fireCallBack(e) {
if (e.target !== this) return;
callback.call(this, e);
dom.off('transitionend', fireCallBack);
}

if (callback) {
dom.on('transitionend', fireCallBack);
}

return this;
}

function outerWidth(includeMargins) {
if (this.length > 0) {
if (includeMargins) {
var _styles = this.styles();

return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));
}

return this[0].offsetWidth;
}

return null;
}

function outerHeight(includeMargins) {
if (this.length > 0) {
if (includeMargins) {
var _styles2 = this.styles();

return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));
}

return this[0].offsetHeight;
}

return null;
}

function offset() {
if (this.length > 0) {
var window = getWindow();
var document = getDocument();
var el = this[0];
var box = el.getBoundingClientRect();
var body = document.body;
var clientTop = el.clientTop || body.clientTop || 0;
var clientLeft = el.clientLeft || body.clientLeft || 0;

var _scrollTop = el === window ? window.scrollY : el.scrollTop;

var _scrollLeft = el === window ? window.scrollX : el.scrollLeft;

return {
top: box.top + _scrollTop - clientTop,
left: box.left + _scrollLeft - clientLeft
};
}

return null;
}

function styles() {
var window = getWindow();
if (this[0]) return window.getComputedStyle(this[0], null);
return {};
}

function css(props, value) {
var window = getWindow();
var i;

if (arguments.length === 1) {
if (typeof props === 'string') {
// .css('width')
if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
} else {
// .css({ width: '100px' })
for (i = 0; i < this.length; i += 1) {
for (var _prop in props) {
this[i].style[_prop] = props[_prop];
}
}

return this;
}
}

if (arguments.length === 2 && typeof props === 'string') {
// .css('width', '100px')
for (i = 0; i < this.length; i += 1) {
this[i].style[props] = value;
}

return this;
}

return this;
}

function each(callback) {
if (!callback) return this;
this.forEach(function (el, index) {
callback.apply(el, [el, index]);
});
return this;
}

function filter(callback) {
var result = arrayFilter(this, callback);
return $(result);
}

function html(html) {
if (typeof html === 'undefined') {
return this[0] ? this[0].innerHTML : null;
}

for (var i = 0; i < this.length; i += 1) {
this[i].innerHTML = html;
}

return this;
}

function text(text) {
if (typeof text === 'undefined') {
return this[0] ? this[0].textContent.trim() : null;
}

for (var i = 0; i < this.length; i += 1) {
this[i].textContent = text;
}

return this;
}

function is(selector) {
var window = getWindow();
var document = getDocument();
var el = this[0];
var compareWith;
var i;
if (!el || typeof selector === 'undefined') return false;

if (typeof selector === 'string') {
if (el.matches) return el.matches(selector);
if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
if (el.msMatchesSelector) return el.msMatchesSelector(selector);
compareWith = $(selector);

for (i = 0; i < compareWith.length; i += 1) {
if (compareWith[i] === el) return true;
}

return false;
}

if (selector === document) {
return el === document;
}

if (selector === window) {
return el === window;
}

if (selector.nodeType || selector instanceof Dom7) {
compareWith = selector.nodeType ? [selector] : selector;

for (i = 0; i < compareWith.length; i += 1) {
if (compareWith[i] === el) return true;
}

return false;
}

return false;
}

function index() {
var child = this[0];
var i;

if (child) {
i = 0; // eslint-disable-next-line

while ((child = child.previousSibling) !== null) {
if (child.nodeType === 1) i += 1;
}

return i;
}

return undefined;
}

function eq(index) {
if (typeof index === 'undefined') return this;
var length = this.length;

if (index > length - 1) {
return $([]);
}

if (index < 0) {
var returnIndex = length + index;
if (returnIndex < 0) return $([]);
return $([this[returnIndex]]);
}

return $([this[index]]);
}

function append() {
var newChild;
var document = getDocument();

for (var k = 0; k < arguments.length; k += 1) {
newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];

for (var i = 0; i < this.length; i += 1) {
if (typeof newChild === 'string') {
var tempDiv = document.createElement('div');
tempDiv.innerHTML = newChild;

while (tempDiv.firstChild) {
this[i].appendChild(tempDiv.firstChild);
}
} else if (newChild instanceof Dom7) {
for (var j = 0; j < newChild.length; j += 1) {
this[i].appendChild(newChild[j]);
}
} else {
this[i].appendChild(newChild);
}
}
}

return this;
}

function prepend(newChild) {
var document = getDocument();
var i;
var j;

for (i = 0; i < this.length; i += 1) {
if (typeof newChild === 'string') {
var tempDiv = document.createElement('div');
tempDiv.innerHTML = newChild;

for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
}
} else if (newChild instanceof Dom7) {
for (j = 0; j < newChild.length; j += 1) {
this[i].insertBefore(newChild[j], this[i].childNodes[0]);
}
} else {
this[i].insertBefore(newChild, this[i].childNodes[0]);
}
}

return this;
}

function next(selector) {
if (this.length > 0) {
if (selector) {
if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
return $([this[0].nextElementSibling]);
}

return $([]);
}

if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
return $([]);
}

return $([]);
}

function nextAll(selector) {
var nextEls = [];
var el = this[0];
if (!el) return $([]);

while (el.nextElementSibling) {
var _next = el.nextElementSibling; // eslint-disable-line

if (selector) {
if ($(_next).is(selector)) nextEls.push(_next);
} else nextEls.push(_next);

el = _next;
}

return $(nextEls);
}

function prev(selector) {
if (this.length > 0) {
var el = this[0];

if (selector) {
if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
return $([el.previousElementSibling]);
}

return $([]);
}

if (el.previousElementSibling) return $([el.previousElementSibling]);
return $([]);
}

return $([]);
}

function prevAll(selector) {
var prevEls = [];
var el = this[0];
if (!el) return $([]);

while (el.previousElementSibling) {
var _prev = el.previousElementSibling; // eslint-disable-line

if (selector) {
if ($(_prev).is(selector)) prevEls.push(_prev);
} else prevEls.push(_prev);

el = _prev;
}

return $(prevEls);
}

function parent(selector) {
var parents = []; // eslint-disable-line

for (var i = 0; i < this.length; i += 1) {
if (this[i].parentNode !== null) {
if (selector) {
if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
} else {
parents.push(this[i].parentNode);
}
}
}

return $(parents);
}

function parents(selector) {
var parents = []; // eslint-disable-line

for (var i = 0; i < this.length; i += 1) {
var _parent = this[i].parentNode; // eslint-disable-line

while (_parent) {
if (selector) {
if ($(_parent).is(selector)) parents.push(_parent);
} else {
parents.push(_parent);
}

_parent = _parent.parentNode;
}
}

return $(parents);
}

function closest(selector) {
var closest = this; // eslint-disable-line

if (typeof selector === 'undefined') {
return $([]);
}

if (!closest.is(selector)) {
closest = closest.parents(selector).eq(0);
}

return closest;
}

function find(selector) {
var foundElements = [];

for (var i = 0; i < this.length; i += 1) {
var found = this[i].querySelectorAll(selector);

for (var j = 0; j < found.length; j += 1) {
foundElements.push(found[j]);
}
}

return $(foundElements);
}

function children(selector) {
var children = []; // eslint-disable-line

for (var i = 0; i < this.length; i += 1) {
var childNodes = this[i].children;

for (var j = 0; j < childNodes.length; j += 1) {
if (!selector || $(childNodes[j]).is(selector)) {
children.push(childNodes[j]);
}
}
}

return $(children);
}

function remove() {
for (var i = 0; i < this.length; i += 1) {
if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
}

return this;
}

var Methods = {
addClass: addClass,
removeClass: removeClass,
hasClass: hasClass,
toggleClass: toggleClass,
attr: attr,
removeAttr: removeAttr,
transform: transform,
transition: transition$1,
on: on,
off: off,
trigger: trigger,
transitionEnd: transitionEnd$1,
outerWidth: outerWidth,
outerHeight: outerHeight,
styles: styles,
offset: offset,
css: css,
each: each,
html: html,
text: text,
is: is,
index: index,
eq: eq,
append: append,
prepend: prepend,
next: next,
nextAll: nextAll,
prev: prev,
prevAll: prevAll,
parent: parent,
parents: parents,
closest: closest,
find: find,
children: children,
filter: filter,
remove: remove
};
Object.keys(Methods).forEach(function (methodName) {
Object.defineProperty($.fn, methodName, {
value: Methods[methodName],
writable: true
});
});

function deleteProps(obj) {
var object = obj;
Object.keys(object).forEach(function (key) {
try {
object[key] = null;
} catch (e) {// no getter for object
}

try {
delete object[key];
} catch (e) {// something got wrong
}
});
}

function nextTick(callback) {
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
return setTimeout(callback, delay);
}

function now() {
return Date.now();
}

function getComputedStyle$1(el) {
var window = getWindow();
var style;

if (window.getComputedStyle) {
style = window.getComputedStyle(el, null);
}

if (!style && el.currentStyle) {
style = el.currentStyle;
}

if (!style) {
style = el.style;
}

return style;
}

function getTranslate(el) {
var axis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'x';
var window = getWindow();
var matrix;
var curTransform;
var transformMatrix;
var curStyle = getComputedStyle$1(el);

if (window.WebKitCSSMatrix) {
curTransform = curStyle.transform || curStyle.webkitTransform;

if (curTransform.split(',').length > 6) {
curTransform = curTransform.split(', ').map(function (a) {
return a.replace(',', '.');
}).join(', ');
} // Some old versions of Webkit choke when 'none' is passed; pass
// empty string instead in this case


transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
} else {
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
matrix = transformMatrix.toString().split(',');
}

if (axis === 'x') {
// Latest Chrome and webkits Fix
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix
else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers
else curTransform = parseFloat(matrix[4]);
}

if (axis === 'y') {
// Latest Chrome and webkits Fix
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix
else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers
else curTransform = parseFloat(matrix[5]);
}

return curTransform || 0;
}

function isObject(o) {
return _typeof(o) === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
}

function isNode(node) {
// eslint-disable-next-line
if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
return node instanceof HTMLElement;
}

return node && (node.nodeType === 1 || node.nodeType === 11);
}

function extend() {
var to = Object(arguments.length <= 0 ? undefined : arguments[0]);
var noExtend = ['__proto__', 'constructor', 'prototype'];

for (var i = 1; i < arguments.length; i += 1) {
var nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];

if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
var keysArray = Object.keys(Object(nextSource)).filter(function (key) {
return noExtend.indexOf(key) < 0;
});

for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
var nextKey = keysArray[nextIndex];
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);

if (desc !== undefined && desc.enumerable) {
if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
if (nextSource[nextKey].__swiper__) {
to[nextKey] = nextSource[nextKey];
} else {
extend(to[nextKey], nextSource[nextKey]);
}
} else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
to[nextKey] = {};

if (nextSource[nextKey].__swiper__) {
to[nextKey] = nextSource[nextKey];
} else {
extend(to[nextKey], nextSource[nextKey]);
}
} else {
to[nextKey] = nextSource[nextKey];
}
}
}
}
}

return to;
}

function setCSSProperty(el, varName, varValue) {
el.style.setProperty(varName, varValue);
}

function animateCSSModeScroll(_ref) {
var swiper = _ref.swiper,
targetPosition = _ref.targetPosition,
side = _ref.side;
var window = getWindow();
var startPosition = -swiper.translate;
var startTime = null;
var time;
var duration = swiper.params.speed;
swiper.wrapperEl.style.scrollSnapType = 'none';
window.cancelAnimationFrame(swiper.cssModeFrameID);
var dir = targetPosition > startPosition ? 'next' : 'prev';

var isOutOfBound = function isOutOfBound(current, target) {
return dir === 'next' && current >= target || dir === 'prev' && current <= target;
};

var animate = function animate() {
time = new Date().getTime();

if (startTime === null) {
startTime = time;
}

var progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
var easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
var currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
if (isOutOfBound(currentPosition, targetPosition)) currentPosition = targetPosition;
swiper.wrapperEl.scrollTo(_defineProperty({}, side, currentPosition));

if (isOutOfBound(currentPosition, targetPosition)) {
swiper.wrapperEl.style.scrollSnapType = '';
window.cancelAnimationFrame(swiper.cssModeFrameID);
return;
}

swiper.cssModeFrameID = window.requestAnimationFrame(animate);
};

animate();
}

var support;

function calcSupport() {
var window = getWindow();
var document = getDocument();
return {
smoothScroll: document.documentElement && 'scrollBehavior' in document.documentElement.style,
touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch),
passiveListener: function checkPassiveListener() {
var supportsPassive = false;

try {
var opts = Object.defineProperty({}, 'passive', {
// eslint-disable-next-line
get: function get() {
supportsPassive = true;
}
});
window.addEventListener('testPassiveListener', null, opts);
} catch (e) {// No support
}

return supportsPassive;
}(),
gestures: function checkGestures() {
return 'ongesturestart' in window;
}()
};
}

function getSupport() {
if (!support) {
support = calcSupport();
}

return support;
}

var deviceCached;

function calcDevice() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
userAgent = _ref.userAgent;

var support = getSupport();
var window = getWindow();
var platform = window.navigator.platform;
var ua = userAgent || window.navigator.userAgent;
var device = {
ios: false,
android: false
};
var screenWidth = window.screen.width;
var screenHeight = window.screen.height;
var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line

var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
var windows = platform === 'Win32';
var macos = platform === 'MacIntel'; // iPadOs 13 fix

var iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];

if (!ipad && macos && support.touch && iPadScreens.indexOf("".concat(screenWidth, "x").concat(screenHeight)) >= 0) {
ipad = ua.match(/(Version)\/([\d.]+)/);
if (!ipad) ipad = [0, 1, '13_0_0'];
macos = false;
} // Android


if (android && !windows) {
device.os = 'android';
device.android = true;
}

if (ipad || iphone || ipod) {
device.os = 'ios';
device.ios = true;
} // Export object


return device;
}

function getDevice() {
var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

if (!deviceCached) {
deviceCached = calcDevice(overrides);
}

return deviceCached;
}

var browser;

function calcBrowser() {
var window = getWindow();

function isSafari() {
var ua = window.navigator.userAgent.toLowerCase();
return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
}

return {
isSafari: isSafari(),
isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
};
}

function getBrowser() {
if (!browser) {
browser = calcBrowser();
}

return browser;
}

function Resize(_ref) {
var swiper = _ref.swiper,
on = _ref.on,
emit = _ref.emit;
var window = getWindow();
var observer = null;

var resizeHandler = function resizeHandler() {
if (!swiper || swiper.destroyed || !swiper.initialized) return;
emit('beforeResize');
emit('resize');
};

var createObserver = function createObserver() {
if (!swiper || swiper.destroyed || !swiper.initialized) return;
observer = new ResizeObserver(function (entries) {
var width = swiper.width,
height = swiper.height;
var newWidth = width;
var newHeight = height;
entries.forEach(function (_ref2) {
var contentBoxSize = _ref2.contentBoxSize,
contentRect = _ref2.contentRect,
target = _ref2.target;
if (target && target !== swiper.el) return;
newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
});

if (newWidth !== width || newHeight !== height) {
resizeHandler();
}
});
observer.observe(swiper.el);
};

var removeObserver = function removeObserver() {
if (observer && observer.unobserve && swiper.el) {
observer.unobserve(swiper.el);
observer = null;
}
};

var orientationChangeHandler = function orientationChangeHandler() {
if (!swiper || swiper.destroyed || !swiper.initialized) return;
emit('orientationchange');
};

on('init', function () {
if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {
createObserver();
return;
}

window.addEventListener('resize', resizeHandler);
window.addEventListener('orientationchange', orientationChangeHandler);
});
on('destroy', function () {
removeObserver();
window.removeEventListener('resize', resizeHandler);
window.removeEventListener('orientationchange', orientationChangeHandler);
});
}

function Observer(_ref) {
var swiper = _ref.swiper,
extendParams = _ref.extendParams,
on = _ref.on,
emit = _ref.emit;
var observers = [];
var window = getWindow();

var attach = function attach(target) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
var observer = new ObserverFunc(function (mutations) {
// The observerUpdate event should only be triggered
// once despite the number of mutations. Additional
// triggers are redundant and are very costly
if (mutations.length === 1) {
emit('observerUpdate', mutations[0]);
return;
}

var observerUpdate = function observerUpdate() {
emit('observerUpdate', mutations[0]);
};

if (window.requestAnimationFrame) {
window.requestAnimationFrame(observerUpdate);
} else {
window.setTimeout(observerUpdate, 0);
}
});
observer.observe(target, {
attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
childList: typeof options.childList === 'undefined' ? true : options.childList,
characterData: typeof options.characterData === 'undefined' ? true : options.characterData
});
observers.push(observer);
};

var init = function init() {
if (!swiper.params.observer) return;

if (swiper.params.observeParents) {
var containerParents = swiper.$el.parents();

for (var i = 0; i < containerParents.length; i += 1) {
attach(containerParents[i]);
}
} // Observe container


attach(swiper.$el[0], {
childList: swiper.params.observeSlideChildren
}); // Observe wrapper

attach(swiper.$wrapperEl[0], {
attributes: false
});
};

var destroy = function destroy() {
observers.forEach(function (observer) {
observer.disconnect();
});
observers.splice(0, observers.length);
};

extendParams({
observer: false,
observeParents: false,
observeSlideChildren: false
});
on('init', init);
on('destroy', destroy);
}

/* eslint-disable no-underscore-dangle */
var eventsEmitter = {
on: function on(events, handler, priority) {
var self = this;
if (typeof handler !== 'function') return self;
var method = priority ? 'unshift' : 'push';
events.split(' ').forEach(function (event) {
if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
self.eventsListeners[event][method](handler);
});
return self;
},
once: function once(events, handler, priority) {
var self = this;
if (typeof handler !== 'function') return self;

function onceHandler() {
self.off(events, onceHandler);

if (onceHandler.__emitterProxy) {
delete onceHandler.__emitterProxy;
}

for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

handler.apply(self, args);
}

onceHandler.__emitterProxy = handler;
return self.on(events, onceHandler, priority);
},
onAny: function onAny(handler, priority) {
var self = this;
if (typeof handler !== 'function') return self;
var method = priority ? 'unshift' : 'push';

if (self.eventsAnyListeners.indexOf(handler) < 0) {
self.eventsAnyListeners[method](handler);
}

return self;
},
offAny: function offAny(handler) {
var self = this;
if (!self.eventsAnyListeners) return self;
var index = self.eventsAnyListeners.indexOf(handler);

if (index >= 0) {
self.eventsAnyListeners.splice(index, 1);
}

return self;
},
off: function off(events, handler) {
var self = this;
if (!self.eventsListeners) return self;
events.split(' ').forEach(function (event) {
if (typeof handler === 'undefined') {
self.eventsListeners[event] = [];
} else if (self.eventsListeners[event]) {
self.eventsListeners[event].forEach(function (eventHandler, index) {
if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
self.eventsListeners[event].splice(index, 1);
}
});
}
});
return self;
},
emit: function emit() {
var self = this;
if (!self.eventsListeners) return self;
var events;
var data;
var context;

for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}

if (typeof args[0] === 'string' || Array.isArray(args[0])) {
events = args[0];
data = args.slice(1, args.length);
context = self;
} else {
events = args[0].events;
data = args[0].data;
context = args[0].context || self;
}

data.unshift(context);
var eventsArray = Array.isArray(events) ? events : events.split(' ');
eventsArray.forEach(function (event) {
if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
self.eventsAnyListeners.forEach(function (eventHandler) {
eventHandler.apply(context, [event].concat(_toConsumableArray(data)));
});
}

if (self.eventsListeners && self.eventsListeners[event]) {
self.eventsListeners[event].forEach(function (eventHandler) {
eventHandler.apply(context, data);
});
}
});
return self;
}
};

function updateSize() {
var swiper = this;
var width;
var height;
var $el = swiper.$el;

if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
width = swiper.params.width;
} else {
width = $el[0].clientWidth;
}

if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
height = swiper.params.height;
} else {
height = $el[0].clientHeight;
}

if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
return;
} // Subtract paddings


width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10);
height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10);
if (Number.isNaN(width)) width = 0;
if (Number.isNaN(height)) height = 0;
Object.assign(swiper, {
width: width,
height: height,
size: swiper.isHorizontal() ? width : height
});
}

function updateSlides() {
var swiper = this;

function getDirectionLabel(property) {
if (swiper.isHorizontal()) {
return property;
} // prettier-ignore


return {
'width': 'height',
'margin-top': 'margin-left',
'margin-bottom ': 'margin-right',
'margin-left': 'margin-top',
'margin-right': 'margin-bottom',
'padding-left': 'padding-top',
'padding-right': 'padding-bottom',
'marginRight': 'marginBottom'
}[property];
}

function getDirectionPropertyValue(node, label) {
return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
}

var params = swiper.params;
var $wrapperEl = swiper.$wrapperEl,
swiperSize = swiper.size,
rtl = swiper.rtlTranslate,
wrongRTL = swiper.wrongRTL;
var isVirtual = swiper.virtual && params.virtual.enabled;
var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
var slides = $wrapperEl.children(".".concat(swiper.params.slideClass));
var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
var snapGrid = [];
var slidesGrid = [];
var slidesSizesGrid = [];
var offsetBefore = params.slidesOffsetBefore;

if (typeof offsetBefore === 'function') {
offsetBefore = params.slidesOffsetBefore.call(swiper);
}

var offsetAfter = params.slidesOffsetAfter;

if (typeof offsetAfter === 'function') {
offsetAfter = params.slidesOffsetAfter.call(swiper);
}

var previousSnapGridLength = swiper.snapGrid.length;
var previousSlidesGridLength = swiper.slidesGrid.length;
var spaceBetween = params.spaceBetween;
var slidePosition = -offsetBefore;
var prevSlideSize = 0;
var index = 0;

if (typeof swiperSize === 'undefined') {
return;
}

if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
}

swiper.virtualSize = -spaceBetween; // reset margins

if (rtl) slides.css({
marginLeft: '',
marginBottom: '',
marginTop: ''
});else slides.css({
marginRight: '',
marginBottom: '',
marginTop: ''
}); // reset cssMode offsets

if (params.centeredSlides && params.cssMode) {
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', '');
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', '');
}

var gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;

if (gridEnabled) {
swiper.grid.initSlides(slidesLength);
} // Calc slides


var slideSize;

for (var i = 0; i < slidesLength; i += 1) {
slideSize = 0;
var slide = slides.eq(i);

if (gridEnabled) {
swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
}

if (slide.css('display') === 'none') continue; // eslint-disable-line

if (params.slidesPerView === 'auto') {
var slideStyles = getComputedStyle(slide[0]);
var currentTransform = slide[0].style.transform;
var currentWebKitTransform = slide[0].style.webkitTransform;

if (currentTransform) {
slide[0].style.transform = 'none';
}

if (currentWebKitTransform) {
slide[0].style.webkitTransform = 'none';
}

if (params.roundLengths) {
slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
} else {
// eslint-disable-next-line
var width = getDirectionPropertyValue(slideStyles, 'width');
var paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
var paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
var marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
var marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
var boxSizing = slideStyles.getPropertyValue('box-sizing');

if (boxSizing && boxSizing === 'border-box') {
slideSize = width + marginLeft + marginRight;
} else {
var _slide$ = slide[0],
clientWidth = _slide$.clientWidth,
offsetWidth = _slide$.offsetWidth;
slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
}
}

if (currentTransform) {
slide[0].style.transform = currentTransform;
}

if (currentWebKitTransform) {
slide[0].style.webkitTransform = currentWebKitTransform;
}

if (params.roundLengths) slideSize = Math.floor(slideSize);
} else {
slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
if (params.roundLengths) slideSize = Math.floor(slideSize);

if (slides[i]) {
slides[i].style[getDirectionLabel('width')] = "".concat(slideSize, "px");
}
}

if (slides[i]) {
slides[i].swiperSlideSize = slideSize;
}

slidesSizesGrid.push(slideSize);

if (params.centeredSlides) {
slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
slidesGrid.push(slidePosition);
} else {
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
slidesGrid.push(slidePosition);
slidePosition = slidePosition + slideSize + spaceBetween;
}

swiper.virtualSize += slideSize + spaceBetween;
prevSlideSize = slideSize;
index += 1;
}

swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;

if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
$wrapperEl.css({
width: "".concat(swiper.virtualSize + params.spaceBetween, "px")
});
}

if (params.setWrapperSize) {
$wrapperEl.css(_defineProperty({}, getDirectionLabel('width'), "".concat(swiper.virtualSize + params.spaceBetween, "px")));
}

if (gridEnabled) {
swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
} // Remove last grid elements depending on width


if (!params.centeredSlides) {
var newSlidesGrid = [];

for (var _i = 0; _i < snapGrid.length; _i += 1) {
var slidesGridItem = snapGrid[_i];
if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);

if (snapGrid[_i] <= swiper.virtualSize - swiperSize) {
newSlidesGrid.push(slidesGridItem);
}
}

snapGrid = newSlidesGrid;

if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
snapGrid.push(swiper.virtualSize - swiperSize);
}
}

if (snapGrid.length === 0) snapGrid = [0];

if (params.spaceBetween !== 0) {
var key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
slides.filter(function (_, slideIndex) {
if (!params.cssMode) return true;

if (slideIndex === slides.length - 1) {
return false;
}

return true;
}).css(_defineProperty({}, key, "".concat(spaceBetween, "px")));
}

if (params.centeredSlides && params.centeredSlidesBounds) {
var allSlidesSize = 0;
slidesSizesGrid.forEach(function (slideSizeValue) {
allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
});
allSlidesSize -= params.spaceBetween;
var maxSnap = allSlidesSize - swiperSize;
snapGrid = snapGrid.map(function (snap) {
if (snap < 0) return -offsetBefore;
if (snap > maxSnap) return maxSnap + offsetAfter;
return snap;
});
}

if (params.centerInsufficientSlides) {
var _allSlidesSize = 0;
slidesSizesGrid.forEach(function (slideSizeValue) {
_allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
});
_allSlidesSize -= params.spaceBetween;

if (_allSlidesSize < swiperSize) {
var allSlidesOffset = (swiperSize - _allSlidesSize) / 2;
snapGrid.forEach(function (snap, snapIndex) {
snapGrid[snapIndex] = snap - allSlidesOffset;
});
slidesGrid.forEach(function (snap, snapIndex) {
slidesGrid[snapIndex] = snap + allSlidesOffset;
});
}
}

Object.assign(swiper, {
slides: slides,
snapGrid: snapGrid,
slidesGrid: slidesGrid,
slidesSizesGrid: slidesSizesGrid
});

if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', "".concat(-snapGrid[0], "px"));
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', "".concat(swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2, "px"));
var addToSnapGrid = -swiper.snapGrid[0];
var addToSlidesGrid = -swiper.slidesGrid[0];
swiper.snapGrid = swiper.snapGrid.map(function (v) {
return v + addToSnapGrid;
});
swiper.slidesGrid = swiper.slidesGrid.map(function (v) {
return v + addToSlidesGrid;
});
}

if (slidesLength !== previousSlidesLength) {
swiper.emit('slidesLengthChange');
}

if (snapGrid.length !== previousSnapGridLength) {
if (swiper.params.watchOverflow) swiper.checkOverflow();
swiper.emit('snapGridLengthChange');
}

if (slidesGrid.length !== previousSlidesGridLength) {
swiper.emit('slidesGridLengthChange');
}

if (params.watchSlidesProgress) {
swiper.updateSlidesOffset();
}
}

function updateAutoHeight(speed) {
var swiper = this;
var activeSlides = [];
var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
var newHeight = 0;
var i;

if (typeof speed === 'number') {
swiper.setTransition(speed);
} else if (speed === true) {
swiper.setTransition(swiper.params.speed);
}

var getSlideByIndex = function getSlideByIndex(index) {
if (isVirtual) {
return swiper.slides.filter(function (el) {
return parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index;
})[0];
}

return swiper.slides.eq(index)[0];
}; // Find slides currently in view


if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
if (swiper.params.centeredSlides) {
swiper.visibleSlides.each(function (slide) {
activeSlides.push(slide);
});
} else {
for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
var index = swiper.activeIndex + i;
if (index > swiper.slides.length && !isVirtual) break;
activeSlides.push(getSlideByIndex(index));
}
}
} else {
activeSlides.push(getSlideByIndex(swiper.activeIndex));
} // Find new height from highest slide in view


for (i = 0; i < activeSlides.length; i += 1) {
if (typeof activeSlides[i] !== 'undefined') {
var height = activeSlides[i].offsetHeight;
newHeight = height > newHeight ? height : newHeight;
}
} // Update Height


if (newHeight) swiper.$wrapperEl.css('height', "".concat(newHeight, "px"));
}

function updateSlidesOffset() {
var swiper = this;
var slides = swiper.slides;

for (var i = 0; i < slides.length; i += 1) {
slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;
}
}

function updateSlidesProgress() {
var translate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this && this.translate || 0;
var swiper = this;
var params = swiper.params;
var slides = swiper.slides,
rtl = swiper.rtlTranslate;
if (slides.length === 0) return;
if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
var offsetCenter = -translate;
if (rtl) offsetCenter = translate; // Visible Slides

slides.removeClass(params.slideVisibleClass);
swiper.visibleSlidesIndexes = [];
swiper.visibleSlides = [];

for (var i = 0; i < slides.length; i += 1) {
var slide = slides[i];
var slideOffset = slide.swiperSlideOffset;

if (params.cssMode && params.centeredSlides) {
slideOffset -= slides[0].swiperSlideOffset;
}

var slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween);
var slideBefore = -(offsetCenter - slideOffset);
var slideAfter = slideBefore + swiper.slidesSizesGrid[i];
var isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;

if (isVisible) {
swiper.visibleSlides.push(slide);
swiper.visibleSlidesIndexes.push(i);
slides.eq(i).addClass(params.slideVisibleClass);
}

slide.progress = rtl ? -slideProgress : slideProgress;
}

swiper.visibleSlides = $(swiper.visibleSlides);
}

function updateProgress(translate) {
var swiper = this;

if (typeof translate === 'undefined') {
var multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line

translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
}

var params = swiper.params;
var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
var progress = swiper.progress,
isBeginning = swiper.isBeginning,
isEnd = swiper.isEnd;
var wasBeginning = isBeginning;
var wasEnd = isEnd;

if (translatesDiff === 0) {
progress = 0;
isBeginning = true;
isEnd = true;
} else {
progress = (translate - swiper.minTranslate()) / translatesDiff;
isBeginning = progress <= 0;
isEnd = progress >= 1;
}

Object.assign(swiper, {
progress: progress,
isBeginning: isBeginning,
isEnd: isEnd
});
if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);

if (isBeginning && !wasBeginning) {
swiper.emit('reachBeginning toEdge');
}

if (isEnd && !wasEnd) {
swiper.emit('reachEnd toEdge');
}

if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
swiper.emit('fromEdge');
}

swiper.emit('progress', progress);
}

function updateSlidesClasses() {
var swiper = this;
var slides = swiper.slides,
params = swiper.params,
$wrapperEl = swiper.$wrapperEl,
activeIndex = swiper.activeIndex,
realIndex = swiper.realIndex;
var isVirtual = swiper.virtual && params.virtual.enabled;
slides.removeClass("".concat(params.slideActiveClass, " ").concat(params.slideNextClass, " ").concat(params.slidePrevClass, " ").concat(params.slideDuplicateActiveClass, " ").concat(params.slideDuplicateNextClass, " ").concat(params.slideDuplicatePrevClass));
var activeSlide;

if (isVirtual) {
activeSlide = swiper.$wrapperEl.find(".".concat(params.slideClass, "[data-swiper-slide-index=\"").concat(activeIndex, "\"]"));
} else {
activeSlide = slides.eq(activeIndex);
} // Active classes


activeSlide.addClass(params.slideActiveClass);

if (params.loop) {
// Duplicate to all looped slides
if (activeSlide.hasClass(params.slideDuplicateClass)) {
$wrapperEl.children(".".concat(params.slideClass, ":not(.").concat(params.slideDuplicateClass, ")[data-swiper-slide-index=\"").concat(realIndex, "\"]")).addClass(params.slideDuplicateActiveClass);
} else {
$wrapperEl.children(".".concat(params.slideClass, ".").concat(params.slideDuplicateClass, "[data-swiper-slide-index=\"").concat(realIndex, "\"]")).addClass(params.slideDuplicateActiveClass);
}
} // Next Slide


var nextSlide = activeSlide.nextAll(".".concat(params.slideClass)).eq(0).addClass(params.slideNextClass);

if (params.loop && nextSlide.length === 0) {
nextSlide = slides.eq(0);
nextSlide.addClass(params.slideNextClass);
} // Prev Slide


var prevSlide = activeSlide.prevAll(".".concat(params.slideClass)).eq(0).addClass(params.slidePrevClass);

if (params.loop && prevSlide.length === 0) {
prevSlide = slides.eq(-1);
prevSlide.addClass(params.slidePrevClass);
}

if (params.loop) {
// Duplicate to all looped slides
if (nextSlide.hasClass(params.slideDuplicateClass)) {
$wrapperEl.children(".".concat(params.slideClass, ":not(.").concat(params.slideDuplicateClass, ")[data-swiper-slide-index=\"").concat(nextSlide.attr('data-swiper-slide-index'), "\"]")).addClass(params.slideDuplicateNextClass);
} else {
$wrapperEl.children(".".concat(params.slideClass, ".").concat(params.slideDuplicateClass, "[data-swiper-slide-index=\"").concat(nextSlide.attr('data-swiper-slide-index'), "\"]")).addClass(params.slideDuplicateNextClass);
}

if (prevSlide.hasClass(params.slideDuplicateClass)) {
$wrapperEl.children(".".concat(params.slideClass, ":not(.").concat(params.slideDuplicateClass, ")[data-swiper-slide-index=\"").concat(prevSlide.attr('data-swiper-slide-index'), "\"]")).addClass(params.slideDuplicatePrevClass);
} else {
$wrapperEl.children(".".concat(params.slideClass, ".").concat(params.slideDuplicateClass, "[data-swiper-slide-index=\"").concat(prevSlide.attr('data-swiper-slide-index'), "\"]")).addClass(params.slideDuplicatePrevClass);
}
}

swiper.emitSlidesClasses();
}

function updateActiveIndex(newActiveIndex) {
var swiper = this;
var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
var slidesGrid = swiper.slidesGrid,
snapGrid = swiper.snapGrid,
params = swiper.params,
previousIndex = swiper.activeIndex,
previousRealIndex = swiper.realIndex,
previousSnapIndex = swiper.snapIndex;
var activeIndex = newActiveIndex;
var snapIndex;

if (typeof activeIndex === 'undefined') {
for (var i = 0; i < slidesGrid.length; i += 1) {
if (typeof slidesGrid[i + 1] !== 'undefined') {
if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
activeIndex = i;
} else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
activeIndex = i + 1;
}
} else if (translate >= slidesGrid[i]) {
activeIndex = i;
}
} // Normalize slideIndex


if (params.normalizeSlideIndex) {
if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
}
}

if (snapGrid.indexOf(translate) >= 0) {
snapIndex = snapGrid.indexOf(translate);
} else {
var skip = Math.min(params.slidesPerGroupSkip, activeIndex);
snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
}

if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;

if (activeIndex === previousIndex) {
if (snapIndex !== previousSnapIndex) {
swiper.snapIndex = snapIndex;
swiper.emit('snapIndexChange');
}

return;
} // Get real index


var realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);
Object.assign(swiper, {
snapIndex: snapIndex,
realIndex: realIndex,
previousIndex: previousIndex,
activeIndex: activeIndex
});
swiper.emit('activeIndexChange');
swiper.emit('snapIndexChange');

if (previousRealIndex !== realIndex) {
swiper.emit('realIndexChange');
}

if (swiper.initialized || swiper.params.runCallbacksOnInit) {
swiper.emit('slideChange');
}
}

function updateClickedSlide(e) {
var swiper = this;
var params = swiper.params;
var slide = $(e.target).closest(".".concat(params.slideClass))[0];
var slideFound = false;
var slideIndex;

if (slide) {
for (var i = 0; i < swiper.slides.length; i += 1) {
if (swiper.slides[i] === slide) {
slideFound = true;
slideIndex = i;
break;
}
}
}

if (slide && slideFound) {
swiper.clickedSlide = slide;

if (swiper.virtual && swiper.params.virtual.enabled) {
swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10);
} else {
swiper.clickedIndex = slideIndex;
}
} else {
swiper.clickedSlide = undefined;
swiper.clickedIndex = undefined;
return;
}

if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
swiper.slideToClickedSlide();
}
}

var update = {
updateSize: updateSize,
updateSlides: updateSlides,
updateAutoHeight: updateAutoHeight,
updateSlidesOffset: updateSlidesOffset,
updateSlidesProgress: updateSlidesProgress,
updateProgress: updateProgress,
updateSlidesClasses: updateSlidesClasses,
updateActiveIndex: updateActiveIndex,
updateClickedSlide: updateClickedSlide
};

function getSwiperTranslate() {
var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.isHorizontal() ? 'x' : 'y';
var swiper = this;
var params = swiper.params,
rtl = swiper.rtlTranslate,
translate = swiper.translate,
$wrapperEl = swiper.$wrapperEl;

if (params.virtualTranslate) {
return rtl ? -translate : translate;
}

if (params.cssMode) {
return translate;
}

var currentTranslate = getTranslate($wrapperEl[0], axis);
if (rtl) currentTranslate = -currentTranslate;
return currentTranslate || 0;
}

function setTranslate(translate, byController) {
var swiper = this;
var rtl = swiper.rtlTranslate,
params = swiper.params,
$wrapperEl = swiper.$wrapperEl,
wrapperEl = swiper.wrapperEl,
progress = swiper.progress;
var x = 0;
var y = 0;
var z = 0;

if (swiper.isHorizontal()) {
x = rtl ? -translate : translate;
} else {
y = translate;
}

if (params.roundLengths) {
x = Math.floor(x);
y = Math.floor(y);
}

if (params.cssMode) {
wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
} else if (!params.virtualTranslate) {
$wrapperEl.transform("translate3d(".concat(x, "px, ").concat(y, "px, ").concat(z, "px)"));
}

swiper.previousTranslate = swiper.translate;
swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress

var newProgress;
var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();

if (translatesDiff === 0) {
newProgress = 0;
} else {
newProgress = (translate - swiper.minTranslate()) / translatesDiff;
}

if (newProgress !== progress) {
swiper.updateProgress(translate);
}

swiper.emit('setTranslate', swiper.translate, byController);
}

function minTranslate() {
return -this.snapGrid[0];
}

function maxTranslate() {
return -this.snapGrid[this.snapGrid.length - 1];
}

function translateTo() {
var translate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var speed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.params.speed;
var runCallbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var translateBounds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
var internal = arguments.length > 4 ? arguments[4] : undefined;
var swiper = this;
var params = swiper.params,
wrapperEl = swiper.wrapperEl;

if (swiper.animating && params.preventInteractionOnTransition) {
return false;
}

var minTranslate = swiper.minTranslate();
var maxTranslate = swiper.maxTranslate();
var newTranslate;
if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress

swiper.updateProgress(newTranslate);

if (params.cssMode) {
var isH = swiper.isHorizontal();

if (speed === 0) {
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
} else {
var _wrapperEl$scrollTo;

if (!swiper.support.smoothScroll) {
animateCSSModeScroll({
swiper: swiper,
targetPosition: -newTranslate,
side: isH ? 'left' : 'top'
});
return true;
}

wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _defineProperty(_wrapperEl$scrollTo, isH ? 'left' : 'top', -newTranslate), _defineProperty(_wrapperEl$scrollTo, "behavior", 'smooth'), _wrapperEl$scrollTo));
}

return true;
}

if (speed === 0) {
swiper.setTransition(0);
swiper.setTranslate(newTranslate);

if (runCallbacks) {
swiper.emit('beforeTransitionStart', speed, internal);
swiper.emit('transitionEnd');
}
} else {
swiper.setTransition(speed);
swiper.setTranslate(newTranslate);

if (runCallbacks) {
swiper.emit('beforeTransitionStart', speed, internal);
swiper.emit('transitionStart');
}

if (!swiper.animating) {
swiper.animating = true;

if (!swiper.onTranslateToWrapperTransitionEnd) {
swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
if (!swiper || swiper.destroyed) return;
if (e.target !== this) return;
swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
swiper.onTranslateToWrapperTransitionEnd = null;
delete swiper.onTranslateToWrapperTransitionEnd;

if (runCallbacks) {
swiper.emit('transitionEnd');
}
};
}

swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
}
}

return true;
}

var translate = {
getTranslate: getSwiperTranslate,
setTranslate: setTranslate,
minTranslate: minTranslate,
maxTranslate: maxTranslate,
translateTo: translateTo
};

function setTransition(duration, byController) {
var swiper = this;

if (!swiper.params.cssMode) {
swiper.$wrapperEl.transition(duration);
}

swiper.emit('setTransition', duration, byController);
}

function transitionEmit(_ref) {
var swiper = _ref.swiper,
runCallbacks = _ref.runCallbacks,
direction = _ref.direction,
step = _ref.step;
var activeIndex = swiper.activeIndex,
previousIndex = swiper.previousIndex;
var dir = direction;

if (!dir) {
if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
}

swiper.emit("transition".concat(step));

if (runCallbacks && activeIndex !== previousIndex) {
if (dir === 'reset') {
swiper.emit("slideResetTransition".concat(step));
return;
}

swiper.emit("slideChangeTransition".concat(step));

if (dir === 'next') {
swiper.emit("slideNextTransition".concat(step));
} else {
swiper.emit("slidePrevTransition".concat(step));
}
}
}

function transitionStart() {
var runCallbacks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var direction = arguments.length > 1 ? arguments[1] : undefined;
var swiper = this;
var params = swiper.params;
if (params.cssMode) return;

if (params.autoHeight) {
swiper.updateAutoHeight();
}

transitionEmit({
swiper: swiper,
runCallbacks: runCallbacks,
direction: direction,
step: 'Start'
});
}

function transitionEnd() {
var runCallbacks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var direction = arguments.length > 1 ? arguments[1] : undefined;
var swiper = this;
var params = swiper.params;
swiper.animating = false;
if (params.cssMode) return;
swiper.setTransition(0);
transitionEmit({
swiper: swiper,
runCallbacks: runCallbacks,
direction: direction,
step: 'End'
});
}

var transition = {
setTransition: setTransition,
transitionStart: transitionStart,
transitionEnd: transitionEnd
};

function slideTo() {
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var speed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.params.speed;
var runCallbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var internal = arguments.length > 3 ? arguments[3] : undefined;
var initial = arguments.length > 4 ? arguments[4] : undefined;

if (typeof index !== 'number' && typeof index !== 'string') {
throw new Error("The 'index' argument cannot have type other than 'number' or 'string'. [".concat(_typeof(index), "] given."));
}

if (typeof index === 'string') {
/**
* The `index` argument converted from `string` to `number`.
* @type {number}
*/
var indexAsNumber = parseInt(index, 10);
/**
* Determines whether the `index` argument is a valid `number`
* after being converted from the `string` type.
* @type {boolean}
*/

var isValidNumber = isFinite(indexAsNumber);

if (!isValidNumber) {
throw new Error("The passed-in 'index' (string) couldn't be converted to 'number'. [".concat(index, "] given."));
} // Knowing that the converted `index` is a valid number,
// we can update the original argument's value.


index = indexAsNumber;
}

var swiper = this;
var slideIndex = index;
if (slideIndex < 0) slideIndex = 0;
var params = swiper.params,
snapGrid = swiper.snapGrid,
slidesGrid = swiper.slidesGrid,
previousIndex = swiper.previousIndex,
activeIndex = swiper.activeIndex,
rtl = swiper.rtlTranslate,
wrapperEl = swiper.wrapperEl,
enabled = swiper.enabled;

if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
return false;
}

var skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
var snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;

if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) {
swiper.emit('beforeSlideChangeStart');
}

var translate = -snapGrid[snapIndex]; // Update progress

swiper.updateProgress(translate); // Normalize slideIndex

if (params.normalizeSlideIndex) {
for (var i = 0; i < slidesGrid.length; i += 1) {
var normalizedTranslate = -Math.floor(translate * 100);
var normalizedGrid = Math.floor(slidesGrid[i] * 100);
var normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);

if (typeof slidesGrid[i + 1] !== 'undefined') {
if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {
slideIndex = i;
} else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {
slideIndex = i + 1;
}
} else if (normalizedTranslate >= normalizedGrid) {
slideIndex = i;
}
}
} // Directions locks


if (swiper.initialized && slideIndex !== activeIndex) {
if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
return false;
}

if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
if ((activeIndex || 0) !== slideIndex) return false;
}
}

var direction;
if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index

if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
swiper.updateActiveIndex(slideIndex); // Update Height

if (params.autoHeight) {
swiper.updateAutoHeight();
}

swiper.updateSlidesClasses();

if (params.effect !== 'slide') {
swiper.setTranslate(translate);
}

if (direction !== 'reset') {
swiper.transitionStart(runCallbacks, direction);
swiper.transitionEnd(runCallbacks, direction);
}

return false;
}

if (params.cssMode) {
var isH = swiper.isHorizontal();
var t = rtl ? translate : -translate;

if (speed === 0) {
var isVirtual = swiper.virtual && swiper.params.virtual.enabled;

if (isVirtual) {
swiper.wrapperEl.style.scrollSnapType = 'none';
}

wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;

if (isVirtual) {
requestAnimationFrame(function () {
swiper.wrapperEl.style.scrollSnapType = '';
});
}
} else {
var _wrapperEl$scrollTo;

if (!swiper.support.smoothScroll) {
animateCSSModeScroll({
swiper: swiper,
targetPosition: t,
side: isH ? 'left' : 'top'
});
return true;
}

wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _defineProperty(_wrapperEl$scrollTo, isH ? 'left' : 'top', t), _defineProperty(_wrapperEl$scrollTo, "behavior", 'smooth'), _wrapperEl$scrollTo));
}

return true;
}

if (speed === 0) {
swiper.setTransition(0);
swiper.setTranslate(translate);
swiper.updateActiveIndex(slideIndex);
swiper.updateSlidesClasses();
swiper.emit('beforeTransitionStart', speed, internal);
swiper.transitionStart(runCallbacks, direction);
swiper.transitionEnd(runCallbacks, direction);
} else {
swiper.setTransition(speed);
swiper.setTranslate(translate);
swiper.updateActiveIndex(slideIndex);
swiper.updateSlidesClasses();
swiper.emit('beforeTransitionStart', speed, internal);
swiper.transitionStart(runCallbacks, direction);

if (!swiper.animating) {
swiper.animating = true;

if (!swiper.onSlideToWrapperTransitionEnd) {
swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
if (!swiper || swiper.destroyed) return;
if (e.target !== this) return;
swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
swiper.onSlideToWrapperTransitionEnd = null;
delete swiper.onSlideToWrapperTransitionEnd;
swiper.transitionEnd(runCallbacks, direction);
};
}

swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
}
}

return true;
}

function slideToLoop() {
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var speed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.params.speed;
var runCallbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var internal = arguments.length > 3 ? arguments[3] : undefined;
var swiper = this;
var newIndex = index;

if (swiper.params.loop) {
newIndex += swiper.loopedSlides;
}

return swiper.slideTo(newIndex, speed, runCallbacks, internal);
}

/* eslint no-unused-vars: "off" */
function slideNext() {
var speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.params.speed;
var runCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var internal = arguments.length > 2 ? arguments[2] : undefined;
var swiper = this;
var animating = swiper.animating,
enabled = swiper.enabled,
params = swiper.params;
if (!enabled) return swiper;
var perGroup = params.slidesPerGroup;

if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
}

var increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;

if (params.loop) {
if (animating && params.loopPreventsSlide) return false;
swiper.loopFix(); // eslint-disable-next-line

swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
}

return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
}

/* eslint no-unused-vars: "off" */
function slidePrev() {
var speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.params.speed;
var runCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var internal = arguments.length > 2 ? arguments[2] : undefined;
var swiper = this;
var params = swiper.params,
animating = swiper.animating,
snapGrid = swiper.snapGrid,
slidesGrid = swiper.slidesGrid,
rtlTranslate = swiper.rtlTranslate,
enabled = swiper.enabled;
if (!enabled) return swiper;

if (params.loop) {
if (animating && params.loopPreventsSlide) return false;
swiper.loopFix(); // eslint-disable-next-line

swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
}

var translate = rtlTranslate ? swiper.translate : -swiper.translate;

function normalize(val) {
if (val < 0) return -Math.floor(Math.abs(val));
return Math.floor(val);
}

var normalizedTranslate = normalize(translate);
var normalizedSnapGrid = snapGrid.map(function (val) {
return normalize(val);
});
var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];

if (typeof prevSnap === 'undefined' && params.cssMode) {
var prevSnapIndex;
snapGrid.forEach(function (snap, snapIndex) {
if (normalizedTranslate >= snap) {
// prevSnap = snap;
prevSnapIndex = snapIndex;
}
});

if (typeof prevSnapIndex !== 'undefined') {
prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
}
}

var prevIndex = 0;

if (typeof prevSnap !== 'undefined') {
prevIndex = slidesGrid.indexOf(prevSnap);
if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;

if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
prevIndex = Math.max(prevIndex, 0);
}
}

return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
}

/* eslint no-unused-vars: "off" */
function slideReset() {
var speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.params.speed;
var runCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var internal = arguments.length > 2 ? arguments[2] : undefined;
var swiper = this;
return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
}

/* eslint no-unused-vars: "off" */
function slideToClosest() {
var speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.params.speed;
var runCallbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var internal = arguments.length > 2 ? arguments[2] : undefined;
var threshold = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.5;
var swiper = this;
var index = swiper.activeIndex;
var skip = Math.min(swiper.params.slidesPerGroupSkip, index);
var snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;

if (translate >= swiper.snapGrid[snapIndex]) {
// The current translate is on or after the current snap index, so the choice
// is between the current index and the one after it.
var currentSnap = swiper.snapGrid[snapIndex];
var nextSnap = swiper.snapGrid[snapIndex + 1];

if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
index += swiper.params.slidesPerGroup;
}
} else {
// The current translate is before the current snap index, so the choice
// is between the current index and the one before it.
var prevSnap = swiper.snapGrid[snapIndex - 1];
var _currentSnap = swiper.snapGrid[snapIndex];

if (translate - prevSnap <= (_currentSnap - prevSnap) * threshold) {
index -= swiper.params.slidesPerGroup;
}
}

index = Math.max(index, 0);
index = Math.min(index, swiper.slidesGrid.length - 1);
return swiper.slideTo(index, speed, runCallbacks, internal);
}

function slideToClickedSlide() {
var swiper = this;
var params = swiper.params,
$wrapperEl = swiper.$wrapperEl;
var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
var slideToIndex = swiper.clickedIndex;
var realIndex;

if (params.loop) {
if (swiper.animating) return;
realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);

if (params.centeredSlides) {
if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
swiper.loopFix();
slideToIndex = $wrapperEl.children(".".concat(params.slideClass, "[data-swiper-slide-index=\"").concat(realIndex, "\"]:not(.").concat(params.slideDuplicateClass, ")")).eq(0).index();
nextTick(function () {
swiper.slideTo(slideToIndex);
});
} else {
swiper.slideTo(slideToIndex);
}
} else if (slideToIndex > swiper.slides.length - slidesPerView) {
swiper.loopFix();
slideToIndex = $wrapperEl.children(".".concat(params.slideClass, "[data-swiper-slide-index=\"").concat(realIndex, "\"]:not(.").concat(params.slideDuplicateClass, ")")).eq(0).index();
nextTick(function () {
swiper.slideTo(slideToIndex);
});
} else {
swiper.slideTo(slideToIndex);
}
} else {
swiper.slideTo(slideToIndex);
}
}

var slide = {
slideTo: slideTo,
slideToLoop: slideToLoop,
slideNext: slideNext,
slidePrev: slidePrev,
slideReset: slideReset,
slideToClosest: slideToClosest,
slideToClickedSlide: slideToClickedSlide
};

function loopCreate() {
var swiper = this;
var document = getDocument();
var params = swiper.params,
$wrapperEl = swiper.$wrapperEl; // Remove duplicated slides

$wrapperEl.children(".".concat(params.slideClass, ".").concat(params.slideDuplicateClass)).remove();
var slides = $wrapperEl.children(".".concat(params.slideClass));

if (params.loopFillGroupWithBlank) {
var blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;

if (blankSlidesNum !== params.slidesPerGroup) {
for (var i = 0; i < blankSlidesNum; i += 1) {
var blankNode = $(document.createElement('div')).addClass("".concat(params.slideClass, " ").concat(params.slideBlankClass));
$wrapperEl.append(blankNode);
}

slides = $wrapperEl.children(".".concat(params.slideClass));
}
}

if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;
swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));
swiper.loopedSlides += params.loopAdditionalSlides;

if (swiper.loopedSlides > slides.length) {
swiper.loopedSlides = slides.length;
}

var prependSlides = [];
var appendSlides = [];
slides.each(function (el, index) {
var slide = $(el);

if (index < swiper.loopedSlides) {
appendSlides.push(el);
}

if (index < slides.length && index >= slides.length - swiper.loopedSlides) {
prependSlides.push(el);
}

slide.attr('data-swiper-slide-index', index);
});

for (var _i = 0; _i < appendSlides.length; _i += 1) {
$wrapperEl.append($(appendSlides[_i].cloneNode(true)).addClass(params.slideDuplicateClass));
}

for (var _i2 = prependSlides.length - 1; _i2 >= 0; _i2 -= 1) {
$wrapperEl.prepend($(prependSlides[_i2].cloneNode(true)).addClass(params.slideDuplicateClass));
}
}

function loopFix() {
var swiper = this;
swiper.emit('beforeLoopFix');
var activeIndex = swiper.activeIndex,
slides = swiper.slides,
loopedSlides = swiper.loopedSlides,
allowSlidePrev = swiper.allowSlidePrev,
allowSlideNext = swiper.allowSlideNext,
snapGrid = swiper.snapGrid,
rtl = swiper.rtlTranslate;
var newIndex;
swiper.allowSlidePrev = true;
swiper.allowSlideNext = true;
var snapTranslate = -snapGrid[activeIndex];
var diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding

if (activeIndex < loopedSlides) {
newIndex = slides.length - loopedSlides * 3 + activeIndex;
newIndex += loopedSlides;
var slideChanged = swiper.slideTo(newIndex, 0, false, true);

if (slideChanged && diff !== 0) {
swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
}
} else if (activeIndex >= slides.length - loopedSlides) {
// Fix For Positive Oversliding
newIndex = -slides.length + activeIndex + loopedSlides;
newIndex += loopedSlides;

var _slideChanged = swiper.slideTo(newIndex, 0, false, true);

if (_slideChanged && diff !== 0) {
swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
}
}

swiper.allowSlidePrev = allowSlidePrev;
swiper.allowSlideNext = allowSlideNext;
swiper.emit('loopFix');
}

function loopDestroy() {
var swiper = this;
var $wrapperEl = swiper.$wrapperEl,
params = swiper.params,
slides = swiper.slides;
$wrapperEl.children(".".concat(params.slideClass, ".").concat(params.slideDuplicateClass, ",.").concat(params.slideClass, ".").concat(params.slideBlankClass)).remove();
slides.removeAttr('data-swiper-slide-index');
}

var loop = {
loopCreate: loopCreate,
loopFix: loopFix,
loopDestroy: loopDestroy
};

function setGrabCursor(moving) {
var swiper = this;
if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
var el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
el.style.cursor = 'move';
el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
el.style.cursor = moving ? 'grabbing' : 'grab';
}

function unsetGrabCursor() {
var swiper = this;

if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
return;
}

swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
}

var grabCursor = {
setGrabCursor: setGrabCursor,
unsetGrabCursor: unsetGrabCursor
};

function closestElement(selector) {
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;

function __closestFrom(el) {
if (!el || el === getDocument() || el === getWindow()) return null;
if (el.assignedSlot) el = el.assignedSlot;
var found = el.closest(selector);
return found || __closestFrom(el.getRootNode().host);
}

return __closestFrom(base);
}

function onTouchStart(event) {
var swiper = this;
var document = getDocument();
var window = getWindow();
var data = swiper.touchEventsData;
var params = swiper.params,
touches = swiper.touches,
enabled = swiper.enabled;
if (!enabled) return;

if (swiper.animating && params.preventInteractionOnTransition) {
return;
}

if (!swiper.animating && params.cssMode && params.loop) {
swiper.loopFix();
}

var e = event;
if (e.originalEvent) e = e.originalEvent;
var $targetEl = $(e.target);

if (params.touchEventsTarget === 'wrapper') {
if (!$targetEl.closest(swiper.wrapperEl).length) return;
}

data.isTouchEvent = e.type === 'touchstart';
if (!data.isTouchEvent && 'which' in e && e.which === 3) return;
if (!data.isTouchEvent && 'button' in e && e.button > 0) return;
if (data.isTouched && data.isMoved) return; // change target el for shadow root component

var swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';

if (swipingClassHasValue && e.target && e.target.shadowRoot && event.path && event.path[0]) {
$targetEl = $(event.path[0]);
}

var noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : ".".concat(params.noSwipingClass);
var isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element

if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, e.target) : $targetEl.closest(noSwipingSelector)[0])) {
swiper.allowClick = true;
return;
}

if (params.swipeHandler) {
if (!$targetEl.closest(params.swipeHandler)[0]) return;
}

touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
var startX = touches.currentX;
var startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore

var edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
var edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;

if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
if (edgeSwipeDetection === 'prevent') {
event.preventDefault();
} else {
return;
}
}

Object.assign(data, {
isTouched: true,
isMoved: false,
allowTouchCallbacks: true,
isScrolling: undefined,
startMoving: undefined
});
touches.startX = startX;
touches.startY = startY;
data.touchStartTime = now();
swiper.allowClick = true;
swiper.updateSize();
swiper.swipeDirection = undefined;
if (params.threshold > 0) data.allowThresholdMove = false;

if (e.type !== 'touchstart') {
var preventDefault = true;
if ($targetEl.is(data.focusableElements)) preventDefault = false;

if (document.activeElement && $(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) {
document.activeElement.blur();
}

var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;

if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) {
e.preventDefault();
}
}

swiper.emit('touchStart', e);
}

function onTouchMove(event) {
var document = getDocument();
var swiper = this;
var data = swiper.touchEventsData;
var params = swiper.params,
touches = swiper.touches,
rtl = swiper.rtlTranslate,
enabled = swiper.enabled;
if (!enabled) return;
var e = event;
if (e.originalEvent) e = e.originalEvent;

if (!data.isTouched) {
if (data.startMoving && data.isScrolling) {
swiper.emit('touchMoveOpposite', e);
}

return;
}

if (data.isTouchEvent && e.type !== 'touchmove') return;
var targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);
var pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;
var pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;

if (e.preventedByNestedSwiper) {
touches.startX = pageX;
touches.startY = pageY;
return;
}

if (!swiper.allowTouchMove) {
// isMoved = true;
swiper.allowClick = false;

if (data.isTouched) {
Object.assign(touches, {
startX: pageX,
startY: pageY,
currentX: pageX,
currentY: pageY
});
data.touchStartTime = now();
}

return;
}

if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
if (swiper.isVertical()) {
// Vertical
if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
data.isTouched = false;
data.isMoved = false;
return;
}
} else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
return;
}
}

if (data.isTouchEvent && document.activeElement) {
if (e.target === document.activeElement && $(e.target).is(data.focusableElements)) {
data.isMoved = true;
swiper.allowClick = false;
return;
}
}

if (data.allowTouchCallbacks) {
swiper.emit('touchMove', e);
}

if (e.targetTouches && e.targetTouches.length > 1) return;
touches.currentX = pageX;
touches.currentY = pageY;
var diffX = touches.currentX - touches.startX;
var diffY = touches.currentY - touches.startY;
if (swiper.params.threshold && Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2)) < swiper.params.threshold) return;

if (typeof data.isScrolling === 'undefined') {
var touchAngle;

if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
data.isScrolling = false;
} else {
// eslint-disable-next-line
if (diffX * diffX + diffY * diffY >= 25) {
touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
}
}
}

if (data.isScrolling) {
swiper.emit('touchMoveOpposite', e);
}

if (typeof data.startMoving === 'undefined') {
if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
data.startMoving = true;
}
}

if (data.isScrolling) {
data.isTouched = false;
return;
}

if (!data.startMoving) {
return;
}

swiper.allowClick = false;

if (!params.cssMode && e.cancelable) {
e.preventDefault();
}

if (params.touchMoveStopPropagation && !params.nested) {
e.stopPropagation();
}

if (!data.isMoved) {
if (params.loop && !params.cssMode) {
swiper.loopFix();
}

data.startTranslate = swiper.getTranslate();
swiper.setTransition(0);

if (swiper.animating) {
swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
}

data.allowMomentumBounce = false; // Grab Cursor

if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
swiper.setGrabCursor(true);
}

swiper.emit('sliderFirstMove', e);
}

swiper.emit('sliderMove', e);
data.isMoved = true;
var diff = swiper.isHorizontal() ? diffX : diffY;
touches.diff = diff;
diff *= params.touchRatio;
if (rtl) diff = -diff;
swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
data.currentTranslate = diff + data.startTranslate;
var disableParentSwiper = true;
var resistanceRatio = params.resistanceRatio;

if (params.touchReleaseOnEdges) {
resistanceRatio = 0;
}

if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {
disableParentSwiper = false;
if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + Math.pow(-swiper.minTranslate() + data.startTranslate + diff, resistanceRatio);
} else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
disableParentSwiper = false;
if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - Math.pow(swiper.maxTranslate() - data.startTranslate - diff, resistanceRatio);
}

if (disableParentSwiper) {
e.preventedByNestedSwiper = true;
} // Directions locks


if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
data.currentTranslate = data.startTranslate;
}

if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
data.currentTranslate = data.startTranslate;
}

if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
data.currentTranslate = data.startTranslate;
} // Threshold


if (params.threshold > 0) {
if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
if (!data.allowThresholdMove) {
data.allowThresholdMove = true;
touches.startX = touches.currentX;
touches.startY = touches.currentY;
data.currentTranslate = data.startTranslate;
touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
return;
}
} else {
data.currentTranslate = data.startTranslate;
return;
}
}

if (!params.followFinger || params.cssMode) return; // Update active index in free mode

if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
}

if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) {
swiper.freeMode.onTouchMove();
} // Update progress


swiper.updateProgress(data.currentTranslate); // Update translate

swiper.setTranslate(data.currentTranslate);
}

function onTouchEnd(event) {
var swiper = this;
var data = swiper.touchEventsData;
var params = swiper.params,
touches = swiper.touches,
rtl = swiper.rtlTranslate,
slidesGrid = swiper.slidesGrid,
enabled = swiper.enabled;
if (!enabled) return;
var e = event;
if (e.originalEvent) e = e.originalEvent;

if (data.allowTouchCallbacks) {
swiper.emit('touchEnd', e);
}

data.allowTouchCallbacks = false;

if (!data.isTouched) {
if (data.isMoved && params.grabCursor) {
swiper.setGrabCursor(false);
}

data.isMoved = false;
data.startMoving = false;
return;
} // Return Grab Cursor


if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
swiper.setGrabCursor(false);
} // Time diff


var touchEndTime = now();
var timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click

if (swiper.allowClick) {
swiper.updateClickedSlide(e);
swiper.emit('tap click', e);

if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
swiper.emit('doubleTap doubleClick', e);
}
}

data.lastClickTime = now();
nextTick(function () {
if (!swiper.destroyed) swiper.allowClick = true;
});

if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
data.isTouched = false;
data.isMoved = false;
data.startMoving = false;
return;
}

data.isTouched = false;
data.isMoved = false;
data.startMoving = false;
var currentPos;

if (params.followFinger) {
currentPos = rtl ? swiper.translate : -swiper.translate;
} else {
currentPos = -data.currentTranslate;
}

if (params.cssMode) {
return;
}

if (swiper.params.freeMode && params.freeMode.enabled) {
swiper.freeMode.onTouchEnd({
currentPos: currentPos
});
return;
} // Find current slide


var stopIndex = 0;
var groupSize = swiper.slidesSizesGrid[0];

for (var i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
var _increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;

if (typeof slidesGrid[i + _increment] !== 'undefined') {
if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + _increment]) {
stopIndex = i;
groupSize = slidesGrid[i + _increment] - slidesGrid[i];
}
} else if (currentPos >= slidesGrid[i]) {
stopIndex = i;
groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
}
} // Find current slide size


var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
var increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;

if (timeDiff > params.longSwipesMs) {
// Long touches
if (!params.longSwipes) {
swiper.slideTo(swiper.activeIndex);
return;
}

if (swiper.swipeDirection === 'next') {
if (ratio >= params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);
}

if (swiper.swipeDirection === 'prev') {
if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);
}
} else {
// Short swipes
if (!params.shortSwipes) {
swiper.slideTo(swiper.activeIndex);
return;
}

var isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);

if (!isNavButtonTarget) {
if (swiper.swipeDirection === 'next') {
swiper.slideTo(stopIndex + increment);
}

if (swiper.swipeDirection === 'prev') {
swiper.slideTo(stopIndex);
}
} else if (e.target === swiper.navigation.nextEl) {
swiper.slideTo(stopIndex + increment);
} else {
swiper.slideTo(stopIndex);
}
}
}

function onResize() {
var swiper = this;
var params = swiper.params,
el = swiper.el;
if (el && el.offsetWidth === 0) return; // Breakpoints

if (params.breakpoints) {
swiper.setBreakpoint();
} // Save locks


var allowSlideNext = swiper.allowSlideNext,
allowSlidePrev = swiper.allowSlidePrev,
snapGrid = swiper.snapGrid; // Disable locks on resize

swiper.allowSlideNext = true;
swiper.allowSlidePrev = true;
swiper.updateSize();
swiper.updateSlides();
swiper.updateSlidesClasses();

if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
swiper.slideTo(swiper.slides.length - 1, 0, false, true);
} else {
swiper.slideTo(swiper.activeIndex, 0, false, true);
}

if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
swiper.autoplay.run();
} // Return locks after resize


swiper.allowSlidePrev = allowSlidePrev;
swiper.allowSlideNext = allowSlideNext;

if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
swiper.checkOverflow();
}
}

function onClick(e) {
var swiper = this;
if (!swiper.enabled) return;

if (!swiper.allowClick) {
if (swiper.params.preventClicks) e.preventDefault();

if (swiper.params.preventClicksPropagation && swiper.animating) {
e.stopPropagation();
e.stopImmediatePropagation();
}
}
}

function onScroll() {
var swiper = this;
var wrapperEl = swiper.wrapperEl,
rtlTranslate = swiper.rtlTranslate,
enabled = swiper.enabled;
if (!enabled) return;
swiper.previousTranslate = swiper.translate;

if (swiper.isHorizontal()) {
swiper.translate = -wrapperEl.scrollLeft;
} else {
swiper.translate = -wrapperEl.scrollTop;
} // eslint-disable-next-line


if (swiper.translate === -0) swiper.translate = 0;
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
var newProgress;
var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();

if (translatesDiff === 0) {
newProgress = 0;
} else {
newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
}

if (newProgress !== swiper.progress) {
swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
}

swiper.emit('setTranslate', swiper.translate, false);
}

var dummyEventAttached = false;

function dummyEventListener() {}

var events = function events(swiper, method) {
var document = getDocument();
var params = swiper.params,
touchEvents = swiper.touchEvents,
el = swiper.el,
wrapperEl = swiper.wrapperEl,
device = swiper.device,
support = swiper.support;
var capture = !!params.nested;
var domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
var swiperMethod = method; // Touch Events

if (!support.touch) {
el[domMethod](touchEvents.start, swiper.onTouchStart, false);
document[domMethod](touchEvents.move, swiper.onTouchMove, capture);
document[domMethod](touchEvents.end, swiper.onTouchEnd, false);
} else {
var passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {
passive: true,
capture: false
} : false;
el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener);
el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? {
passive: false,
capture: capture
} : capture);
el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener);

if (touchEvents.cancel) {
el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener);
}
} // Prevent Links Clicks


if (params.preventClicks || params.preventClicksPropagation) {
el[domMethod]('click', swiper.onClick, true);
}

if (params.cssMode) {
wrapperEl[domMethod]('scroll', swiper.onScroll);
} // Resize handler


if (params.updateOnWindowResize) {
swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
} else {
swiper[swiperMethod]('observerUpdate', onResize, true);
}
};

function attachEvents() {
var swiper = this;
var document = getDocument();
var params = swiper.params,
support = swiper.support;
swiper.onTouchStart = onTouchStart.bind(swiper);
swiper.onTouchMove = onTouchMove.bind(swiper);
swiper.onTouchEnd = onTouchEnd.bind(swiper);

if (params.cssMode) {
swiper.onScroll = onScroll.bind(swiper);
}

swiper.onClick = onClick.bind(swiper);

if (support.touch && !dummyEventAttached) {
document.addEventListener('touchstart', dummyEventListener);
dummyEventAttached = true;
}

events(swiper, 'on');
}

function detachEvents() {
var swiper = this;
events(swiper, 'off');
}

var events$1 = {
attachEvents: attachEvents,
detachEvents: detachEvents
};

var isGridEnabled = function isGridEnabled(swiper, params) {
return swiper.grid && params.grid && params.grid.rows > 1;
};

function setBreakpoint() {
var swiper = this;
var activeIndex = swiper.activeIndex,
initialized = swiper.initialized,
_swiper$loopedSlides = swiper.loopedSlides,
loopedSlides = _swiper$loopedSlides === void 0 ? 0 : _swiper$loopedSlides,
params = swiper.params,
$el = swiper.$el;
var breakpoints = params.breakpoints;
if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters

var breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
var breakpointParams = breakpointOnlyParams || swiper.originalParams;
var wasMultiRow = isGridEnabled(swiper, params);
var isMultiRow = isGridEnabled(swiper, breakpointParams);
var wasEnabled = params.enabled;

if (wasMultiRow && !isMultiRow) {
$el.removeClass("".concat(params.containerModifierClass, "grid ").concat(params.containerModifierClass, "grid-column"));
swiper.emitContainerClasses();
} else if (!wasMultiRow && isMultiRow) {
$el.addClass("".concat(params.containerModifierClass, "grid"));

if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
$el.addClass("".concat(params.containerModifierClass, "grid-column"));
}

swiper.emitContainerClasses();
}

var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);

if (directionChanged && initialized) {
swiper.changeDirection();
}

extend(swiper.params, breakpointParams);
var isEnabled = swiper.params.enabled;
Object.assign(swiper, {
allowTouchMove: swiper.params.allowTouchMove,
allowSlideNext: swiper.params.allowSlideNext,
allowSlidePrev: swiper.params.allowSlidePrev
});

if (wasEnabled && !isEnabled) {
swiper.disable();
} else if (!wasEnabled && isEnabled) {
swiper.enable();
}

swiper.currentBreakpoint = breakpoint;
swiper.emit('_beforeBreakpoint', breakpointParams);

if (needsReLoop && initialized) {
swiper.loopDestroy();
swiper.loopCreate();
swiper.updateSlides();
swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);
}

swiper.emit('breakpoint', breakpointParams);
}

function getBreakpoint(breakpoints) {
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'window';
var containerEl = arguments.length > 2 ? arguments[2] : undefined;
if (!breakpoints || base === 'container' && !containerEl) return undefined;
var breakpoint = false;
var window = getWindow();
var currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
var points = Object.keys(breakpoints).map(function (point) {
if (typeof point === 'string' && point.indexOf('@') === 0) {
var minRatio = parseFloat(point.substr(1));
var value = currentHeight * minRatio;
return {
value: value,
point: point
};
}

return {
value: point,
point: point
};
});
points.sort(function (a, b) {
return parseInt(a.value, 10) - parseInt(b.value, 10);
});

for (var i = 0; i < points.length; i += 1) {
var _points$i = points[i],
point = _points$i.point,
value = _points$i.value;

if (base === 'window') {
if (window.matchMedia("(min-width: ".concat(value, "px)")).matches) {
breakpoint = point;
}
} else if (value <= containerEl.clientWidth) {
breakpoint = point;
}
}

return breakpoint || 'max';
}

var breakpoints = {
setBreakpoint: setBreakpoint,
getBreakpoint: getBreakpoint
};

function prepareClasses(entries, prefix) {
var resultClasses = [];
entries.forEach(function (item) {
if (_typeof(item) === 'object') {
Object.keys(item).forEach(function (classNames) {
if (item[classNames]) {
resultClasses.push(prefix + classNames);
}
});
} else if (typeof item === 'string') {
resultClasses.push(prefix + item);
}
});
return resultClasses;
}

function addClasses() {
var swiper = this;
var classNames = swiper.classNames,
params = swiper.params,
rtl = swiper.rtl,
$el = swiper.$el,
device = swiper.device,
support = swiper.support; // prettier-ignore

var suffixes = prepareClasses(['initialized', params.direction, {
'pointer-events': !support.touch
}, {
'free-mode': swiper.params.freeMode && params.freeMode.enabled
}, {
'autoheight': params.autoHeight
}, {
'rtl': rtl
}, {
'grid': params.grid && params.grid.rows > 1
}, {
'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
}, {
'android': device.android
}, {
'ios': device.ios
}, {
'css-mode': params.cssMode
}, {
'centered': params.cssMode && params.centeredSlides
}], params.containerModifierClass);
classNames.push.apply(classNames, _toConsumableArray(suffixes));
$el.addClass(_toConsumableArray(classNames).join(' '));
swiper.emitContainerClasses();
}

function removeClasses() {
var swiper = this;
var $el = swiper.$el,
classNames = swiper.classNames;
$el.removeClass(classNames.join(' '));
swiper.emitContainerClasses();
}

var classes = {
addClasses: addClasses,
removeClasses: removeClasses
};

function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
var window = getWindow();
var image;

function onReady() {
if (callback) callback();
}

var isPicture = $(imageEl).parent('picture')[0];

if (!isPicture && (!imageEl.complete || !checkForComplete)) {
if (src) {
image = new window.Image();
image.onload = onReady;
image.onerror = onReady;

if (sizes) {
image.sizes = sizes;
}

if (srcset) {
image.srcset = srcset;
}

if (src) {
image.src = src;
}
} else {
onReady();
}
} else {
// image already loaded...
onReady();
}
}

function preloadImages() {
var swiper = this;
swiper.imagesToLoad = swiper.$el.find('img');

function onReady() {
if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;
if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;

if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
if (swiper.params.updateOnImagesReady) swiper.update();
swiper.emit('imagesReady');
}
}

for (var i = 0; i < swiper.imagesToLoad.length; i += 1) {
var imageEl = swiper.imagesToLoad[i];
swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);
}
}

var images = {
loadImage: loadImage,
preloadImages: preloadImages
};

function checkOverflow() {
var swiper = this;
var wasLocked = swiper.isLocked,
params = swiper.params;
var slidesOffsetBefore = params.slidesOffsetBefore;

if (slidesOffsetBefore) {
var lastSlideIndex = swiper.slides.length - 1;
var lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
swiper.isLocked = swiper.size > lastSlideRightEdge;
} else {
swiper.isLocked = swiper.snapGrid.length === 1;
}

if (params.allowSlideNext === true) {
swiper.allowSlideNext = !swiper.isLocked;
}

if (params.allowSlidePrev === true) {
swiper.allowSlidePrev = !swiper.isLocked;
}

if (wasLocked && wasLocked !== swiper.isLocked) {
swiper.isEnd = false;
}

if (wasLocked !== swiper.isLocked) {
swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
}
}

var checkOverflow$1 = {
checkOverflow: checkOverflow
};

var defaults = {
init: true,
direction: 'horizontal',
touchEventsTarget: 'wrapper',
initialSlide: 0,
speed: 300,
cssMode: false,
updateOnWindowResize: true,
resizeObserver: true,
nested: false,
createElements: false,
enabled: true,
focusableElements: 'input, select, option, textarea, button, video, label',
// Overrides
width: null,
height: null,
//
preventInteractionOnTransition: false,
// ssr
userAgent: null,
url: null,
// To support iOS's swipe-to-go-back gesture (when being used in-app).
edgeSwipeDetection: false,
edgeSwipeThreshold: 20,
// Autoheight
autoHeight: false,
// Set wrapper width
setWrapperSize: false,
// Virtual Translate
virtualTranslate: false,
// Effects
effect: 'slide',
// 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
// Breakpoints
breakpoints: undefined,
breakpointsBase: 'window',
// Slides grid
spaceBetween: 0,
slidesPerView: 1,
slidesPerGroup: 1,
slidesPerGroupSkip: 0,
slidesPerGroupAuto: false,
centeredSlides: false,
centeredSlidesBounds: false,
slidesOffsetBefore: 0,
// in px
slidesOffsetAfter: 0,
// in px
normalizeSlideIndex: true,
centerInsufficientSlides: false,
// Disable swiper and hide navigation when container not overflow
watchOverflow: true,
// Round length
roundLengths: false,
// Touches
touchRatio: 1,
touchAngle: 45,
simulateTouch: true,
shortSwipes: true,
longSwipes: true,
longSwipesRatio: 0.5,
longSwipesMs: 300,
followFinger: true,
allowTouchMove: true,
threshold: 0,
touchMoveStopPropagation: false,
touchStartPreventDefault: true,
touchStartForcePreventDefault: false,
touchReleaseOnEdges: false,
// Unique Navigation Elements
uniqueNavElements: true,
// Resistance
resistance: true,
resistanceRatio: 0.85,
// Progress
watchSlidesProgress: false,
// Cursor
grabCursor: false,
// Clicks
preventClicks: true,
preventClicksPropagation: true,
slideToClickedSlide: false,
// Images
preloadImages: true,
updateOnImagesReady: true,
// loop
loop: false,
loopAdditionalSlides: 0,
loopedSlides: null,
loopFillGroupWithBlank: false,
loopPreventsSlide: true,
// Swiping/no swiping
allowSlidePrev: true,
allowSlideNext: true,
swipeHandler: null,
// '.swipe-handler',
noSwiping: true,
noSwipingClass: 'swiper-no-swiping',
noSwipingSelector: null,
// Passive Listeners
passiveListeners: true,
// NS
containerModifierClass: 'swiper-',
// NEW
slideClass: 'swiper-slide',
slideBlankClass: 'swiper-slide-invisible-blank',
slideActiveClass: 'swiper-slide-active',
slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
slideVisibleClass: 'swiper-slide-visible',
slideDuplicateClass: 'swiper-slide-duplicate',
slideNextClass: 'swiper-slide-next',
slideDuplicateNextClass: 'swiper-slide-duplicate-next',
slidePrevClass: 'swiper-slide-prev',
slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
wrapperClass: 'swiper-wrapper',
// Callbacks
runCallbacksOnInit: true,
// Internals
_emitClasses: false
};

function moduleExtendParams(params, allModulesParams) {
return function extendParams() {
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var moduleParamName = Object.keys(obj)[0];
var moduleParams = obj[moduleParamName];

if (_typeof(moduleParams) !== 'object' || moduleParams === null) {
extend(allModulesParams, obj);
return;
}

if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) {
params[moduleParamName] = {
auto: true
};
}

if (!(moduleParamName in params && 'enabled' in moduleParams)) {
extend(allModulesParams, obj);
return;
}

if (params[moduleParamName] === true) {
params[moduleParamName] = {
enabled: true
};
}

if (_typeof(params[moduleParamName]) === 'object' && !('enabled' in params[moduleParamName])) {
params[moduleParamName].enabled = true;
}

if (!params[moduleParamName]) params[moduleParamName] = {
enabled: false
};
extend(allModulesParams, obj);
};
}

var prototypes = {
eventsEmitter: eventsEmitter,
update: update,
translate: translate,
transition: transition,
slide: slide,
loop: loop,
grabCursor: grabCursor,
events: events$1,
breakpoints: breakpoints,
checkOverflow: checkOverflow$1,
classes: classes,
images: images
};
var extendedDefaults = {};

var Swiper = /*#__PURE__*/function () {
function Swiper() {
_classCallCheck(this, Swiper);

var el;
var params;

for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
params = args[0];
} else {
el = args[0];
params = args[1];
}

if (!params) params = {};
params = extend({}, params);
if (el && !params.el) params.el = el;

if (params.el && $(params.el).length > 1) {
var swipers = [];
$(params.el).each(function (containerEl) {
var newParams = extend({}, params, {
el: containerEl
});
swipers.push(new Swiper(newParams));
});
return swipers;
} // Swiper Instance


var swiper = this;
swiper.__swiper__ = true;
swiper.support = getSupport();
swiper.device = getDevice({
userAgent: params.userAgent
});
swiper.browser = getBrowser();
swiper.eventsListeners = {};
swiper.eventsAnyListeners = [];

if (typeof swiper.modules === 'undefined') {
swiper.modules = [];
}

if (params.modules && Array.isArray(params.modules)) {
var _swiper$modules;

(_swiper$modules = swiper.modules).push.apply(_swiper$modules, _toConsumableArray(params.modules));
}

var allModulesParams = {};
swiper.modules.forEach(function (mod) {
mod({
swiper: swiper,
extendParams: moduleExtendParams(params, allModulesParams),
on: swiper.on.bind(swiper),
once: swiper.once.bind(swiper),
off: swiper.off.bind(swiper),
emit: swiper.emit.bind(swiper)
});
}); // Extend defaults with modules params

var swiperParams = extend({}, defaults, allModulesParams); // Extend defaults with passed params

swiper.params = extend({}, swiperParams, extendedDefaults, params);
swiper.originalParams = extend({}, swiper.params);
swiper.passedParams = extend({}, params); // add event listeners

if (swiper.params && swiper.params.on) {
Object.keys(swiper.params.on).forEach(function (eventName) {
swiper.on(eventName, swiper.params.on[eventName]);
});
}

if (swiper.params && swiper.params.onAny) {
swiper.onAny(swiper.params.onAny);
} // Save Dom lib


swiper.$ = $; // Extend Swiper

Object.assign(swiper, {
enabled: swiper.params.enabled,
el: el,
// Classes
classNames: [],
// Slides
slides: $(),
slidesGrid: [],
snapGrid: [],
slidesSizesGrid: [],
// isDirection
isHorizontal: function isHorizontal() {
return swiper.params.direction === 'horizontal';
},
isVertical: function isVertical() {
return swiper.params.direction === 'vertical';
},
// Indexes
activeIndex: 0,
realIndex: 0,
//
isBeginning: true,
isEnd: false,
// Props
translate: 0,
previousTranslate: 0,
progress: 0,
velocity: 0,
animating: false,
// Locks
allowSlideNext: swiper.params.allowSlideNext,
allowSlidePrev: swiper.params.allowSlidePrev,
// Touch Events
touchEvents: function touchEvents() {
var touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
var desktop = ['pointerdown', 'pointermove', 'pointerup'];
swiper.touchEventsTouch = {
start: touch[0],
move: touch[1],
end: touch[2],
cancel: touch[3]
};
swiper.touchEventsDesktop = {
start: desktop[0],
move: desktop[1],
end: desktop[2]
};
return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;
}(),
touchEventsData: {
isTouched: undefined,
isMoved: undefined,
allowTouchCallbacks: undefined,
touchStartTime: undefined,
isScrolling: undefined,
currentTranslate: undefined,
startTranslate: undefined,
allowThresholdMove: undefined,
// Form elements to match
focusableElements: swiper.params.focusableElements,
// Last click time
lastClickTime: now(),
clickTimeout: undefined,
// Velocities
velocities: [],
allowMomentumBounce: undefined,
isTouchEvent: undefined,
startMoving: undefined
},
// Clicks
allowClick: true,
// Touches
allowTouchMove: swiper.params.allowTouchMove,
touches: {
startX: 0,
startY: 0,
currentX: 0,
currentY: 0,
diff: 0
},
// Images
imagesToLoad: [],
imagesLoaded: 0
});
swiper.emit('_swiper'); // Init

if (swiper.params.init) {
swiper.init();
} // Return app instance


return swiper;
}

_createClass(Swiper, [{
key: "enable",
value: function enable() {
var swiper = this;
if (swiper.enabled) return;
swiper.enabled = true;

if (swiper.params.grabCursor) {
swiper.setGrabCursor();
}

swiper.emit('enable');
}
}, {
key: "disable",
value: function disable() {
var swiper = this;
if (!swiper.enabled) return;
swiper.enabled = false;

if (swiper.params.grabCursor) {
swiper.unsetGrabCursor();
}

swiper.emit('disable');
}
}, {
key: "setProgress",
value: function setProgress(progress, speed) {
var swiper = this;
progress = Math.min(Math.max(progress, 0), 1);
var min = swiper.minTranslate();
var max = swiper.maxTranslate();
var current = (max - min) * progress + min;
swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
}
}, {
key: "emitContainerClasses",
value: function emitContainerClasses() {
var swiper = this;
if (!swiper.params._emitClasses || !swiper.el) return;
var cls = swiper.el.className.split(' ').filter(function (className) {
return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
});
swiper.emit('_containerClasses', cls.join(' '));
}
}, {
key: "getSlideClasses",
value: function getSlideClasses(slideEl) {
var swiper = this;
return slideEl.className.split(' ').filter(function (className) {
return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
}).join(' ');
}
}, {
key: "emitSlidesClasses",
value: function emitSlidesClasses() {
var swiper = this;
if (!swiper.params._emitClasses || !swiper.el) return;
var updates = [];
swiper.slides.each(function (slideEl) {
var classNames = swiper.getSlideClasses(slideEl);
updates.push({
slideEl: slideEl,
classNames: classNames
});
swiper.emit('_slideClass', slideEl, classNames);
});
swiper.emit('_slideClasses', updates);
}
}, {
key: "slidesPerViewDynamic",
value: function slidesPerViewDynamic() {
var view = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'current';
var exact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var swiper = this;
var params = swiper.params,
slides = swiper.slides,
slidesGrid = swiper.slidesGrid,
slidesSizesGrid = swiper.slidesSizesGrid,
swiperSize = swiper.size,
activeIndex = swiper.activeIndex;
var spv = 1;

if (params.centeredSlides) {
var slideSize = slides[activeIndex].swiperSlideSize;
var breakLoop;

for (var i = activeIndex + 1; i < slides.length; i += 1) {
if (slides[i] && !breakLoop) {
slideSize += slides[i].swiperSlideSize;
spv += 1;
if (slideSize > swiperSize) breakLoop = true;
}
}

for (var _i = activeIndex - 1; _i >= 0; _i -= 1) {
if (slides[_i] && !breakLoop) {
slideSize += slides[_i].swiperSlideSize;
spv += 1;
if (slideSize > swiperSize) breakLoop = true;
}
}
} else {
// eslint-disable-next-line
if (view === 'current') {
for (var _i2 = activeIndex + 1; _i2 < slides.length; _i2 += 1) {
var slideInView = exact ? slidesGrid[_i2] + slidesSizesGrid[_i2] - slidesGrid[activeIndex] < swiperSize : slidesGrid[_i2] - slidesGrid[activeIndex] < swiperSize;

if (slideInView) {
spv += 1;
}
}
} else {
// previous
for (var _i3 = activeIndex - 1; _i3 >= 0; _i3 -= 1) {
var _slideInView = slidesGrid[activeIndex] - slidesGrid[_i3] < swiperSize;

if (_slideInView) {
spv += 1;
}
}
}
}

return spv;
}
}, {
key: "update",
value: function update() {
var swiper = this;
if (!swiper || swiper.destroyed) return;
var snapGrid = swiper.snapGrid,
params = swiper.params; // Breakpoints

if (params.breakpoints) {
swiper.setBreakpoint();
}

swiper.updateSize();
swiper.updateSlides();
swiper.updateProgress();
swiper.updateSlidesClasses();

function setTranslate() {
var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
swiper.setTranslate(newTranslate);
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
}

var translated;

if (swiper.params.freeMode && swiper.params.freeMode.enabled) {
setTranslate();

if (swiper.params.autoHeight) {
swiper.updateAutoHeight();
}
} else {
if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
} else {
translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
}

if (!translated) {
setTranslate();
}
}

if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
swiper.checkOverflow();
}

swiper.emit('update');
}
}, {
key: "changeDirection",
value: function changeDirection(newDirection) {
var needUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var swiper = this;
var currentDirection = swiper.params.direction;

if (!newDirection) {
// eslint-disable-next-line
newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
}

if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
return swiper;
}

swiper.$el.removeClass("".concat(swiper.params.containerModifierClass).concat(currentDirection)).addClass("".concat(swiper.params.containerModifierClass).concat(newDirection));
swiper.emitContainerClasses();
swiper.params.direction = newDirection;
swiper.slides.each(function (slideEl) {
if (newDirection === 'vertical') {
slideEl.style.width = '';
} else {
slideEl.style.height = '';
}
});
swiper.emit('changeDirection');
if (needUpdate) swiper.update();
return swiper;
}
}, {
key: "mount",
value: function mount(el) {
var swiper = this;
if (swiper.mounted) return true; // Find el

var $el = $(el || swiper.params.el);
el = $el[0];

if (!el) {
return false;
}

el.swiper = swiper;

var getWrapperSelector = function getWrapperSelector() {
return ".".concat((swiper.params.wrapperClass || '').trim().split(' ').join('.'));
};

var getWrapper = function getWrapper() {
if (el && el.shadowRoot && el.shadowRoot.querySelector) {
var res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items

res.children = function (options) {
return $el.children(options);
};

return res;
}

return $el.children(getWrapperSelector());
}; // Find Wrapper


var $wrapperEl = getWrapper();

if ($wrapperEl.length === 0 && swiper.params.createElements) {
var document = getDocument();
var wrapper = document.createElement('div');
$wrapperEl = $(wrapper);
wrapper.className = swiper.params.wrapperClass;
$el.append(wrapper);
$el.children(".".concat(swiper.params.slideClass)).each(function (slideEl) {
$wrapperEl.append(slideEl);
});
}

Object.assign(swiper, {
$el: $el,
el: el,
$wrapperEl: $wrapperEl,
wrapperEl: $wrapperEl[0],
mounted: true,
// RTL
rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl',
rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
wrongRTL: $wrapperEl.css('display') === '-webkit-box'
});
return true;
}
}, {
key: "init",
value: function init(el) {
var swiper = this;
if (swiper.initialized) return swiper;
var mounted = swiper.mount(el);
if (mounted === false) return swiper;
swiper.emit('beforeInit'); // Set breakpoint

if (swiper.params.breakpoints) {
swiper.setBreakpoint();
} // Add Classes


swiper.addClasses(); // Create loop

if (swiper.params.loop) {
swiper.loopCreate();
} // Update size


swiper.updateSize(); // Update slides

swiper.updateSlides();

if (swiper.params.watchOverflow) {
swiper.checkOverflow();
} // Set Grab Cursor


if (swiper.params.grabCursor && swiper.enabled) {
swiper.setGrabCursor();
}

if (swiper.params.preloadImages) {
swiper.preloadImages();
} // Slide To Initial Slide


if (swiper.params.loop) {
swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true);
} else {
swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
} // Attach events


swiper.attachEvents(); // Init Flag

swiper.initialized = true; // Emit

swiper.emit('init');
swiper.emit('afterInit');
return swiper;
}
}, {
key: "destroy",
value: function destroy() {
var deleteInstance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var cleanStyles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var swiper = this;
var params = swiper.params,
$el = swiper.$el,
$wrapperEl = swiper.$wrapperEl,
slides = swiper.slides;

if (typeof swiper.params === 'undefined' || swiper.destroyed) {
return null;
}

swiper.emit('beforeDestroy'); // Init Flag

swiper.initialized = false; // Detach events

swiper.detachEvents(); // Destroy loop

if (params.loop) {
swiper.loopDestroy();
} // Cleanup styles


if (cleanStyles) {
swiper.removeClasses();
$el.removeAttr('style');
$wrapperEl.removeAttr('style');

if (slides && slides.length) {
slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index');
}
}

swiper.emit('destroy'); // Detach emitter events

Object.keys(swiper.eventsListeners).forEach(function (eventName) {
swiper.off(eventName);
});

if (deleteInstance !== false) {
swiper.$el[0].swiper = null;
deleteProps(swiper);
}

swiper.destroyed = true;
return null;
}
}], [{
key: "extendDefaults",
value: function extendDefaults(newDefaults) {
extend(extendedDefaults, newDefaults);
}
}, {
key: "extendedDefaults",
get: function get() {
return extendedDefaults;
}
}, {
key: "defaults",
get: function get() {
return defaults;
}
}, {
key: "installModule",
value: function installModule(mod) {
if (!Swiper.prototype.modules) Swiper.prototype.modules = [];
var modules = Swiper.prototype.modules;

if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
modules.push(mod);
}
}
}, {
key: "use",
value: function use(module) {
if (Array.isArray(module)) {
module.forEach(function (m) {
return Swiper.installModule(m);
});
return Swiper;
}

Swiper.installModule(module);
return Swiper;
}
}]);

return Swiper;
}();

Object.keys(prototypes).forEach(function (prototypeGroup) {
Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) {
Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
});
});
Swiper.use([Resize, Observer]);

function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
var document = getDocument();

if (swiper.params.createElements) {
Object.keys(checkProps).forEach(function (key) {
if (!params[key] && params.auto === true) {
var element = document.createElement('div');
element.className = checkProps[key];
swiper.$el.append(element);
params[key] = element;
originalParams[key] = element;
}
});
}

return params;
}

function Navigation(_ref) {
var swiper = _ref.swiper,
extendParams = _ref.extendParams,
on = _ref.on,
emit = _ref.emit;
extendParams({
navigation: {
nextEl: null,
prevEl: null,
hideOnClick: false,
disabledClass: 'swiper-button-disabled',
hiddenClass: 'swiper-button-hidden',
lockClass: 'swiper-button-lock'
}
});
swiper.navigation = {
nextEl: null,
$nextEl: null,
prevEl: null,
$prevEl: null
};

function getEl(el) {
var $el;

if (el) {
$el = $(el);

if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) {
$el = swiper.$el.find(el);
}
}

return $el;
}

function toggleEl($el, disabled) {
var params = swiper.params.navigation;

if ($el && $el.length > 0) {
$el[disabled ? 'addClass' : 'removeClass'](params.disabledClass);
if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled;

if (swiper.params.watchOverflow && swiper.enabled) {
$el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
}
}
}

function update() {
// Update Navigation Buttons
if (swiper.params.loop) return;
var _swiper$navigation = swiper.navigation,
$nextEl = _swiper$navigation.$nextEl,
$prevEl = _swiper$navigation.$prevEl;
toggleEl($prevEl, swiper.isBeginning);
toggleEl($nextEl, swiper.isEnd);
}

function onPrevClick(e) {
e.preventDefault();
if (swiper.isBeginning && !swiper.params.loop) return;
swiper.slidePrev();
}

function onNextClick(e) {
e.preventDefault();
if (swiper.isEnd && !swiper.params.loop) return;
swiper.slideNext();
}

function init() {
var params = swiper.params.navigation;
swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
nextEl: 'swiper-button-next',
prevEl: 'swiper-button-prev'
});
if (!(params.nextEl || params.prevEl)) return;
var $nextEl = getEl(params.nextEl);
var $prevEl = getEl(params.prevEl);

if ($nextEl && $nextEl.length > 0) {
$nextEl.on('click', onNextClick);
}

if ($prevEl && $prevEl.length > 0) {
$prevEl.on('click', onPrevClick);
}

Object.assign(swiper.navigation, {
$nextEl: $nextEl,
nextEl: $nextEl && $nextEl[0],
$prevEl: $prevEl,
prevEl: $prevEl && $prevEl[0]
});

if (!swiper.enabled) {
if ($nextEl) $nextEl.addClass(params.lockClass);
if ($prevEl) $prevEl.addClass(params.lockClass);
}
}

function destroy() {
var _swiper$navigation2 = swiper.navigation,
$nextEl = _swiper$navigation2.$nextEl,
$prevEl = _swiper$navigation2.$prevEl;

if ($nextEl && $nextEl.length) {
$nextEl.off('click', onNextClick);
$nextEl.removeClass(swiper.params.navigation.disabledClass);
}

if ($prevEl && $prevEl.length) {
$prevEl.off('click', onPrevClick);
$prevEl.removeClass(swiper.params.navigation.disabledClass);
}
}

on('init', function () {
init();
update();
});
on('toEdge fromEdge lock unlock', function () {
update();
});
on('destroy', function () {
destroy();
});
on('enable disable', function () {
var _swiper$navigation3 = swiper.navigation,
$nextEl = _swiper$navigation3.$nextEl,
$prevEl = _swiper$navigation3.$prevEl;

if ($nextEl) {
$nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass);
}

if ($prevEl) {
$prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass);
}
});
on('click', function (_s, e) {
var _swiper$navigation4 = swiper.navigation,
$nextEl = _swiper$navigation4.$nextEl,
$prevEl = _swiper$navigation4.$prevEl;
var targetEl = e.target;

if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) {
if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
var isHidden;

if ($nextEl) {
isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);
} else if ($prevEl) {
isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);
}

if (isHidden === true) {
emit('navigationShow');
} else {
emit('navigationHide');
}

if ($nextEl) {
$nextEl.toggleClass(swiper.params.navigation.hiddenClass);
}

if ($prevEl) {
$prevEl.toggleClass(swiper.params.navigation.hiddenClass);
}
}
});
Object.assign(swiper.navigation, {
update: update,
init: init,
destroy: destroy
});
}

/* eslint no-underscore-dangle: "off" */
function Autoplay(_ref) {
var swiper = _ref.swiper,
extendParams = _ref.extendParams,
on = _ref.on,
emit = _ref.emit;
var timeout;
swiper.autoplay = {
running: false,
paused: false
};
extendParams({
autoplay: {
enabled: false,
delay: 3000,
waitForTransition: true,
disableOnInteraction: true,
stopOnLastSlide: false,
reverseDirection: false,
pauseOnMouseEnter: false
}
});

function run() {
var $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
var delay = swiper.params.autoplay.delay;

if ($activeSlideEl.attr('data-swiper-autoplay')) {
delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
}

clearTimeout(timeout);
timeout = nextTick(function () {
var autoplayResult;

if (swiper.params.autoplay.reverseDirection) {
if (swiper.params.loop) {
swiper.loopFix();
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.isBeginning) {
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.params.autoplay.stopOnLastSlide) {
autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
emit('autoplay');
} else {
stop();
}
} else if (swiper.params.loop) {
swiper.loopFix();
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.isEnd) {
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.params.autoplay.stopOnLastSlide) {
autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
emit('autoplay');
} else {
stop();
}

if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) {
run();
}
}, delay);
}

function start() {
if (typeof timeout !== 'undefined') return false;
if (swiper.autoplay.running) return false;
swiper.autoplay.running = true;
emit('autoplayStart');
run();
return true;
}

function stop() {
if (!swiper.autoplay.running) return false;
if (typeof timeout === 'undefined') return false;

if (timeout) {
clearTimeout(timeout);
timeout = undefined;
}

swiper.autoplay.running = false;
emit('autoplayStop');
return true;
}

function pause(speed) {
if (!swiper.autoplay.running) return;
if (swiper.autoplay.paused) return;
if (timeout) clearTimeout(timeout);
swiper.autoplay.paused = true;

if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
swiper.autoplay.paused = false;
run();
} else {
['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd);
});
}
}

function onVisibilityChange() {
var document = getDocument();

if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
pause();
}

if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
run();
swiper.autoplay.paused = false;
}
}

function onTransitionEnd(e) {
if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
if (e.target !== swiper.$wrapperEl[0]) return;
['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
});
swiper.autoplay.paused = false;

if (!swiper.autoplay.running) {
stop();
} else {
run();
}
}

function onMouseEnter() {
if (swiper.params.autoplay.disableOnInteraction) {
stop();
} else {
pause();
}

['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
});
}

function onMouseLeave() {
if (swiper.params.autoplay.disableOnInteraction) {
return;
}

swiper.autoplay.paused = false;
run();
}

function attachMouseEvents() {
if (swiper.params.autoplay.pauseOnMouseEnter) {
swiper.$el.on('mouseenter', onMouseEnter);
swiper.$el.on('mouseleave', onMouseLeave);
}
}

function detachMouseEvents() {
swiper.$el.off('mouseenter', onMouseEnter);
swiper.$el.off('mouseleave', onMouseLeave);
}

on('init', function () {
if (swiper.params.autoplay.enabled) {
start();
var document = getDocument();
document.addEventListener('visibilitychange', onVisibilityChange);
attachMouseEvents();
}
});
on('beforeTransitionStart', function (_s, speed, internal) {
if (swiper.autoplay.running) {
if (internal || !swiper.params.autoplay.disableOnInteraction) {
swiper.autoplay.pause(speed);
} else {
stop();
}
}
});
on('sliderFirstMove', function () {
if (swiper.autoplay.running) {
if (swiper.params.autoplay.disableOnInteraction) {
stop();
} else {
pause();
}
}
});
on('touchEnd', function () {
if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) {
run();
}
});
on('destroy', function () {
detachMouseEvents();

if (swiper.autoplay.running) {
stop();
}

var document = getDocument();
document.removeEventListener('visibilitychange', onVisibilityChange);
});
Object.assign(swiper.autoplay, {
pause: pause,
run: run,
start: start,
stop: stop
});
}

function styleInject(css, ref) {
if (ref === void 0) ref = {};
var insertAt = ref.insertAt;

if (!css || typeof document === 'undefined') {
return;
}

var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';

if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}

if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}

var css_248z$2 = "/**\n * Swiper 7.0.1\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n * https://swiperjs.com\n *\n * Copyright 2014-2021 Vladimir Kharlampidi\n *\n * Released under the MIT License\n *\n * Released on: August 26, 2021\n */\n\n@font-face{font-family:swiper-icons;src:url('data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA');font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;box-sizing:content-box}.swiper-android .swiper-slide,.swiper-wrapper{transform:translate3d(0px,0,0)}.swiper-pointer-events{touch-action:pan-y}.swiper-pointer-events.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-3d,.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-cube-shadow,.swiper-3d .swiper-slide,.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0,0,0,.15)}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-horizontal.swiper-css-mode>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-vertical.swiper-css-mode>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-centered>.swiper-wrapper::before{content:'';flex-shrink:0;order:9999}.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center}";
styleInject(css_248z$2);

var css_248z$1 = ":root{--swiper-navigation-size:44px}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:calc(var(--swiper-navigation-size)/ 44 * 27);height:var(--swiper-navigation-size);margin-top:calc(0px - (var(--swiper-navigation-size)/ 2));z-index:10;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--swiper-navigation-color,var(--swiper-theme-color))}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-next:after,.swiper-button-prev:after{font-family:swiper-icons;font-size:var(--swiper-navigation-size);text-transform:none!important;letter-spacing:0;text-transform:none;font-variant:initial;line-height:1}.swiper-button-prev,.swiper-rtl .swiper-button-next{left:10px;right:auto}.swiper-button-prev:after,.swiper-rtl .swiper-button-next:after{content:'prev'}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:10px;left:auto}.swiper-button-next:after,.swiper-rtl .swiper-button-prev:after{content:'next'}.swiper-button-lock{display:none}";
styleInject(css_248z$1);

var css_248z = "";
styleInject(css_248z);

/* eslint-disable no-console */
var Logger = /*#__PURE__*/function () {
function Logger(level) {
_classCallCheck(this, Logger);

this.level = level || Logger.levels.ERROR;
}

_createClass(Logger, [{
key: "info",
value: function info() {
if (this.level >= Logger.levels.INFO) {
console.log.apply(console, arguments);
}
}
}, {
key: "warn",
value: function warn() {
if (this.level >= Logger.levels.WARN) {
console.log.apply(console, arguments);
}
}
}, {
key: "test",
value: function test() {
if (this.level >= Logger.levels.TEST) {
console.log.apply(console, arguments);
}
}
}, {
key: "error",
value: function error() {
if (this.level >= Logger.levels.ERROR) {
console.log.apply(console, arguments);
}
}
}]);

return Logger;
}();

Logger.levels = {
ERROR: 0,
WARN: 1,
TEST: 2,
INFO: 3
};

/*
Item structure
*/
var createItemDOM = function createItemDOM(config, item, onClickThrough) {
var itemContainer = document.createElement("div");
itemContainer.className = "item swiper-slide";
itemContainer.id = "property-id-" + item[config.idPropertyName];
config.createItemDOM(item, itemContainer, onClickThrough);
return itemContainer;
};

var createSwiperCarouselDOM = function createSwiperCarouselDOM(config, properties, onClickThrough) {
var swiperContainer = document.createElement("div");
swiperContainer.className = "swiper"; // swiperContainer.style.position = "relative";
// swiperContainer.style.top = "35px";
// swiperContainer.style.left = "0";

swiperContainer.style.height = "100%";
swiperContainer.style.width = "100%";
var swiperWrapper = document.createElement("div");
swiperWrapper.className = "swiper-wrapper";
properties.map(function (item) {
return createItemDOM(config, item, onClickThrough);
}).forEach(function (dom) {
swiperWrapper.appendChild(dom);
});
swiperContainer.appendChild(swiperWrapper);
return swiperContainer;
};
function injectLinksInHead(bz, onPublisherWindow, rel, hrefs) {
var head = (onPublisherWindow ? bz.Creative.getPublisherWindow().document : document).getElementsByTagName("head")[0];
var allLinks = getDOMElementsFragment(hrefs.map(function (href) {
return getLinkDOM(rel, href);
}));
head.appendChild(allLinks);
}

function getDOMElementsFragment(listOfDOMElements) {
var fragment = new DocumentFragment();
listOfDOMElements.forEach(function (dom) {
fragment.appendChild(dom);
});
return fragment;
}

function getLinkDOM(rel, href) {
var link = document.createElement("link");
link.setAttribute("rel", rel);
link.setAttribute("href", href);
return link;
}

var EventEmitter = /*#__PURE__*/function () {
function EventEmitter() {
_classCallCheck(this, EventEmitter);

this.events = {};
}

_createClass(EventEmitter, [{
key: "on",
value: function on(event, listener) {
var _this = this;

if (!(event in this.events)) {
this.events[event] = [];
}

this.events[event].push(listener);
return function () {
return _this.removeListener(event, listener);
};
}
}, {
key: "removeListener",
value: function removeListener(event, listener) {
if (!(event in this.events)) {
return;
}

var idx = this.events[event].indexOf(listener);

if (idx > -1) {
this.events[event].splice(idx, 1);
}

if (this.events[event].length === 0) {
delete this.events[event];
}
}
}, {
key: "emit",
value: function emit(event) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}

if (!(event in this.events)) {
return;
}

this.events[event].forEach(function (listener) {
return listener.apply(void 0, args);
});
}
}, {
key: "once",
value: function once(event, listener) {
var remove = this.on(event, function () {
remove();
listener.apply(void 0, arguments);
});
}
}]);

return EventEmitter;
}();

Swiper.use([Navigation, Autoplay]);

var getLogger = function () {
var logger = null;
return function (isDebug) {
if (logger) return logger;
logger = new Logger(isDebug ? Logger.levels.INFO : Logger.levels.ERROR);
return logger;
};
}();

function injectDNSPrefetchLinks(bz, config, domains) {
injectLinksInHead(bz, config.usePublisherWindow, "dns-prefetch", domains);
}

var setupNavigationButtons = function setupNavigationButtons(bz, config) {
var logger = getLogger(config.debug);
var leftButton = bz.Creative.getElementByName(config.leftButtonElement);
var rightButton = bz.Creative.getElementByName(config.rightButtonElement);

if (!leftButton) {
logger.error("setupNavigationButtons: Could not find element of name " + config.leftButtonElement);
}

leftButton.el.classList.add("leftButton");
leftButton.el.classList.add("bz-button-prev");

if (!rightButton) {
logger.error("setupNavigationButtons: Could not find element of name " + config.rightButtonElement);
}

rightButton.el.classList.add("rightButton");
rightButton.el.classList.add("bz-button-next");
leftButton.el.firstElementChild.style.cursor = "pointer";
rightButton.el.firstElementChild.style.cursor = "pointer";
};

var decodeHtml = function decodeHtml(html) {
var txt = document.createElement("textarea");
txt.innerHTML = html; //console.log('html content', html)

return txt.value;
}; // function that take all informatin from starting like bonzai docs bz and config. cb and onlclick


var initializeCarousel = function initializeCarousel(bz, config, cb, onClickThrough) {
var logger = getLogger(config.debug);
var page = bz.Creative.getPageByName(config.pageName).el;
page.style.userSelect = "none";
console.log('file has following configuration', config);

try {
//console.log(`Data from creative ${config.feedDataElement.el}`);
var products = JSON.parse(decodeHtml(bz.Creative.getElementByName(config.feedDataElement).el.innerHTML.replace(/\\"/g, "\"")));
console.log('products created at:', products);
} catch (e) {
logger.error("initializeCarousel: Failed to get feed JSON from element of name, " + config.feedDataElement);
console.error(e);
}

function initialize() {
var carouselContainer = bz.Creative.getElementByName(config.containerElement); // Use Carousel_Container element as the container for the carousel or use page.

(carouselContainer ? carouselContainer.el : page).appendChild(createSwiperCarouselDOM(config, products, onClickThrough)); //console.log('Initialize container element', carouselContainer);

setupNavigationButtons(bz, config);
new Swiper(".swiper", _objectSpread2({
loop: true,
autoplay: true,
slidesPerView: config.itemsPerView,
spaceBetween: 10,
preloadImages: false,
navigation: {
nextEl: ".bz-button-next",
prevEl: ".bz-button-prev"
},
breakpointsBase: "container",
breakpoints: config.breakpoints,
on: {
init: function init() {
cb(this);
}
}
}, config.swiperOptions || {})); //? Do we need this?
// document.querySelectorAll(".item").addEventListener("hover", function () {
// swiper.autoplay.stop();
// });
}

if (config.imageUrlPropertyName) {
bz.Common.preloadImages(products.slice(0, 3).map(function (product) {
return product[config.imageUrlPropertyName];
}), initialize);
} else {
initialize();
}
};
/**
*
* @param {*} bz
* @param {Object} config
* @param {string} config.pageName The name of the page on which this carousel is present.
* @param {string} config.feedDataElement The name of the text element that has the feed data in it.
* @param {string} [config.containerElement] The name of the container element into which the carousel will be inserted.
* If you don't pass this, the page is used as the container.
* @param {string} config.leftButtonElement The name of the left navigation button.
* @param {string} config.rightButtonElement The name of the right navigation button.
* @param {Object} config.data The JSON data required to render the carousel.
* @param {number} config.itemsPerView The number of items to show in the carousel.
* @param {Function} config.createItemDOM The function to create the item DOM. It receives the feed item object.
* @param {string} config.idPropertyName The name of the id property of the feed item.
* @param {string} [config.imageUrlPropertyName] The name of the property in the feed which contains the image
* url. This is used to preload the first group of image. If you don't pass this images will not be preloaded.
* @param {boolean} [config.debug=false] Show extra debug output when this option is enabled.
* @param {boolean} [config.usePublisherWindow=false] Should we use publisher window for inserting stuff. This is
* helpful for some formats, such as Portal, which move the DOM out of the publisher container.
* @param {Object} [config.breakpoints] Allows to set different parameter for different responsive breakpoints (container sizes).
* Not all parameters can be changed in breakpoints, only those which are not required different layout and logic, like slidesPerView & spaceBetween.
* @param {Object} config.swiperOptions Some extra options that you want to pass directly to Swiper.
*/


var DynamicCarousel = /*#__PURE__*/function () {
function DynamicCarousel(bz, config) {
var _this = this;

_classCallCheck(this, DynamicCarousel);

this.emitter = new EventEmitter();
this.swiper = null;
this.bz = bz;
injectDNSPrefetchLinks(bz, config, ["https://cdn.jsdelivr.net/"]);
initializeCarousel(bz, config, function (swiper) {
_this.swiper = swiper;
setTimeout(function () {
_this.emitter.emit("ready");
}, 0);
swiper.on("slideChangeTransitionEnd", function () {
_this.emitter.emit("slideChange");
});
}, function (id, url) {
_this.doClickThrough(id, url);
});
}
/**
* Add event handler
* @param {"ready"|"slideChange"} event
* @param {Function} fn
*/


_createClass(DynamicCarousel, [{
key: "on",
value: function on(event, fn) {
var _this2 = this;

switch (event) {
case "ready":
{
this.emitter.on("ready", function () {
return fn.call(_this2);
});
break;
}

case "slideChange":
{
this.emitter.on("slideChange", function () {
return fn.call(_this2, _this2.swiper.realIndex);
});
break;
}

default:
{
console.warn("".concat(event, " not recognized"));
}
}
}
}, {
key: "doClickThrough",
value: function doClickThrough(id, url) {
var bz = this.bz;
bz.Creative.triggerAnalyticsEvent("click", "Click/Tap", bz.Constants.EventType.CLICKTHROUGH, {
acts: [{
aid: "bc" + id,
at: "Click Through",
a: "openurl",
ap: url,
an: "Open URL"
}],
eleid: "c" + id,
elen: "CTA " + id,
elet: "BUTTON"
});
bz.Actions.openUrl(url);
}
}, {
key: "addClickThroughEvent",
value: function addClickThroughEvent(id, url, el) {
var _this3 = this;

el.addEventListener("click", function () {
_this3.doClickThrough(id, url);
});
}
}]);

return DynamicCarousel;
}();

return DynamicCarousel;

}());

Back to list