splide.js 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939
  1. 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); } }
  2. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3. /*!
  4. * Splide.js
  5. * Version : 3.0.0
  6. * License : MIT
  7. * Copyright: 2021 Naotoshi Fujita
  8. */
  9. (function (global, factory) {
  10. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Splide = factory());
  11. })(this, function () {
  12. 'use strict';
  13. var PROJECT_CODE = "splide";
  14. var DATA_ATTRIBUTE = "data-" + PROJECT_CODE;
  15. var CREATED = 1;
  16. var MOUNTED = 2;
  17. var IDLE = 3;
  18. var MOVING = 4;
  19. var DESTROYED = 5;
  20. var STATES = {
  21. CREATED: CREATED,
  22. MOUNTED: MOUNTED,
  23. IDLE: IDLE,
  24. MOVING: MOVING,
  25. DESTROYED: DESTROYED
  26. };
  27. function empty(array) {
  28. array.length = 0;
  29. }
  30. function isObject(subject) {
  31. return !isNull(subject) && typeof subject === "object";
  32. }
  33. function isArray(subject) {
  34. return Array.isArray(subject);
  35. }
  36. function isFunction(subject) {
  37. return typeof subject === "function";
  38. }
  39. function isString(subject) {
  40. return typeof subject === "string";
  41. }
  42. function isUndefined(subject) {
  43. return typeof subject === "undefined";
  44. }
  45. function isNull(subject) {
  46. return subject === null;
  47. }
  48. function isHTMLElement(subject) {
  49. return subject instanceof HTMLElement;
  50. }
  51. function isHTMLButtonElement(subject) {
  52. return subject instanceof HTMLButtonElement;
  53. }
  54. function toArray(value) {
  55. return isArray(value) ? value : [value];
  56. }
  57. function forEach(values, iteratee) {
  58. toArray(values).forEach(iteratee);
  59. }
  60. function includes(array, value) {
  61. return array.indexOf(value) > -1;
  62. }
  63. function push(array, items) {
  64. array.push.apply(array, toArray(items));
  65. return array;
  66. }
  67. var arrayProto = Array.prototype;
  68. function slice(arrayLike, start, end) {
  69. return arrayProto.slice.call(arrayLike, start, end);
  70. }
  71. function find(arrayLike, predicate) {
  72. return slice(arrayLike).filter(predicate)[0];
  73. }
  74. function toggleClass(elm, classes, add) {
  75. if (elm) {
  76. forEach(classes, function (name) {
  77. if (name) {
  78. elm.classList[add ? "add" : "remove"](name);
  79. }
  80. });
  81. }
  82. }
  83. function addClass(elm, classes) {
  84. toggleClass(elm, classes, true);
  85. }
  86. function append(parent, children) {
  87. forEach(children, parent.appendChild.bind(parent));
  88. }
  89. function before(nodes, ref) {
  90. forEach(nodes, function (node) {
  91. var parent = ref.parentNode;
  92. if (parent) {
  93. parent.insertBefore(node, ref);
  94. }
  95. });
  96. }
  97. function matches(elm, selector) {
  98. return (elm["msMatchesSelector"] || elm.matches).call(elm, selector);
  99. }
  100. function children(parent, selector) {
  101. return parent ? slice(parent.children).filter(function (child) {
  102. return matches(child, selector);
  103. }) : [];
  104. }
  105. function child(parent, selector) {
  106. return selector ? children(parent, selector)[0] : parent.firstElementChild;
  107. }
  108. function forOwn(object, iteratee) {
  109. if (object) {
  110. var keys = Object.keys(object);
  111. for (var i = 0; i < keys.length; i++) {
  112. var key = keys[i];
  113. if (key !== "__proto__") {
  114. if (iteratee(object[key], key) === false) {
  115. break;
  116. }
  117. }
  118. }
  119. }
  120. return object;
  121. }
  122. function assign(object) {
  123. for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  124. sources[_key - 1] = arguments[_key];
  125. }
  126. sources.forEach(function (source) {
  127. forOwn(source, function (value, key) {
  128. object[key] = source[key];
  129. });
  130. });
  131. return object;
  132. }
  133. function merge(object, source) {
  134. forOwn(source, function (value, key) {
  135. if (isArray(value)) {
  136. object[key] = value.slice();
  137. } else if (isObject(value)) {
  138. object[key] = merge(isObject(object[key]) ? object[key] : {}, value);
  139. } else {
  140. object[key] = value;
  141. }
  142. });
  143. return object;
  144. }
  145. function removeAttribute(elm, attrs) {
  146. if (elm) {
  147. forEach(attrs, function (attr) {
  148. elm.removeAttribute(attr);
  149. });
  150. }
  151. }
  152. function setAttribute(elm, attrs, value) {
  153. if (isObject(attrs)) {
  154. forOwn(attrs, function (value2, name) {
  155. setAttribute(elm, name, value2);
  156. });
  157. } else {
  158. isNull(value) ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value));
  159. }
  160. }
  161. function create(tag, attrs, parent) {
  162. var elm = document.createElement(tag);
  163. if (attrs) {
  164. if (isString(attrs) || isArray(attrs)) {
  165. addClass(elm, attrs);
  166. } else {
  167. setAttribute(elm, attrs);
  168. }
  169. }
  170. if (parent) {
  171. append(parent, elm);
  172. }
  173. return elm;
  174. }
  175. function style(elms, styles) {
  176. if (isString(styles)) {
  177. return isArray(elms) ? null : getComputedStyle(elms)[styles];
  178. }
  179. forOwn(styles, function (value, key) {
  180. if (!isNull(value)) {
  181. forEach(elms, function (elm) {
  182. if (elm) {
  183. elm.style[key] = "" + value;
  184. }
  185. });
  186. }
  187. });
  188. }
  189. function display(elm, display2) {
  190. style(elm, {
  191. display: display2
  192. });
  193. }
  194. function getAttribute(elm, attr) {
  195. return elm.getAttribute(attr);
  196. }
  197. function hasClass(elm, className) {
  198. return elm && elm.classList.contains(className);
  199. }
  200. function parseHtml(html) {
  201. return child(new DOMParser().parseFromString(html, "text/html").body);
  202. }
  203. function prevent(e, stopPropagation) {
  204. e.preventDefault();
  205. if (stopPropagation) {
  206. e.stopPropagation();
  207. e.stopImmediatePropagation();
  208. }
  209. }
  210. function query(parent, selector) {
  211. return parent && parent.querySelector(selector);
  212. }
  213. function queryAll(parent, selector) {
  214. return slice(parent.querySelectorAll(selector));
  215. }
  216. function rect(target) {
  217. return target.getBoundingClientRect();
  218. }
  219. function remove(nodes) {
  220. forEach(nodes, function (node) {
  221. if (node && node.parentNode) {
  222. node.parentNode.removeChild(node);
  223. }
  224. });
  225. }
  226. function removeClass(elm, classes) {
  227. toggleClass(elm, classes, false);
  228. }
  229. function unit(value) {
  230. return isString(value) ? value : value ? value + "px" : "";
  231. }
  232. function assert(condition, message) {
  233. if (message === void 0) {
  234. message = "";
  235. }
  236. if (!condition) {
  237. throw new Error("[" + PROJECT_CODE + "] " + message);
  238. }
  239. }
  240. function nextTick(callback) {
  241. setTimeout(callback);
  242. }
  243. var noop = function noop() {};
  244. function raf(func) {
  245. return requestAnimationFrame(func);
  246. }
  247. function between(number, minOrMax, maxOrMin, exclusive) {
  248. var min = Math.min(minOrMax, maxOrMin);
  249. var max = Math.max(minOrMax, maxOrMin);
  250. return exclusive ? min < number && number < max : min <= number && number <= max;
  251. }
  252. var max$1 = Math.max,
  253. min$1 = Math.min;
  254. function clamp(number, x, y) {
  255. var minimum = min$1(x, y);
  256. var maximum = max$1(x, y);
  257. return min$1(max$1(minimum, number), maximum);
  258. }
  259. function sign(x) {
  260. return +(x > 0) - +(x < 0);
  261. }
  262. var min = Math.min,
  263. max = Math.max,
  264. floor = Math.floor,
  265. ceil = Math.ceil,
  266. abs = Math.abs,
  267. round = Math.round;
  268. function format(string, replacements) {
  269. forEach(replacements, function (replacement) {
  270. string = string.replace("%s", "" + replacement);
  271. });
  272. return string;
  273. }
  274. function pad(number) {
  275. return number < 10 ? "0" + number : "" + number;
  276. }
  277. var ids = {};
  278. function uniqueId(prefix) {
  279. return "" + prefix + pad(ids[prefix] = (ids[prefix] || 0) + 1);
  280. }
  281. function Options(Splide2, Components2, options) {
  282. var initialOptions;
  283. var points;
  284. var currPoint;
  285. function setup() {
  286. try {
  287. merge(options, JSON.parse(getAttribute(Splide2.root, DATA_ATTRIBUTE)));
  288. } catch (e) {
  289. assert(false, e.message);
  290. }
  291. initialOptions = merge({}, options);
  292. }
  293. function mount() {
  294. var breakpoints = options.breakpoints;
  295. if (breakpoints) {
  296. points = Object.keys(breakpoints).sort(function (n, m) {
  297. return +n - +m;
  298. }).map(function (point) {
  299. return [point, matchMedia("(" + (options.mediaQuery || "max") + "-width:" + point + "px)")];
  300. });
  301. addEventListener("resize", observe);
  302. observe();
  303. }
  304. }
  305. function destroy(completely) {
  306. if (completely) {
  307. removeEventListener("resize", observe);
  308. }
  309. }
  310. function observe() {
  311. var item = find(points, function (item2) {
  312. return item2[1].matches;
  313. }) || [];
  314. if (item[0] !== currPoint) {
  315. onMatch(currPoint = item[0]);
  316. }
  317. }
  318. function onMatch(point) {
  319. var newOptions = options.breakpoints[point] || initialOptions;
  320. if (newOptions.destroy) {
  321. Splide2.options = initialOptions;
  322. Splide2.destroy(newOptions.destroy === "completely");
  323. } else {
  324. if (Splide2.state.is(DESTROYED)) {
  325. destroy(true);
  326. Splide2.mount();
  327. }
  328. Splide2.options = newOptions;
  329. }
  330. }
  331. return {
  332. setup: setup,
  333. mount: mount,
  334. destroy: destroy
  335. };
  336. }
  337. var RTL = "rtl";
  338. var TTB = "ttb";
  339. var ORIENTATION_MAP = {
  340. marginRight: ["marginBottom", "marginLeft"],
  341. width: ["height"],
  342. autoWidth: ["autoHeight"],
  343. fixedWidth: ["fixedHeight"],
  344. paddingLeft: ["paddingTop", "paddingRight"],
  345. paddingRight: ["paddingBottom", "paddingLeft"],
  346. left: ["top", "right"],
  347. right: ["bottom", "left"],
  348. x: ["y"],
  349. X: ["Y"],
  350. pageX: ["pageY"],
  351. ArrowLeft: ["ArrowUp", "ArrowRight"],
  352. ArrowRight: ["ArrowDown", "ArrowLeft"]
  353. };
  354. function Direction(Splide2, Components2, options) {
  355. function resolve(prop, axisOnly) {
  356. var direction = options.direction;
  357. var index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1;
  358. return ORIENTATION_MAP[prop][index] || prop;
  359. }
  360. function orient(value) {
  361. return value * (options.direction === RTL ? 1 : -1);
  362. }
  363. return {
  364. resolve: resolve,
  365. orient: orient
  366. };
  367. }
  368. var CLASS_ROOT = PROJECT_CODE;
  369. var CLASS_SLIDER = PROJECT_CODE + "__slider";
  370. var CLASS_TRACK = PROJECT_CODE + "__track";
  371. var CLASS_LIST = PROJECT_CODE + "__list";
  372. var CLASS_SLIDE = PROJECT_CODE + "__slide";
  373. var CLASS_CLONE = CLASS_SLIDE + "--clone";
  374. var CLASS_CONTAINER = CLASS_SLIDE + "__container";
  375. var CLASS_ARROWS = PROJECT_CODE + "__arrows";
  376. var CLASS_ARROW = PROJECT_CODE + "__arrow";
  377. var CLASS_ARROW_PREV = CLASS_ARROW + "--prev";
  378. var CLASS_ARROW_NEXT = CLASS_ARROW + "--next";
  379. var CLASS_PAGINATION = PROJECT_CODE + "__pagination";
  380. var CLASS_PAGINATION_PAGE = CLASS_PAGINATION + "__page";
  381. var CLASS_PROGRESS = PROJECT_CODE + "__progress";
  382. var CLASS_PROGRESS_BAR = CLASS_PROGRESS + "__bar";
  383. var CLASS_AUTOPLAY = PROJECT_CODE + "__autoplay";
  384. var CLASS_PLAY = PROJECT_CODE + "__play";
  385. var CLASS_PAUSE = PROJECT_CODE + "__pause";
  386. var CLASS_SPINNER = PROJECT_CODE + "__spinner";
  387. var CLASS_INITIALIZED = "is-initialized";
  388. var CLASS_ACTIVE = "is-active";
  389. var CLASS_PREV = "is-prev";
  390. var CLASS_NEXT = "is-next";
  391. var CLASS_VISIBLE = "is-visible";
  392. var CLASS_LOADING = "is-loading";
  393. var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING];
  394. var CLASSES = {
  395. slide: CLASS_SLIDE,
  396. clone: CLASS_CLONE,
  397. arrows: CLASS_ARROWS,
  398. arrow: CLASS_ARROW,
  399. prev: CLASS_ARROW_PREV,
  400. next: CLASS_ARROW_NEXT,
  401. pagination: CLASS_PAGINATION,
  402. page: CLASS_PAGINATION_PAGE,
  403. spinner: CLASS_SPINNER
  404. };
  405. var EVENT_MOUNTED = "mounted";
  406. var EVENT_READY = "ready";
  407. var EVENT_MOVE = "move";
  408. var EVENT_MOVED = "moved";
  409. var EVENT_CLICK = "click";
  410. var EVENT_ACTIVE = "active";
  411. var EVENT_INACTIVE = "inactive";
  412. var EVENT_VISIBLE = "visible";
  413. var EVENT_HIDDEN = "hidden";
  414. var EVENT_SLIDE_KEYDOWN = "slide:keydown";
  415. var EVENT_REFRESH = "refresh";
  416. var EVENT_UPDATED = "undated";
  417. var EVENT_RESIZE = "resize";
  418. var EVENT_RESIZED = "resized";
  419. var EVENT_DRAG = "drag";
  420. var EVENT_DRAGGING = "dragging";
  421. var EVENT_DRAGGED = "dragged";
  422. var EVENT_SCROLL = "scroll";
  423. var EVENT_SCROLLED = "scrolled";
  424. var EVENT_DESTROY = "destroy";
  425. var EVENT_ARROWS_MOUNTED = "arrows:mounted";
  426. var EVENT_ARROWS_UPDATED = "arrows:updated";
  427. var EVENT_PAGINATION_MOUNTED = "pagination:mounted";
  428. var EVENT_PAGINATION_PAGE = "pagination:page";
  429. var EVENT_PAGINATION_UPDATED = "pagination:updated";
  430. var EVENT_NAVIGATION_MOUNTED = "navigation:mounted";
  431. var EVENT_AUTOPLAY_PLAY = "autoplay:play";
  432. var EVENT_AUTOPLAY_PLAYING = "autoplay:playing";
  433. var EVENT_AUTOPLAY_PAUSE = "autoplay:pause";
  434. var EVENT_LAZYLOAD_LOADED = "lazyload:loaded";
  435. function EventBus() {
  436. var handlers = {};
  437. function on(events, callback, key, priority) {
  438. if (priority === void 0) {
  439. priority = 10;
  440. }
  441. forEachEvent(events, function (event, namespace) {
  442. handlers[event] = handlers[event] || [];
  443. push(handlers[event], {
  444. _event: event,
  445. _callback: callback,
  446. _namespace: namespace,
  447. _priority: priority,
  448. _key: key
  449. }).sort(function (handler1, handler2) {
  450. return handler1._priority - handler2._priority;
  451. });
  452. });
  453. }
  454. function off(events, key) {
  455. forEachEvent(events, function (event, namespace) {
  456. var eventHandlers = handlers[event];
  457. handlers[event] = eventHandlers && eventHandlers.filter(function (handler) {
  458. return handler._key ? handler._key !== key : handler._namespace !== namespace;
  459. });
  460. });
  461. }
  462. function offBy(key) {
  463. forOwn(handlers, function (eventHandlers, event) {
  464. off(event, key);
  465. });
  466. }
  467. function emit(event) {
  468. var _arguments = arguments;
  469. (handlers[event] || []).forEach(function (handler) {
  470. handler._callback.apply(handler, slice(_arguments, 1));
  471. });
  472. }
  473. function destroy() {
  474. handlers = {};
  475. }
  476. function forEachEvent(events, iteratee) {
  477. toArray(events).join(" ").split(" ").forEach(function (eventNS) {
  478. var fragments = eventNS.split(".");
  479. iteratee(fragments[0], fragments[1]);
  480. });
  481. }
  482. return {
  483. on: on,
  484. off: off,
  485. offBy: offBy,
  486. emit: emit,
  487. destroy: destroy
  488. };
  489. }
  490. function EventInterface(Splide2) {
  491. var event = Splide2.event;
  492. var key = {};
  493. var listeners = [];
  494. function on(events, callback, priority) {
  495. event.on(events, callback, key, priority);
  496. }
  497. function off(events) {
  498. event.off(events, key);
  499. }
  500. function bind(targets, events, callback, options) {
  501. forEachEvent(targets, events, function (target, event2) {
  502. listeners.push([target, event2, callback, options]);
  503. target.addEventListener(event2, callback, options);
  504. });
  505. }
  506. function unbind(targets, events) {
  507. forEachEvent(targets, events, function (target, event2) {
  508. listeners = listeners.filter(function (listener) {
  509. if (listener[0] === target && listener[1] === event2) {
  510. target.removeEventListener(event2, listener[2], listener[3]);
  511. return false;
  512. }
  513. return true;
  514. });
  515. });
  516. }
  517. function forEachEvent(targets, events, iteratee) {
  518. forEach(targets, function (target) {
  519. if (target) {
  520. events.split(" ").forEach(iteratee.bind(null, target));
  521. }
  522. });
  523. }
  524. function destroy() {
  525. listeners = listeners.filter(function (data) {
  526. return unbind(data[0], data[1]);
  527. });
  528. event.offBy(key);
  529. }
  530. event.on(EVENT_DESTROY, destroy, key);
  531. return {
  532. on: on,
  533. off: off,
  534. emit: event.emit,
  535. bind: bind,
  536. unbind: unbind,
  537. destroy: destroy
  538. };
  539. }
  540. function RequestInterval(interval, onInterval, onUpdate, limit) {
  541. var now = Date.now;
  542. var startTime;
  543. var rate = 0;
  544. var id;
  545. var paused = true;
  546. var count = 0;
  547. function update() {
  548. if (!paused) {
  549. var elapsed = now() - startTime;
  550. if (elapsed >= interval) {
  551. rate = 1;
  552. startTime = now();
  553. } else {
  554. rate = elapsed / interval;
  555. }
  556. if (onUpdate) {
  557. onUpdate(rate);
  558. }
  559. if (rate === 1) {
  560. onInterval();
  561. if (limit && ++count >= limit) {
  562. pause();
  563. return;
  564. }
  565. }
  566. raf(update);
  567. }
  568. }
  569. function start(resume) {
  570. !resume && cancel();
  571. startTime = now() - (resume ? rate * interval : 0);
  572. paused = false;
  573. raf(update);
  574. }
  575. function pause() {
  576. paused = true;
  577. }
  578. function rewind() {
  579. startTime = now();
  580. rate = 0;
  581. if (onUpdate) {
  582. onUpdate(rate);
  583. }
  584. }
  585. function cancel() {
  586. cancelAnimationFrame(id);
  587. rate = 0;
  588. id = 0;
  589. paused = true;
  590. }
  591. function isPaused() {
  592. return paused;
  593. }
  594. return {
  595. start: start,
  596. rewind: rewind,
  597. pause: pause,
  598. cancel: cancel,
  599. isPaused: isPaused
  600. };
  601. }
  602. function State(initialState) {
  603. var state = initialState;
  604. function set(value) {
  605. state = value;
  606. }
  607. function is(states) {
  608. return includes(toArray(states), state);
  609. }
  610. return {
  611. set: set,
  612. is: is
  613. };
  614. }
  615. function Throttle(func, duration) {
  616. var interval;
  617. function throttled() {
  618. var _arguments2 = arguments,
  619. _this = this;
  620. if (!interval) {
  621. interval = RequestInterval(duration || 0, function () {
  622. func.apply(_this, _arguments2);
  623. interval = null;
  624. }, null, 1);
  625. interval.start();
  626. }
  627. }
  628. return throttled;
  629. }
  630. function Elements(Splide2, Components2, options) {
  631. var _EventInterface = EventInterface(Splide2),
  632. on = _EventInterface.on;
  633. var root = Splide2.root;
  634. var elements = {};
  635. var slides = [];
  636. var classes;
  637. var slider;
  638. var track;
  639. var list;
  640. function setup() {
  641. collect();
  642. identify();
  643. addClass(root, classes = getClasses());
  644. }
  645. function mount() {
  646. on(EVENT_REFRESH, refresh);
  647. on(EVENT_UPDATED, update);
  648. }
  649. function destroy() {
  650. empty(slides);
  651. removeClass(root, classes);
  652. }
  653. function refresh() {
  654. destroy();
  655. setup();
  656. }
  657. function update() {
  658. removeClass(root, classes);
  659. addClass(root, classes = getClasses());
  660. }
  661. function collect() {
  662. slider = child(root, "." + CLASS_SLIDER);
  663. track = query(root, "." + CLASS_TRACK);
  664. list = child(track, "." + CLASS_LIST);
  665. assert(track && list, "Missing a track/list element.");
  666. push(slides, children(list, "." + CLASS_SLIDE + ":not(." + CLASS_CLONE + ")"));
  667. var autoplay = find("." + CLASS_AUTOPLAY);
  668. var arrows = find("." + CLASS_ARROWS);
  669. assign(elements, {
  670. root: root,
  671. slider: slider,
  672. track: track,
  673. list: list,
  674. slides: slides,
  675. arrows: arrows,
  676. prev: query(arrows, "." + CLASS_ARROW_PREV),
  677. next: query(arrows, "." + CLASS_ARROW_NEXT),
  678. bar: query(find("." + CLASS_PROGRESS), "." + CLASS_PROGRESS_BAR),
  679. play: query(autoplay, "." + CLASS_PLAY),
  680. pause: query(autoplay, "." + CLASS_PAUSE)
  681. });
  682. }
  683. function identify() {
  684. var id = root.id || uniqueId(PROJECT_CODE);
  685. root.id = id;
  686. track.id = track.id || id + "-track";
  687. list.id = list.id || id + "-list";
  688. }
  689. function find(selector) {
  690. return child(root, selector) || child(slider, selector);
  691. }
  692. function getClasses() {
  693. return [CLASS_ROOT + "--" + options.type, CLASS_ROOT + "--" + options.direction, options.drag && CLASS_ROOT + "--draggable", options.isNavigation && CLASS_ROOT + "--nav", CLASS_ACTIVE];
  694. }
  695. return assign(elements, {
  696. setup: setup,
  697. mount: mount,
  698. destroy: destroy
  699. });
  700. }
  701. function Style() {
  702. var style;
  703. var sheet;
  704. function mount() {
  705. style = create("style", {}, document.head);
  706. sheet = style.sheet;
  707. }
  708. function destroy() {
  709. remove(style);
  710. sheet = null;
  711. }
  712. function rule(selector, prop, value) {
  713. var _sheet = sheet,
  714. cssRules = _sheet.cssRules;
  715. var cssRule = find(cssRules, function (cssRule2) {
  716. return isCSSStyleRule(cssRule2) && cssRule2.selectorText === selector;
  717. }) || cssRules[sheet.insertRule(selector + "{}", 0)];
  718. if (isCSSStyleRule(cssRule)) {
  719. cssRule.style[prop] = "" + value;
  720. }
  721. }
  722. function ruleBy(target, prop, value) {
  723. rule("#" + (isHTMLElement(target) ? target.id : target), prop, value);
  724. }
  725. function isCSSStyleRule(cssRule) {
  726. return cssRule instanceof CSSStyleRule;
  727. }
  728. return {
  729. mount: mount,
  730. destroy: destroy,
  731. rule: rule,
  732. ruleBy: ruleBy
  733. };
  734. }
  735. var ROLE = "role";
  736. var ARIA_CONTROLS = "aria-controls";
  737. var ARIA_CURRENT = "aria-current";
  738. var ARIA_LABEL = "aria-label";
  739. var ARIA_HIDDEN = "aria-hidden";
  740. var TAB_INDEX = "tabindex";
  741. var DISABLED = "disabled";
  742. var ALL_ATTRIBUTES = [ROLE, ARIA_CONTROLS, ARIA_CURRENT, ARIA_LABEL, ARIA_HIDDEN, TAB_INDEX, DISABLED];
  743. var SLIDE = "slide";
  744. var LOOP = "loop";
  745. var FADE = "fade";
  746. function Slide$1(Splide2, index, slideIndex, slide) {
  747. var _EventInterface2 = EventInterface(Splide2),
  748. on = _EventInterface2.on,
  749. emit = _EventInterface2.emit,
  750. bind = _EventInterface2.bind,
  751. destroyEvents = _EventInterface2.destroy;
  752. var Components = Splide2.Components,
  753. root = Splide2.root,
  754. options = Splide2.options;
  755. var isNavigation = options.isNavigation,
  756. updateOnMove = options.updateOnMove;
  757. var resolve = Components.Direction.resolve;
  758. var isClone = slideIndex > -1;
  759. var container = child(slide, "." + CLASS_CONTAINER);
  760. function mount() {
  761. var _this2 = this;
  762. init();
  763. bind(slide, "click keydown", function (e) {
  764. emit(e.type === "click" ? EVENT_CLICK : EVENT_SLIDE_KEYDOWN, _this2, e);
  765. });
  766. on([EVENT_MOUNTED, EVENT_MOVED, EVENT_UPDATED, EVENT_SCROLLED], update.bind(this));
  767. on(EVENT_RESIZED, onResized.bind(this));
  768. if (updateOnMove) {
  769. on(EVENT_MOVE, onMove.bind(this));
  770. }
  771. }
  772. function init() {
  773. if (!isClone) {
  774. slide.id = root.id + "-slide" + pad(index + 1);
  775. }
  776. if (isNavigation) {
  777. if (!isHTMLButtonElement(slide)) {
  778. setAttribute(slide, ROLE, "button");
  779. }
  780. var idx = isClone ? slideIndex : index;
  781. var label = format(options.i18n.slideX, idx + 1);
  782. var controls = Splide2.splides.map(function (splide) {
  783. return splide.root.id;
  784. }).join(" ");
  785. setAttribute(slide, ARIA_LABEL, label);
  786. setAttribute(slide, ARIA_CONTROLS, controls);
  787. }
  788. }
  789. function destroy() {
  790. destroyEvents();
  791. removeClass(slide, STATUS_CLASSES);
  792. removeAttribute(slide, ALL_ATTRIBUTES);
  793. }
  794. function onResized() {
  795. if (!Splide2.state.is(CREATED)) {
  796. update.call(this);
  797. }
  798. }
  799. function onMove(next, prev, dest) {
  800. if (dest === index) {
  801. updateActivity.call(this, true);
  802. }
  803. update.call(this);
  804. }
  805. function update() {
  806. var currIndex = Splide2.index;
  807. updateActivity.call(this, isActive());
  808. updateVisibility.call(this, isVisible());
  809. toggleClass(slide, CLASS_PREV, index === currIndex - 1);
  810. toggleClass(slide, CLASS_NEXT, index === currIndex + 1);
  811. }
  812. function updateActivity(active) {
  813. if (active !== hasClass(slide, CLASS_ACTIVE)) {
  814. toggleClass(slide, CLASS_ACTIVE, active);
  815. if (isNavigation) {
  816. setAttribute(slide, ARIA_CURRENT, active || null);
  817. }
  818. emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, this);
  819. }
  820. }
  821. function updateVisibility(visible) {
  822. setAttribute(slide, ARIA_HIDDEN, !visible || null);
  823. setAttribute(slide, TAB_INDEX, visible && options.slideFocus ? 0 : null);
  824. if (visible !== hasClass(slide, CLASS_VISIBLE)) {
  825. toggleClass(slide, CLASS_VISIBLE, visible);
  826. emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, this);
  827. }
  828. }
  829. function rule(prop, value, useContainer) {
  830. var selector = "#" + slide.id + (container && useContainer ? " > ." + CLASS_CONTAINER : "");
  831. Components.Style.rule(selector, prop, value);
  832. }
  833. function isActive() {
  834. return Splide2.index === index;
  835. }
  836. function isVisible() {
  837. if (Splide2.is(FADE)) {
  838. return isActive();
  839. }
  840. var trackRect = rect(Components.Elements.track);
  841. var slideRect = rect(slide);
  842. var left = resolve("left");
  843. var right = resolve("right");
  844. return floor(trackRect[left]) <= slideRect[left] && slideRect[right] <= ceil(trackRect[right]);
  845. }
  846. function isWithin(from, distance) {
  847. var diff = abs(from - index);
  848. if (!Splide2.is(SLIDE) && !isClone) {
  849. diff = min(diff, Splide2.length - diff);
  850. }
  851. return diff <= distance;
  852. }
  853. return {
  854. index: index,
  855. slideIndex: slideIndex,
  856. slide: slide,
  857. container: container,
  858. isClone: isClone,
  859. mount: mount,
  860. destroy: destroy,
  861. rule: rule,
  862. isWithin: isWithin
  863. };
  864. }
  865. function Slides(Splide2, Components2, options) {
  866. var _EventInterface3 = EventInterface(Splide2),
  867. on = _EventInterface3.on,
  868. emit = _EventInterface3.emit,
  869. bind = _EventInterface3.bind;
  870. var _Components2$Elements = Components2.Elements,
  871. slides = _Components2$Elements.slides,
  872. list = _Components2$Elements.list;
  873. var Slides2 = [];
  874. function mount() {
  875. init();
  876. on(EVENT_REFRESH, refresh);
  877. }
  878. function init() {
  879. slides.forEach(function (slide, index) {
  880. register(slide, index, -1);
  881. });
  882. }
  883. function destroy() {
  884. forEach$1(function (Slide2) {
  885. Slide2.destroy();
  886. });
  887. empty(Slides2);
  888. }
  889. function refresh() {
  890. destroy();
  891. init();
  892. }
  893. function register(slide, index, slideIndex) {
  894. var object = Slide$1(Splide2, index, slideIndex, slide);
  895. object.mount();
  896. Slides2.push(object);
  897. }
  898. function get(excludeClones) {
  899. return excludeClones ? filter(function (Slide2) {
  900. return !Slide2.isClone;
  901. }) : Slides2;
  902. }
  903. function getIn(page) {
  904. var Controller = Components2.Controller;
  905. var index = Controller.toIndex(page);
  906. var max = Controller.hasFocus() ? 1 : options.perPage;
  907. return filter(function (Slide2) {
  908. return between(Slide2.index, index, index + max - 1);
  909. });
  910. }
  911. function getAt(index) {
  912. return filter(index)[0];
  913. }
  914. function add(items, index) {
  915. forEach(items, function (slide) {
  916. if (isString(slide)) {
  917. slide = parseHtml(slide);
  918. }
  919. if (isHTMLElement(slide)) {
  920. var ref = slides[index];
  921. ref ? before(slide, ref) : append(list, slide);
  922. addClass(slide, options.classes.slide);
  923. observeImages(slide, emit.bind(null, EVENT_RESIZE));
  924. }
  925. });
  926. emit(EVENT_REFRESH);
  927. }
  928. function remove$1(matcher) {
  929. remove(filter(matcher).map(function (Slide2) {
  930. return Slide2.slide;
  931. }));
  932. emit(EVENT_REFRESH);
  933. }
  934. function forEach$1(iteratee, excludeClones) {
  935. get(excludeClones).forEach(iteratee);
  936. }
  937. function filter(matcher) {
  938. return Slides2.filter(isFunction(matcher) ? matcher : function (Slide2) {
  939. return isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index);
  940. });
  941. }
  942. function rule(prop, value, useContainer) {
  943. forEach$1(function (Slide2) {
  944. Slide2.rule(prop, value, useContainer);
  945. });
  946. }
  947. function observeImages(elm, callback) {
  948. var images = queryAll(elm, "img");
  949. var length = images.length;
  950. if (length) {
  951. images.forEach(function (img) {
  952. bind(img, "load error", function () {
  953. if (! --length) {
  954. callback();
  955. }
  956. });
  957. });
  958. } else {
  959. callback();
  960. }
  961. }
  962. function getLength(excludeClones) {
  963. return excludeClones ? slides.length : Slides2.length;
  964. }
  965. function isEnough() {
  966. return Slides2.length > options.perPage;
  967. }
  968. return {
  969. mount: mount,
  970. destroy: destroy,
  971. register: register,
  972. get: get,
  973. getIn: getIn,
  974. getAt: getAt,
  975. add: add,
  976. remove: remove$1,
  977. forEach: forEach$1,
  978. filter: filter,
  979. rule: rule,
  980. getLength: getLength,
  981. isEnough: isEnough
  982. };
  983. }
  984. function Clones(Splide2, Components2, options) {
  985. var _EventInterface4 = EventInterface(Splide2),
  986. on = _EventInterface4.on,
  987. emit = _EventInterface4.emit;
  988. var Elements = Components2.Elements,
  989. Slides = Components2.Slides;
  990. var resolve = Components2.Direction.resolve;
  991. var clones = [];
  992. var cloneCount;
  993. var cloneIndex;
  994. function mount() {
  995. init();
  996. on(EVENT_REFRESH, refresh);
  997. on([EVENT_UPDATED, EVENT_RESIZE], observe);
  998. }
  999. function init() {
  1000. if (cloneCount = computeCloneCount()) {
  1001. generate(cloneCount);
  1002. }
  1003. }
  1004. function destroy() {
  1005. remove(clones);
  1006. empty(clones);
  1007. }
  1008. function refresh() {
  1009. destroy();
  1010. init();
  1011. }
  1012. function observe() {
  1013. if (cloneCount !== computeCloneCount()) {
  1014. emit(EVENT_REFRESH);
  1015. }
  1016. }
  1017. function generate(count) {
  1018. var slides = Slides.get().slice();
  1019. var length = slides.length;
  1020. if (length) {
  1021. cloneIndex = 0;
  1022. while (slides.length < count) {
  1023. push(slides, slides);
  1024. }
  1025. slides.slice(-count).concat(slides.slice(0, count)).forEach(function (Slide, index) {
  1026. var isHead = index < count;
  1027. var clone = cloneDeep(Slide.slide);
  1028. isHead ? before(clone, slides[0].slide) : append(Elements.list, clone);
  1029. push(clones, clone);
  1030. Slides.register(clone, index - count + (isHead ? 0 : length), Slide.index);
  1031. });
  1032. }
  1033. }
  1034. function cloneDeep(elm) {
  1035. var clone = elm.cloneNode(true);
  1036. addClass(clone, options.classes.clone);
  1037. clone.id = Splide2.root.id + "-clone" + pad(++cloneIndex);
  1038. return clone;
  1039. }
  1040. function computeCloneCount() {
  1041. var clones2 = options.clones;
  1042. if (!Splide2.is(LOOP)) {
  1043. clones2 = 0;
  1044. } else if (!clones2) {
  1045. var fixedSize = options[resolve("fixedWidth")];
  1046. var fixedCount = fixedSize && ceil(rect(Elements.track)[resolve("width")] / fixedSize);
  1047. var baseCount = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage;
  1048. clones2 = baseCount * (options.drag ? (options.flickMaxPages || 1) + 1 : 2);
  1049. }
  1050. return clones2;
  1051. }
  1052. return {
  1053. mount: mount,
  1054. destroy: destroy
  1055. };
  1056. }
  1057. function Layout(Splide2, Components2, options) {
  1058. var _EventInterface5 = EventInterface(Splide2),
  1059. on = _EventInterface5.on,
  1060. bind = _EventInterface5.bind,
  1061. emit = _EventInterface5.emit;
  1062. var Slides = Components2.Slides;
  1063. var ruleBy = Components2.Style.ruleBy;
  1064. var resolve = Components2.Direction.resolve;
  1065. var _Components2$Elements2 = Components2.Elements,
  1066. root = _Components2$Elements2.root,
  1067. track = _Components2$Elements2.track,
  1068. list = _Components2$Elements2.list;
  1069. var getAt = Slides.getAt;
  1070. var vertical = options.direction === TTB;
  1071. function mount() {
  1072. init();
  1073. bind(window, "resize load", Throttle(emit.bind(this, EVENT_RESIZE)));
  1074. on([EVENT_UPDATED, EVENT_REFRESH], init);
  1075. on(EVENT_RESIZE, resize);
  1076. }
  1077. function init() {
  1078. ruleBy(root, "maxWidth", unit(options.width));
  1079. ruleBy(track, resolve("paddingLeft"), cssPadding(false));
  1080. ruleBy(track, resolve("paddingRight"), cssPadding(true));
  1081. Slides.rule(resolve("marginRight"), unit(options.gap));
  1082. Slides.rule("width", cssSlideWidth());
  1083. setSlidesHeight();
  1084. resize();
  1085. }
  1086. function resize() {
  1087. ruleBy(track, "height", cssTrackHeight());
  1088. options.heightRatio && setSlidesHeight();
  1089. emit(EVENT_RESIZED);
  1090. }
  1091. function setSlidesHeight() {
  1092. Slides.rule("height", cssSlideHeight(), true);
  1093. }
  1094. function cssPadding(right) {
  1095. var padding = options.padding;
  1096. var prop = resolve(right ? "right" : "left", true);
  1097. return padding ? unit(padding[prop] || (isObject(padding) ? "0" : padding)) : "";
  1098. }
  1099. function cssTrackHeight() {
  1100. var height = "";
  1101. if (vertical) {
  1102. height = cssHeight();
  1103. assert(height, '"height" or "heightRatio" is missing.');
  1104. var paddingTop = cssPadding(false);
  1105. var paddingBottom = cssPadding(true);
  1106. if (paddingTop || paddingBottom) {
  1107. height = "calc(" + height;
  1108. height += "" + (paddingTop ? " - " + paddingTop : "") + (paddingBottom ? " - " + paddingBottom : "") + ")";
  1109. }
  1110. }
  1111. return height;
  1112. }
  1113. function cssHeight() {
  1114. return unit(options.height || rect(list).width * options.heightRatio);
  1115. }
  1116. function cssSlideWidth() {
  1117. return options.autoWidth ? "" : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
  1118. }
  1119. function cssSlideHeight() {
  1120. return unit(options.fixedHeight) || (vertical ? options.autoHeight ? "" : cssSlideSize() : cssHeight());
  1121. }
  1122. function cssSlideSize() {
  1123. var gap = unit(options.gap);
  1124. return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")";
  1125. }
  1126. function listSize() {
  1127. return rect(list)[resolve("width")];
  1128. }
  1129. function slideSize(index, withoutGap) {
  1130. var Slide = getAt(index || 0);
  1131. return Slide ? rect(Slide.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0;
  1132. }
  1133. function totalSize(index, withoutGap) {
  1134. var Slide = getAt(index);
  1135. if (Slide) {
  1136. var right = rect(Slide.slide)[resolve("right")];
  1137. var left = rect(list)[resolve("left")];
  1138. return abs(right - left) + (withoutGap ? 0 : getGap());
  1139. }
  1140. return 0;
  1141. }
  1142. function sliderSize() {
  1143. var firstSlide = getAt(0);
  1144. var lastSlide = getAt(Slides.getLength(true) - 1);
  1145. if (firstSlide && lastSlide) {
  1146. return rect(lastSlide.slide)[resolve("right")] - rect(firstSlide.slide)[resolve("left")];
  1147. }
  1148. return 0;
  1149. }
  1150. function getGap() {
  1151. var Slide = getAt(0);
  1152. return Slide ? parseFloat(style(Slide.slide, resolve("marginRight"))) || 0 : 0;
  1153. }
  1154. function getPadding(right) {
  1155. return parseFloat(style(track, resolve("padding" + (right ? "Right" : "Left"), true))) || 0;
  1156. }
  1157. return {
  1158. mount: mount,
  1159. listSize: listSize,
  1160. slideSize: slideSize,
  1161. sliderSize: sliderSize,
  1162. totalSize: totalSize,
  1163. getPadding: getPadding
  1164. };
  1165. }
  1166. function Move(Splide2, Components2, options) {
  1167. var _EventInterface6 = EventInterface(Splide2),
  1168. on = _EventInterface6.on,
  1169. emit = _EventInterface6.emit;
  1170. var _Components2$Layout = Components2.Layout,
  1171. slideSize = _Components2$Layout.slideSize,
  1172. getPadding = _Components2$Layout.getPadding,
  1173. totalSize = _Components2$Layout.totalSize,
  1174. listSize = _Components2$Layout.listSize,
  1175. sliderSize = _Components2$Layout.sliderSize;
  1176. var _Components2$Directio = Components2.Direction,
  1177. resolve = _Components2$Directio.resolve,
  1178. orient = _Components2$Directio.orient;
  1179. var _Components2$Elements3 = Components2.Elements,
  1180. list = _Components2$Elements3.list,
  1181. track = _Components2$Elements3.track;
  1182. var looping;
  1183. var waiting;
  1184. var currPosition = 0;
  1185. var positionRate = 0;
  1186. function mount() {
  1187. on([EVENT_RESIZE, EVENT_UPDATED, EVENT_REFRESH], reposition);
  1188. }
  1189. function reposition() {
  1190. if (options.drag !== "free") {
  1191. jump(Splide2.index);
  1192. } else {
  1193. if (!options[resolve("fixedWidth")] && !options[resolve("autoWidth")]) {
  1194. translate(listSize() * positionRate);
  1195. }
  1196. if (isExceededMax(currPosition)) {
  1197. translate(getLimit(true));
  1198. }
  1199. }
  1200. }
  1201. function move(dest, index, prev) {
  1202. if (!isBusy()) {
  1203. var position = getPosition();
  1204. looping = dest !== index;
  1205. waiting = options.waitForTransition;
  1206. Splide2.state.set(MOVING);
  1207. emit(EVENT_MOVE, index, prev, dest);
  1208. Components2.Transition.start(dest, function () {
  1209. onMoved(dest, index, prev, position);
  1210. });
  1211. }
  1212. }
  1213. function onMoved(dest, index, prev, oldPosition) {
  1214. if (looping) {
  1215. jump(index);
  1216. looping = false;
  1217. }
  1218. waiting = false;
  1219. Splide2.state.set(IDLE);
  1220. emit(EVENT_MOVED, index, prev, dest);
  1221. if (options.trimSpace === "move" && dest !== prev && oldPosition === getPosition()) {
  1222. Components2.Controller.go(dest > prev ? ">" : "<");
  1223. }
  1224. }
  1225. function jump(index) {
  1226. translate(toPosition(index, true));
  1227. }
  1228. function translate(position) {
  1229. currPosition = loop(position);
  1230. positionRate = currPosition / listSize();
  1231. Components2.Style.ruleBy(list, "transform", "translate" + resolve("X") + "(" + currPosition + "px)");
  1232. }
  1233. function loop(position) {
  1234. if (!looping && Splide2.is(LOOP)) {
  1235. var diff = position - currPosition;
  1236. var exceededMin = isExceededMin(position);
  1237. var exceededMax = isExceededMax(position);
  1238. if (exceededMin && diff > 0 || exceededMax && diff < 0) {
  1239. position += orient(sliderSize() * (exceededMin ? 1 : -1));
  1240. }
  1241. }
  1242. return position;
  1243. }
  1244. function cancel() {
  1245. translate(getPosition());
  1246. Components2.Transition.cancel();
  1247. }
  1248. function toIndex(position) {
  1249. var Slides = Components2.Slides.get();
  1250. var index = 0;
  1251. var minDistance = Infinity;
  1252. for (var i = 0; i < Slides.length; i++) {
  1253. var slideIndex = Slides[i].index;
  1254. var distance = abs(toPosition(slideIndex) - position);
  1255. if (distance < minDistance) {
  1256. minDistance = distance;
  1257. index = slideIndex;
  1258. } else {
  1259. break;
  1260. }
  1261. }
  1262. return index;
  1263. }
  1264. function toPosition(index, trimming) {
  1265. var position = orient(totalSize(index - 1) - offset(index));
  1266. return trimming ? trim(position) : position;
  1267. }
  1268. function getPosition() {
  1269. var left = resolve("left");
  1270. return rect(list)[left] - rect(track)[left] + orient(getPadding(false));
  1271. }
  1272. function trim(position) {
  1273. if (options.trimSpace && Splide2.is(SLIDE)) {
  1274. position = clamp(position, 0, orient(sliderSize() - listSize()));
  1275. }
  1276. return position;
  1277. }
  1278. function offset(index) {
  1279. var focus = options.focus;
  1280. if (focus === "center") {
  1281. return (listSize() - slideSize(index, true)) / 2;
  1282. }
  1283. return (+focus || 0) * slideSize(index);
  1284. }
  1285. function getLimit(max) {
  1286. var trimming = !!options.trimSpace;
  1287. return max ? toPosition(Components2.Controller.getEnd(), trimming) : toPosition(0, trimming);
  1288. }
  1289. function isBusy() {
  1290. return !!(looping || waiting);
  1291. }
  1292. function isExceededMin(position, offset2) {
  1293. return orient(position) + (offset2 || 0) < orient(getLimit(false));
  1294. }
  1295. function isExceededMax(position, offset2) {
  1296. return orient(position) + (offset2 || 0) > orient(getLimit(true));
  1297. }
  1298. function isExceeded() {
  1299. return isExceededMin(currPosition) || isExceededMax(currPosition);
  1300. }
  1301. return {
  1302. mount: mount,
  1303. move: move,
  1304. jump: jump,
  1305. translate: translate,
  1306. cancel: cancel,
  1307. toIndex: toIndex,
  1308. toPosition: toPosition,
  1309. getPosition: getPosition,
  1310. getLimit: getLimit,
  1311. isBusy: isBusy,
  1312. isExceededMin: isExceededMin,
  1313. isExceededMax: isExceededMax,
  1314. isExceeded: isExceeded
  1315. };
  1316. }
  1317. function Controller(Splide2, Components2, options) {
  1318. var _EventInterface7 = EventInterface(Splide2),
  1319. on = _EventInterface7.on;
  1320. var Move = Components2.Move;
  1321. var _Components2$Slides = Components2.Slides,
  1322. isEnough = _Components2$Slides.isEnough,
  1323. getLength = _Components2$Slides.getLength;
  1324. var isLoop = Splide2.is(LOOP);
  1325. var currIndex = options.start || 0;
  1326. var prevIndex = currIndex;
  1327. var slideCount;
  1328. var perMove;
  1329. var perPage;
  1330. function mount() {
  1331. init();
  1332. Move.jump(currIndex);
  1333. on([EVENT_UPDATED, EVENT_REFRESH], init);
  1334. on(EVENT_SCROLLED, function () {
  1335. setIndex(Move.toIndex(Move.getPosition()));
  1336. }, 0);
  1337. }
  1338. function init() {
  1339. slideCount = getLength(true);
  1340. perMove = options.perMove;
  1341. perPage = options.perPage;
  1342. }
  1343. function go(control, allowSameIndex) {
  1344. var dest = parse(control);
  1345. var index = loop(dest);
  1346. if (index > -1 && !Move.isBusy() && (allowSameIndex || index !== currIndex)) {
  1347. setIndex(index);
  1348. Move.move(dest, index, prevIndex);
  1349. }
  1350. }
  1351. function parse(control) {
  1352. var index = currIndex;
  1353. if (isString(control)) {
  1354. var _ref = control.match(/([+\-<>])(\d+)?/) || [],
  1355. indicator = _ref[1],
  1356. number = _ref[2];
  1357. if (indicator === "+" || indicator === "-") {
  1358. index = computeDestIndex(currIndex + +("" + indicator + (+number || 1)), currIndex, true);
  1359. } else if (indicator === ">") {
  1360. index = number ? toIndex(+number) : getNext(true);
  1361. } else if (indicator === "<") {
  1362. index = getPrev(true);
  1363. }
  1364. } else {
  1365. if (isLoop) {
  1366. index = clamp(control, -perPage, slideCount + perPage - 1);
  1367. } else {
  1368. index = clamp(control, 0, getEnd());
  1369. }
  1370. }
  1371. return index;
  1372. }
  1373. function getNext(destination) {
  1374. return getAdjacent(false, destination);
  1375. }
  1376. function getPrev(destination) {
  1377. return getAdjacent(true, destination);
  1378. }
  1379. function getAdjacent(prev, destination) {
  1380. var dest = computeDestIndex(currIndex + getPerMove() * (prev ? -1 : 1), currIndex);
  1381. return destination ? dest : loop(dest);
  1382. }
  1383. function computeDestIndex(dest, from, incremental) {
  1384. if (isEnough()) {
  1385. var end = getEnd();
  1386. if (dest < 0 || dest > end) {
  1387. if (between(0, dest, from, true) || between(end, from, dest, true)) {
  1388. dest = toIndex(toPage(dest));
  1389. } else {
  1390. if (isLoop) {
  1391. dest = perMove ? dest : dest < 0 ? -(slideCount % perPage || perPage) : slideCount;
  1392. } else if (options.rewind) {
  1393. dest = dest < 0 ? end : 0;
  1394. } else {
  1395. dest = -1;
  1396. }
  1397. }
  1398. } else {
  1399. if (!isLoop && !incremental && dest !== from) {
  1400. dest = toIndex(toPage(from) + (dest < from ? -1 : 1));
  1401. }
  1402. }
  1403. } else {
  1404. dest = -1;
  1405. }
  1406. return dest;
  1407. }
  1408. function getEnd() {
  1409. var end = slideCount - perPage;
  1410. if (hasFocus() || isLoop && perMove) {
  1411. end = slideCount - 1;
  1412. }
  1413. return max(end, 0);
  1414. }
  1415. function loop(index) {
  1416. if (isLoop) {
  1417. return isEnough() ? index % slideCount + (index < 0 ? slideCount : 0) : -1;
  1418. }
  1419. return index;
  1420. }
  1421. function toIndex(page) {
  1422. return clamp(hasFocus() ? page : perPage * page, 0, getEnd());
  1423. }
  1424. function toPage(index) {
  1425. if (!hasFocus()) {
  1426. index = between(index, slideCount - perPage, slideCount - 1) ? slideCount - 1 : index;
  1427. index = floor(index / perPage);
  1428. }
  1429. return index;
  1430. }
  1431. function getPerMove() {
  1432. return perMove || hasFocus() ? 1 : perPage;
  1433. }
  1434. function setIndex(index) {
  1435. if (index !== currIndex) {
  1436. prevIndex = currIndex;
  1437. currIndex = index;
  1438. }
  1439. }
  1440. function getIndex(prev) {
  1441. return prev ? prevIndex : currIndex;
  1442. }
  1443. function hasFocus() {
  1444. return !isUndefined(options.focus) || options.isNavigation;
  1445. }
  1446. return {
  1447. mount: mount,
  1448. go: go,
  1449. getNext: getNext,
  1450. getPrev: getPrev,
  1451. getEnd: getEnd,
  1452. setIndex: setIndex,
  1453. getIndex: getIndex,
  1454. toIndex: toIndex,
  1455. toPage: toPage,
  1456. hasFocus: hasFocus
  1457. };
  1458. }
  1459. var XML_NAME_SPACE = "http://www.w3.org/2000/svg";
  1460. var PATH = "m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z";
  1461. var SIZE = 40;
  1462. function Arrows(Splide2, Components2, options) {
  1463. var _EventInterface8 = EventInterface(Splide2),
  1464. on = _EventInterface8.on,
  1465. bind = _EventInterface8.bind,
  1466. emit = _EventInterface8.emit;
  1467. var classes = options.classes,
  1468. i18n = options.i18n;
  1469. var Elements = Components2.Elements,
  1470. Controller = Components2.Controller;
  1471. var slider = Elements.slider,
  1472. track = Elements.track;
  1473. var wrapper = Elements.arrows;
  1474. var prev = Elements.prev;
  1475. var next = Elements.next;
  1476. var created;
  1477. var arrows = {};
  1478. function mount() {
  1479. init();
  1480. on(EVENT_UPDATED, init);
  1481. }
  1482. function init() {
  1483. if (options.arrows) {
  1484. if (!prev || !next) {
  1485. createArrows();
  1486. }
  1487. }
  1488. if (prev && next) {
  1489. if (!arrows.prev) {
  1490. setAttribute(prev, ARIA_CONTROLS, track.id);
  1491. setAttribute(next, ARIA_CONTROLS, track.id);
  1492. arrows.prev = prev;
  1493. arrows.next = next;
  1494. listen();
  1495. emit(EVENT_ARROWS_MOUNTED, prev, next);
  1496. } else {
  1497. display(wrapper, options.arrows === false ? "none" : "");
  1498. }
  1499. }
  1500. }
  1501. function destroy() {
  1502. if (created) {
  1503. remove(wrapper);
  1504. } else {
  1505. removeAttribute(prev, ALL_ATTRIBUTES);
  1506. removeAttribute(next, ALL_ATTRIBUTES);
  1507. }
  1508. }
  1509. function listen() {
  1510. var go = Controller.go;
  1511. on([EVENT_MOUNTED, EVENT_MOVE, EVENT_UPDATED, EVENT_REFRESH, EVENT_SCROLLED], update);
  1512. bind(next, "click", function () {
  1513. go(">");
  1514. });
  1515. bind(prev, "click", function () {
  1516. go("<");
  1517. });
  1518. }
  1519. function createArrows() {
  1520. var parent = options.arrows === "slider" && slider ? slider : Splide2.root;
  1521. wrapper = create("div", classes.arrows);
  1522. prev = createArrow(true);
  1523. next = createArrow(false);
  1524. created = true;
  1525. append(wrapper, [prev, next]);
  1526. before(wrapper, child(parent));
  1527. }
  1528. function createArrow(prev2) {
  1529. var arrow = "<button class=\"" + classes.arrow + " " + (prev2 ? classes.prev : classes.next) + "\" type=\"button\"><svg xmlns=\"" + XML_NAME_SPACE + "\" viewBox=\"0 0 " + SIZE + " " + SIZE + "\" width=\"" + SIZE + "\" height=\"" + SIZE + "\"><path d=\"" + (options.arrowPath || PATH) + "\" />";
  1530. return parseHtml(arrow);
  1531. }
  1532. function update() {
  1533. var index = Splide2.index;
  1534. var prevIndex = Controller.getPrev();
  1535. var nextIndex = Controller.getNext();
  1536. var prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev;
  1537. var nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next;
  1538. prev.disabled = prevIndex < 0;
  1539. next.disabled = nextIndex < 0;
  1540. setAttribute(prev, ARIA_LABEL, prevLabel);
  1541. setAttribute(next, ARIA_LABEL, nextLabel);
  1542. emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex);
  1543. }
  1544. return {
  1545. arrows: arrows,
  1546. mount: mount,
  1547. destroy: destroy
  1548. };
  1549. }
  1550. function Autoplay(Splide2, Components2, options) {
  1551. var _EventInterface9 = EventInterface(Splide2),
  1552. on = _EventInterface9.on,
  1553. bind = _EventInterface9.bind,
  1554. emit = _EventInterface9.emit;
  1555. var _Components2$Elements4 = Components2.Elements,
  1556. root = _Components2$Elements4.root,
  1557. track = _Components2$Elements4.track,
  1558. bar = _Components2$Elements4.bar,
  1559. playButton = _Components2$Elements4.play,
  1560. pauseButton = _Components2$Elements4.pause;
  1561. var interval = RequestInterval(options.interval, Splide2.go.bind(Splide2, ">"), update);
  1562. var isPaused = interval.isPaused;
  1563. var hovered;
  1564. var focused;
  1565. var paused;
  1566. function mount() {
  1567. var autoplay = options.autoplay;
  1568. if (autoplay) {
  1569. initButton(true);
  1570. initButton(false);
  1571. listen();
  1572. if (autoplay !== "pause") {
  1573. play();
  1574. }
  1575. }
  1576. }
  1577. function initButton(forPause) {
  1578. var button = forPause ? pauseButton : playButton;
  1579. if (button) {
  1580. if (!isHTMLButtonElement(button)) {
  1581. setAttribute(button, ROLE, "button");
  1582. }
  1583. setAttribute(button, ARIA_CONTROLS, track.id);
  1584. setAttribute(button, ARIA_LABEL, options.i18n[forPause ? "pause" : "play"]);
  1585. bind(button, "click", forPause ? pause : play);
  1586. }
  1587. }
  1588. function listen() {
  1589. if (options.pauseOnHover) {
  1590. bind(root, "mouseenter mouseleave", function (e) {
  1591. hovered = e.type === "mouseenter";
  1592. autoToggle();
  1593. });
  1594. }
  1595. if (options.pauseOnFocus) {
  1596. bind(root, "focusin focusout", function (e) {
  1597. focused = e.type === "focusin";
  1598. autoToggle();
  1599. });
  1600. }
  1601. on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind);
  1602. }
  1603. function play() {
  1604. if (isPaused() && Components2.Slides.isEnough()) {
  1605. interval.start(!options.resetProgress);
  1606. focused = false;
  1607. hovered = false;
  1608. emit(EVENT_AUTOPLAY_PLAY);
  1609. }
  1610. }
  1611. function pause(manual) {
  1612. if (manual === void 0) {
  1613. manual = true;
  1614. }
  1615. if (!isPaused()) {
  1616. interval.pause();
  1617. emit(EVENT_AUTOPLAY_PAUSE);
  1618. }
  1619. paused = manual;
  1620. }
  1621. function autoToggle() {
  1622. if (!paused) {
  1623. if (!hovered && !focused) {
  1624. play();
  1625. } else {
  1626. pause(false);
  1627. }
  1628. }
  1629. }
  1630. function update(rate) {
  1631. emit(EVENT_AUTOPLAY_PLAYING, rate);
  1632. if (bar) {
  1633. style(bar, {
  1634. width: rate * 100 + "%"
  1635. });
  1636. }
  1637. }
  1638. return {
  1639. mount: mount,
  1640. destroy: interval.cancel,
  1641. play: play,
  1642. pause: pause,
  1643. isPaused: isPaused
  1644. };
  1645. }
  1646. function Cover(Splide2, Components2, options) {
  1647. var _EventInterface10 = EventInterface(Splide2),
  1648. on = _EventInterface10.on;
  1649. function mount() {
  1650. if (options.cover) {
  1651. on(EVENT_LAZYLOAD_LOADED, function (img, Slide) {
  1652. toggle(true, img, Slide);
  1653. });
  1654. on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply.bind(null, true));
  1655. }
  1656. }
  1657. function destroy() {
  1658. apply(false);
  1659. }
  1660. function apply(cover) {
  1661. Components2.Slides.forEach(function (Slide) {
  1662. var img = child(Slide.container || Slide.slide, "img");
  1663. if (img && img.src) {
  1664. toggle(cover, img, Slide);
  1665. }
  1666. });
  1667. }
  1668. function toggle(cover, img, Slide) {
  1669. Slide.rule("background", cover ? "center/cover no-repeat url(\"" + img.src + "\")" : "", true);
  1670. display(img, cover ? "none" : "");
  1671. }
  1672. return {
  1673. mount: mount,
  1674. destroy: destroy
  1675. };
  1676. }
  1677. var BOUNCE_DIFF_THRESHOLD = 10;
  1678. var BOUNCE_DURATION = 600;
  1679. var FRICTION_FACTOR = 0.6;
  1680. var BASE_VELOCITY = 1.2;
  1681. var MIN_DURATION = 800;
  1682. function Scroll(Splide2, Components2, options) {
  1683. var _EventInterface11 = EventInterface(Splide2),
  1684. on = _EventInterface11.on,
  1685. emit = _EventInterface11.emit;
  1686. var Move = Components2.Move;
  1687. var getPosition = Move.getPosition,
  1688. getLimit = Move.getLimit;
  1689. var interval;
  1690. function mount() {
  1691. on(EVENT_MOVE, clear);
  1692. on([EVENT_UPDATED, EVENT_REFRESH], cancel);
  1693. }
  1694. function scroll(destination, duration, suppressConstraint) {
  1695. var start = getPosition();
  1696. var friction = 1;
  1697. duration = duration || computeDuration(abs(destination - start));
  1698. clear();
  1699. interval = RequestInterval(duration, onScrolled, function (rate) {
  1700. var position = getPosition();
  1701. var target = start + (destination - start) * easing(rate);
  1702. var diff = (target - getPosition()) * friction;
  1703. Move.translate(position + diff);
  1704. if (Splide2.is(SLIDE) && !suppressConstraint && Move.isExceeded()) {
  1705. friction *= FRICTION_FACTOR;
  1706. if (abs(diff) < BOUNCE_DIFF_THRESHOLD) {
  1707. bounce(Move.isExceededMin(getPosition()));
  1708. }
  1709. }
  1710. }, 1);
  1711. emit(EVENT_SCROLL);
  1712. interval.start();
  1713. }
  1714. function bounce(backwards) {
  1715. scroll(getLimit(!backwards), BOUNCE_DURATION, true);
  1716. }
  1717. function onScrolled() {
  1718. emit(EVENT_SCROLLED);
  1719. }
  1720. function computeDuration(distance) {
  1721. return max(distance / BASE_VELOCITY, MIN_DURATION);
  1722. }
  1723. function clear() {
  1724. if (interval) {
  1725. interval.cancel();
  1726. }
  1727. }
  1728. function cancel() {
  1729. if (interval && !interval.isPaused()) {
  1730. clear();
  1731. onScrolled();
  1732. }
  1733. }
  1734. function easing(t) {
  1735. var easingFunc = options.easingFunc;
  1736. return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4);
  1737. }
  1738. return {
  1739. mount: mount,
  1740. destroy: clear,
  1741. scroll: scroll,
  1742. cancel: cancel
  1743. };
  1744. }
  1745. var FRICTION = 5;
  1746. var SAMPLING_INTERVAL = 50;
  1747. var POINTER_DOWN_EVENTS = "touchstart mousedown";
  1748. var POINTER_MOVE_EVENTS = "touchmove mousemove";
  1749. var POINTER_UP_EVENTS = "touchend touchcancel mouseup mouseleave";
  1750. function Drag(Splide2, Components2, options) {
  1751. var _EventInterface12 = EventInterface(Splide2),
  1752. emit = _EventInterface12.emit,
  1753. bind = _EventInterface12.bind,
  1754. unbind = _EventInterface12.unbind;
  1755. var track = Components2.Elements.track;
  1756. var _Components2$Directio2 = Components2.Direction,
  1757. resolve = _Components2$Directio2.resolve,
  1758. orient = _Components2$Directio2.orient;
  1759. var listSize = Components2.Layout.listSize;
  1760. var _Components2$Controll = Components2.Controller,
  1761. go = _Components2$Controll.go,
  1762. getEnd = _Components2$Controll.getEnd;
  1763. var Move = Components2.Move,
  1764. Scroll = Components2.Scroll;
  1765. var translate = Move.translate,
  1766. toIndex = Move.toIndex,
  1767. getPosition = Move.getPosition,
  1768. isExceeded = Move.isExceeded;
  1769. var isSlide = Splide2.is(SLIDE);
  1770. var isFade = Splide2.is(FADE);
  1771. var isFree = options.drag === "free";
  1772. var startCoord;
  1773. var lastTime;
  1774. var basePosition;
  1775. var baseCoord;
  1776. var baseTime;
  1777. var lastEvent;
  1778. var moving;
  1779. var isMouse;
  1780. var target;
  1781. var exceeded;
  1782. function mount() {
  1783. if (options.drag) {
  1784. bind(track, POINTER_DOWN_EVENTS, onPointerDown);
  1785. }
  1786. }
  1787. function onPointerDown(e) {
  1788. isMouse = e.type === "mousedown";
  1789. target = isMouse ? window : track;
  1790. if (!(isMouse && e.button)) {
  1791. if (!Move.isBusy()) {
  1792. bind(target, POINTER_MOVE_EVENTS, onPointerMove);
  1793. bind(target, POINTER_UP_EVENTS, onPointerUp);
  1794. Move.cancel();
  1795. Scroll.cancel();
  1796. startCoord = getCoord(e);
  1797. } else {
  1798. prevent(e);
  1799. }
  1800. }
  1801. }
  1802. function onPointerMove(e) {
  1803. if (e.cancelable) {
  1804. var min2 = options.dragMinThreshold || 15;
  1805. if (isMouse || abs(getCoord(e) - startCoord) > min2) {
  1806. moving = true;
  1807. onDrag();
  1808. }
  1809. if (moving) {
  1810. onDragging(e);
  1811. prevent(e, true);
  1812. }
  1813. } else {
  1814. onPointerUp(e);
  1815. }
  1816. }
  1817. function onPointerUp(e) {
  1818. unbind(target, POINTER_MOVE_EVENTS + " " + POINTER_UP_EVENTS);
  1819. moving = false;
  1820. if (lastEvent) {
  1821. onDragged(e);
  1822. lastEvent = null;
  1823. }
  1824. }
  1825. function onDrag() {
  1826. bind(track, "click", function (e) {
  1827. unbind(track, "click");
  1828. prevent(e, true);
  1829. }, {
  1830. capture: true
  1831. });
  1832. emit(EVENT_DRAG);
  1833. }
  1834. function onDragging(e) {
  1835. var timeStamp = e.timeStamp;
  1836. var expired = !lastTime || timeStamp - lastTime > SAMPLING_INTERVAL;
  1837. if (expired || isExceeded() !== exceeded) {
  1838. basePosition = getPosition();
  1839. baseCoord = getCoord(e);
  1840. baseTime = timeStamp;
  1841. }
  1842. exceeded = isExceeded();
  1843. lastTime = timeStamp;
  1844. lastEvent = e;
  1845. if (!isFade) {
  1846. translate(basePosition + constrain(getCoord(e) - baseCoord));
  1847. }
  1848. emit(EVENT_DRAGGING);
  1849. }
  1850. function onDragged(e) {
  1851. var velocity = computeVelocity(e);
  1852. if (isFade) {
  1853. go(Splide2.index + orient(sign(velocity)));
  1854. } else {
  1855. var destination = computeDestination(velocity);
  1856. if (isFree) {
  1857. Scroll.scroll(destination);
  1858. } else {
  1859. go(computeIndex(destination), true);
  1860. }
  1861. }
  1862. lastTime = 0;
  1863. emit(EVENT_DRAGGED);
  1864. }
  1865. function computeVelocity(e) {
  1866. if (Splide2.is(LOOP) || !isExceeded()) {
  1867. var diffCoord = getCoord(lastEvent) - baseCoord;
  1868. var diffTime = lastEvent.timeStamp - baseTime;
  1869. var isFlick = e.timeStamp - lastTime < SAMPLING_INTERVAL;
  1870. if (diffTime && isFlick) {
  1871. return diffCoord / diffTime;
  1872. }
  1873. }
  1874. return 0;
  1875. }
  1876. function computeDestination(velocity) {
  1877. var flickPower = options.flickPower || 600;
  1878. return getPosition() + sign(velocity) * min(abs(velocity) * flickPower, isFree ? Infinity : listSize() * (options.flickMaxPages || 1));
  1879. }
  1880. function computeIndex(destination) {
  1881. var dest = toIndex(destination);
  1882. return isSlide ? clamp(dest, 0, getEnd()) : dest;
  1883. }
  1884. function getCoord(e) {
  1885. return (isMouse ? e : e.touches[0])[resolve("pageX")];
  1886. }
  1887. function constrain(diff) {
  1888. return diff / (exceeded && isSlide ? FRICTION : 1);
  1889. }
  1890. return {
  1891. mount: mount
  1892. };
  1893. }
  1894. var IE_ARROW_KEYS = ["Left", "Right", "Up", "Down"];
  1895. function Keyboard(Splide2, Components2, options) {
  1896. var _EventInterface13 = EventInterface(Splide2),
  1897. on = _EventInterface13.on,
  1898. bind = _EventInterface13.bind,
  1899. unbind = _EventInterface13.unbind;
  1900. var root = Components2.Elements.root;
  1901. var resolve = Components2.Direction.resolve;
  1902. var target;
  1903. function mount() {
  1904. init();
  1905. on(EVENT_UPDATED, function () {
  1906. destroy();
  1907. init();
  1908. });
  1909. }
  1910. function init() {
  1911. var _options$keyboard = options.keyboard,
  1912. keyboard = _options$keyboard === void 0 ? "global" : _options$keyboard;
  1913. if (keyboard) {
  1914. if (keyboard === "focused") {
  1915. target = root;
  1916. setAttribute(root, TAB_INDEX, 0);
  1917. } else {
  1918. target = window;
  1919. }
  1920. bind(target, "keydown", function (e) {
  1921. var key = normalize(e.key);
  1922. if (key === resolve("ArrowLeft")) {
  1923. Splide2.go("<");
  1924. } else if (key === resolve("ArrowRight")) {
  1925. Splide2.go(">");
  1926. }
  1927. });
  1928. }
  1929. }
  1930. function destroy() {
  1931. if (target) {
  1932. unbind(target, "keydown");
  1933. if (isHTMLElement(target)) {
  1934. removeAttribute(target, TAB_INDEX);
  1935. }
  1936. }
  1937. }
  1938. function normalize(key) {
  1939. return includes(IE_ARROW_KEYS, key) ? "Arrow" + key : key;
  1940. }
  1941. return {
  1942. mount: mount,
  1943. destroy: destroy
  1944. };
  1945. }
  1946. var SRC_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-lazy";
  1947. var SRCSET_DATA_ATTRIBUTE = SRC_DATA_ATTRIBUTE + "-srcset";
  1948. var IMAGE_SELECTOR = "[" + SRC_DATA_ATTRIBUTE + "], [" + SRCSET_DATA_ATTRIBUTE + "]";
  1949. function LazyLoad(Splide2, Components2, options) {
  1950. var _EventInterface14 = EventInterface(Splide2),
  1951. on = _EventInterface14.on,
  1952. off = _EventInterface14.off,
  1953. bind = _EventInterface14.bind,
  1954. emit = _EventInterface14.emit;
  1955. var isSequential = options.lazyLoad === "sequential";
  1956. var images = [];
  1957. var index = 0;
  1958. function mount() {
  1959. if (options.lazyLoad) {
  1960. on([EVENT_MOUNTED, EVENT_REFRESH], function () {
  1961. destroy();
  1962. init();
  1963. });
  1964. if (!isSequential) {
  1965. on([EVENT_MOUNTED, EVENT_REFRESH, EVENT_MOVED], observe);
  1966. }
  1967. }
  1968. }
  1969. function init() {
  1970. Components2.Slides.forEach(function (_Slide) {
  1971. queryAll(_Slide.slide, IMAGE_SELECTOR).forEach(function (_img) {
  1972. var src = getAttribute(_img, SRC_DATA_ATTRIBUTE);
  1973. var srcset = getAttribute(_img, SRCSET_DATA_ATTRIBUTE);
  1974. if (src !== _img.src || srcset !== _img.srcset) {
  1975. var _spinner = create("span", options.classes.spinner, _img.parentElement);
  1976. setAttribute(_spinner, ROLE, "presentation");
  1977. images.push({
  1978. _img: _img,
  1979. _Slide: _Slide,
  1980. src: src,
  1981. srcset: srcset,
  1982. _spinner: _spinner
  1983. });
  1984. display(_img, "none");
  1985. }
  1986. });
  1987. });
  1988. if (isSequential) {
  1989. loadNext();
  1990. }
  1991. }
  1992. function destroy() {
  1993. index = 0;
  1994. images = [];
  1995. }
  1996. function observe() {
  1997. images = images.filter(function (data) {
  1998. if (data._Slide.isWithin(Splide2.index, options.perPage * ((options.preloadPages || 1) + 1))) {
  1999. return load(data);
  2000. }
  2001. return true;
  2002. });
  2003. if (!images.length) {
  2004. off(EVENT_MOVED);
  2005. }
  2006. }
  2007. function load(data) {
  2008. var _img = data._img;
  2009. addClass(data._Slide.slide, CLASS_LOADING);
  2010. bind(_img, "load error", function (e) {
  2011. onLoad(data, e.type === "error");
  2012. });
  2013. ["src", "srcset"].forEach(function (name) {
  2014. if (data[name]) {
  2015. setAttribute(_img, name, data[name]);
  2016. removeAttribute(_img, name === "src" ? SRC_DATA_ATTRIBUTE : SRCSET_DATA_ATTRIBUTE);
  2017. }
  2018. });
  2019. }
  2020. function onLoad(data, error) {
  2021. var _Slide = data._Slide;
  2022. removeClass(_Slide.slide, CLASS_LOADING);
  2023. if (!error) {
  2024. remove(data._spinner);
  2025. display(data._img, "");
  2026. emit(EVENT_LAZYLOAD_LOADED, data._img, _Slide);
  2027. emit(EVENT_RESIZE);
  2028. }
  2029. if (isSequential) {
  2030. loadNext();
  2031. }
  2032. }
  2033. function loadNext() {
  2034. if (index < images.length) {
  2035. load(images[index++]);
  2036. }
  2037. }
  2038. return {
  2039. mount: mount,
  2040. destroy: destroy
  2041. };
  2042. }
  2043. function Pagination(Splide2, Components2, options) {
  2044. var _EventInterface15 = EventInterface(Splide2),
  2045. on = _EventInterface15.on,
  2046. emit = _EventInterface15.emit,
  2047. bind = _EventInterface15.bind,
  2048. unbind = _EventInterface15.unbind;
  2049. var Slides = Components2.Slides;
  2050. var _Components2$Controll2 = Components2.Controller,
  2051. go = _Components2$Controll2.go,
  2052. toPage = _Components2$Controll2.toPage,
  2053. hasFocus = _Components2$Controll2.hasFocus,
  2054. getIndex = _Components2$Controll2.getIndex;
  2055. var items = [];
  2056. var list;
  2057. function mount() {
  2058. init();
  2059. on([EVENT_UPDATED, EVENT_REFRESH], init);
  2060. on([EVENT_MOVE, EVENT_SCROLLED], update);
  2061. }
  2062. function init() {
  2063. destroy();
  2064. if (options.pagination && Slides.isEnough()) {
  2065. createPagination();
  2066. emit(EVENT_PAGINATION_MOUNTED, {
  2067. list: list,
  2068. items: items
  2069. }, getAt(Splide2.index));
  2070. update();
  2071. }
  2072. }
  2073. function destroy() {
  2074. if (list) {
  2075. remove(list);
  2076. items.forEach(function (item) {
  2077. unbind(item.button, "click");
  2078. });
  2079. empty(items);
  2080. list = null;
  2081. }
  2082. }
  2083. function createPagination() {
  2084. var length = Splide2.length;
  2085. var classes = options.classes,
  2086. i18n = options.i18n,
  2087. perPage = options.perPage;
  2088. var _Components2$Elements5 = Components2.Elements,
  2089. slider = _Components2$Elements5.slider,
  2090. root = _Components2$Elements5.root;
  2091. var parent = options.pagination === "slider" && slider ? slider : root;
  2092. var max = hasFocus() ? length : ceil(length / perPage);
  2093. list = create("ul", classes.pagination, parent);
  2094. var _loop = function _loop(i) {
  2095. var li = create("li", null, list);
  2096. var button = create("button", {
  2097. class: classes.page,
  2098. type: "button"
  2099. }, li);
  2100. var controls = Slides.getIn(i).map(function (Slide) {
  2101. return Slide.slide.id;
  2102. });
  2103. var text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX;
  2104. bind(button, "click", function () {
  2105. go(">" + i);
  2106. });
  2107. setAttribute(button, ARIA_CONTROLS, controls.join(" "));
  2108. setAttribute(button, ARIA_LABEL, format(text, i + 1));
  2109. emit(EVENT_PAGINATION_PAGE, list, li, button, i);
  2110. items.push({
  2111. li: li,
  2112. button: button,
  2113. page: i
  2114. });
  2115. };
  2116. for (var i = 0; i < max; i++) {
  2117. _loop(i);
  2118. }
  2119. }
  2120. function getAt(index) {
  2121. return items[toPage(index)];
  2122. }
  2123. function update() {
  2124. var prev = getAt(getIndex(true));
  2125. var curr = getAt(getIndex());
  2126. if (prev) {
  2127. removeClass(prev.button, CLASS_ACTIVE);
  2128. removeAttribute(prev.button, ARIA_CURRENT);
  2129. }
  2130. if (curr) {
  2131. addClass(curr.button, CLASS_ACTIVE);
  2132. setAttribute(curr.button, ARIA_CURRENT, true);
  2133. }
  2134. emit(EVENT_PAGINATION_UPDATED, {
  2135. list: list,
  2136. items: items
  2137. }, prev, curr);
  2138. }
  2139. return {
  2140. items: items,
  2141. mount: mount,
  2142. destroy: destroy,
  2143. getAt: getAt
  2144. };
  2145. }
  2146. var TRIGGER_KEYS = [" ", "Enter", "Spacebar"];
  2147. function Sync(Splide2, Components2, options) {
  2148. var splides = Splide2.splides;
  2149. function mount() {
  2150. if (options.isNavigation) {
  2151. navigate();
  2152. } else {
  2153. sync();
  2154. }
  2155. }
  2156. function sync() {
  2157. var processed = [];
  2158. splides.concat(Splide2).forEach(function (splide, index, instances) {
  2159. EventInterface(splide).on(EVENT_MOVE, function (index2, prev, dest) {
  2160. instances.forEach(function (instance) {
  2161. if (instance !== splide && !includes(processed, splide)) {
  2162. processed.push(instance);
  2163. instance.go(instance.is(LOOP) ? dest : index2);
  2164. }
  2165. });
  2166. empty(processed);
  2167. });
  2168. });
  2169. }
  2170. function navigate() {
  2171. var _EventInterface16 = EventInterface(Splide2),
  2172. on = _EventInterface16.on,
  2173. emit = _EventInterface16.emit;
  2174. on(EVENT_CLICK, function (Slide) {
  2175. Splide2.go(Slide.index);
  2176. });
  2177. on(EVENT_SLIDE_KEYDOWN, function (Slide, e) {
  2178. if (includes(TRIGGER_KEYS, e.key)) {
  2179. Splide2.go(Slide.index);
  2180. prevent(e);
  2181. }
  2182. });
  2183. emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides);
  2184. }
  2185. return {
  2186. mount: mount
  2187. };
  2188. }
  2189. function Wheel(Splide2, Components2, options) {
  2190. var _EventInterface17 = EventInterface(Splide2),
  2191. bind = _EventInterface17.bind;
  2192. function mount() {
  2193. if (options.wheel) {
  2194. bind(Components2.Elements.track, "wheel", onWheel);
  2195. }
  2196. }
  2197. function onWheel(e) {
  2198. var deltaY = e.deltaY;
  2199. if (deltaY) {
  2200. Splide2.go(deltaY < 0 ? "<" : ">");
  2201. prevent(e);
  2202. }
  2203. }
  2204. return {
  2205. mount: mount
  2206. };
  2207. }
  2208. var ComponentConstructors = /*#__PURE__*/Object.freeze({
  2209. __proto__: null,
  2210. Options: Options,
  2211. Direction: Direction,
  2212. Elements: Elements,
  2213. Style: Style,
  2214. Slides: Slides,
  2215. Clones: Clones,
  2216. Layout: Layout,
  2217. Move: Move,
  2218. Controller: Controller,
  2219. Arrows: Arrows,
  2220. Autoplay: Autoplay,
  2221. Cover: Cover,
  2222. Scroll: Scroll,
  2223. Drag: Drag,
  2224. Keyboard: Keyboard,
  2225. LazyLoad: LazyLoad,
  2226. Pagination: Pagination,
  2227. Sync: Sync,
  2228. Wheel: Wheel
  2229. });
  2230. var I18N = {
  2231. prev: "Previous slide",
  2232. next: "Next slide",
  2233. first: "Go to first slide",
  2234. last: "Go to last slide",
  2235. slideX: "Go to slide %s",
  2236. pageX: "Go to page %s",
  2237. play: "Start autoplay",
  2238. pause: "Pause autoplay"
  2239. };
  2240. var DEFAULTS = {
  2241. type: "slide",
  2242. speed: 400,
  2243. waitForTransition: true,
  2244. perPage: 1,
  2245. arrows: true,
  2246. pagination: true,
  2247. interval: 5e3,
  2248. pauseOnHover: true,
  2249. pauseOnFocus: true,
  2250. resetProgress: true,
  2251. easing: "cubic-bezier(.42,.65,.27,.99)",
  2252. drag: true,
  2253. direction: "ltr",
  2254. slideFocus: true,
  2255. trimSpace: true,
  2256. classes: CLASSES,
  2257. i18n: I18N
  2258. };
  2259. function Fade(Splide2, Components2, options) {
  2260. var _EventInterface18 = EventInterface(Splide2),
  2261. on = _EventInterface18.on;
  2262. var ruleBy = Components2.Style.ruleBy;
  2263. function mount() {
  2264. on([EVENT_MOUNTED, EVENT_REFRESH], function () {
  2265. nextTick(function () {
  2266. Components2.Slides.forEach(function (Slide) {
  2267. ruleBy(Slide.slide, "transition", "opacity " + options.speed + "ms " + options.easing);
  2268. });
  2269. });
  2270. });
  2271. }
  2272. function start(index, done) {
  2273. var track = Components2.Elements.track;
  2274. ruleBy(track, "height", unit(rect(track).height));
  2275. nextTick(function () {
  2276. done();
  2277. ruleBy(track, "height", "");
  2278. });
  2279. }
  2280. return {
  2281. mount: mount,
  2282. start: start,
  2283. cancel: noop
  2284. };
  2285. }
  2286. function Slide(Splide2, Components2, options) {
  2287. var _EventInterface19 = EventInterface(Splide2),
  2288. bind = _EventInterface19.bind;
  2289. var Move = Components2.Move,
  2290. Controller = Components2.Controller;
  2291. var list = Components2.Elements.list;
  2292. var endCallback;
  2293. function mount() {
  2294. bind(list, "transitionend", function (e) {
  2295. if (e.target === list && endCallback) {
  2296. cancel();
  2297. endCallback();
  2298. }
  2299. });
  2300. }
  2301. function start(index, done) {
  2302. var destination = Move.toPosition(index, true);
  2303. var position = Move.getPosition();
  2304. var speed = getSpeed(index);
  2305. if (abs(destination - position) >= 1 && speed >= 1) {
  2306. apply("transform " + speed + "ms " + options.easing);
  2307. Move.translate(destination);
  2308. endCallback = done;
  2309. } else {
  2310. Move.jump(index);
  2311. done();
  2312. }
  2313. }
  2314. function cancel() {
  2315. apply("");
  2316. }
  2317. function getSpeed(index) {
  2318. var rewindSpeed = options.rewindSpeed;
  2319. if (Splide2.is(SLIDE) && rewindSpeed) {
  2320. var prev = Controller.getIndex(true);
  2321. var end = Controller.getEnd();
  2322. if (prev === 0 && index >= end || prev >= end && index === 0) {
  2323. return rewindSpeed;
  2324. }
  2325. }
  2326. return options.speed;
  2327. }
  2328. function apply(transition) {
  2329. Components2.Style.ruleBy(list, "transition", transition);
  2330. }
  2331. return {
  2332. mount: mount,
  2333. start: start,
  2334. cancel: cancel
  2335. };
  2336. }
  2337. var _Splide = /*#__PURE__*/function () {
  2338. function _Splide(target, options) {
  2339. this.event = EventBus();
  2340. this.Components = {};
  2341. this.state = State(CREATED);
  2342. this.splides = [];
  2343. this._options = {};
  2344. this._Extensions = {};
  2345. var root = isString(target) ? query(document, target) : target;
  2346. assert(root, root + " is invalid.");
  2347. this.root = root;
  2348. merge(DEFAULTS, _Splide.defaults);
  2349. merge(merge(this._options, DEFAULTS), options || {});
  2350. }
  2351. var _proto = _Splide.prototype;
  2352. _proto.mount = function mount(Extensions, Transition) {
  2353. var _this3 = this;
  2354. this.state.set(CREATED);
  2355. this._Transition = Transition || this._Transition || (this.is(FADE) ? Fade : Slide);
  2356. this._Extensions = Extensions || this._Extensions;
  2357. var Constructors = assign({}, ComponentConstructors, this._Extensions, {
  2358. Transition: this._Transition
  2359. });
  2360. var Components2 = this.Components;
  2361. forOwn(Constructors, function (Component, key) {
  2362. var component = Component(_this3, _this3.Components, _this3._options);
  2363. Components2[key] = component;
  2364. component.setup && component.setup();
  2365. });
  2366. forOwn(Components2, function (component) {
  2367. component.mount && component.mount();
  2368. });
  2369. forOwn(Components2, function (component) {
  2370. component.mounted && component.mounted();
  2371. });
  2372. this.emit(EVENT_MOUNTED);
  2373. addClass(this.root, CLASS_INITIALIZED);
  2374. this.state.set(IDLE);
  2375. this.emit(EVENT_READY);
  2376. return this;
  2377. };
  2378. _proto.sync = function sync(splide) {
  2379. this.splides.push(splide);
  2380. splide.splides.push(this);
  2381. return this;
  2382. };
  2383. _proto.go = function go(control) {
  2384. this.Components.Controller.go(control);
  2385. };
  2386. _proto.on = function on(events, callback) {
  2387. this.event.on(events, callback);
  2388. return this;
  2389. };
  2390. _proto.off = function off(events) {
  2391. this.event.off(events);
  2392. return this;
  2393. };
  2394. _proto.emit = function emit(event) {
  2395. var _this$event;
  2396. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  2397. args[_key2 - 1] = arguments[_key2];
  2398. }
  2399. (_this$event = this.event).emit.apply(_this$event, [event].concat(args));
  2400. return this;
  2401. };
  2402. _proto.add = function add(slides, index) {
  2403. this.Components.Slides.add(slides, index);
  2404. return this;
  2405. };
  2406. _proto.remove = function remove(matcher) {
  2407. this.Components.Slides.remove(matcher);
  2408. return this;
  2409. };
  2410. _proto.is = function is(type) {
  2411. return this._options.type === type;
  2412. };
  2413. _proto.refresh = function refresh() {
  2414. this.emit(EVENT_REFRESH);
  2415. return this;
  2416. };
  2417. _proto.destroy = function destroy(completely) {
  2418. var event = this.event,
  2419. state = this.state;
  2420. if (state.is(CREATED)) {
  2421. event.on(EVENT_READY, this.destroy.bind(this, completely), this);
  2422. } else {
  2423. forOwn(this.Components, function (component) {
  2424. component.destroy && component.destroy(completely);
  2425. });
  2426. event.emit(EVENT_DESTROY);
  2427. event.destroy();
  2428. empty(this.splides);
  2429. state.set(DESTROYED);
  2430. }
  2431. return this;
  2432. };
  2433. _createClass(_Splide, [{
  2434. key: "options",
  2435. get: function get() {
  2436. return this._options;
  2437. },
  2438. set: function set(options) {
  2439. var _options = this._options;
  2440. merge(_options, options);
  2441. if (!this.state.is(CREATED)) {
  2442. this.emit(EVENT_UPDATED, _options);
  2443. }
  2444. }
  2445. }, {
  2446. key: "length",
  2447. get: function get() {
  2448. return this.Components.Slides.getLength(true);
  2449. }
  2450. }, {
  2451. key: "index",
  2452. get: function get() {
  2453. return this.Components.Controller.getIndex();
  2454. }
  2455. }]);
  2456. return _Splide;
  2457. }();
  2458. var Splide = _Splide;
  2459. Splide.defaults = {};
  2460. Splide.STATES = STATES;
  2461. return Splide;
  2462. });
  2463. //# sourceMappingURL=splide.js.map