splide.cjs.js 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068
  1. /*!
  2. * Splide.js
  3. * Version : 4.1.3
  4. * License : MIT
  5. * Copyright: 2022 Naotoshi Fujita
  6. */
  7. 'use strict';
  8. Object.defineProperty(exports, '__esModule', { value: true });
  9. const MEDIA_PREFERS_REDUCED_MOTION = "(prefers-reduced-motion: reduce)";
  10. const CREATED = 1;
  11. const MOUNTED = 2;
  12. const IDLE = 3;
  13. const MOVING = 4;
  14. const SCROLLING = 5;
  15. const DRAGGING = 6;
  16. const DESTROYED = 7;
  17. const STATES = {
  18. CREATED,
  19. MOUNTED,
  20. IDLE,
  21. MOVING,
  22. SCROLLING,
  23. DRAGGING,
  24. DESTROYED
  25. };
  26. function empty(array) {
  27. array.length = 0;
  28. }
  29. function slice(arrayLike, start, end) {
  30. return Array.prototype.slice.call(arrayLike, start, end);
  31. }
  32. function apply(func) {
  33. return func.bind(null, ...slice(arguments, 1));
  34. }
  35. const nextTick = setTimeout;
  36. const noop = () => {
  37. };
  38. function raf(func) {
  39. return requestAnimationFrame(func);
  40. }
  41. function typeOf(type, subject) {
  42. return typeof subject === type;
  43. }
  44. function isObject(subject) {
  45. return !isNull(subject) && typeOf("object", subject);
  46. }
  47. const isArray = Array.isArray;
  48. const isFunction = apply(typeOf, "function");
  49. const isString = apply(typeOf, "string");
  50. const isUndefined = apply(typeOf, "undefined");
  51. function isNull(subject) {
  52. return subject === null;
  53. }
  54. function isHTMLElement(subject) {
  55. try {
  56. return subject instanceof (subject.ownerDocument.defaultView || window).HTMLElement;
  57. } catch (e) {
  58. return false;
  59. }
  60. }
  61. function toArray(value) {
  62. return isArray(value) ? value : [value];
  63. }
  64. function forEach(values, iteratee) {
  65. toArray(values).forEach(iteratee);
  66. }
  67. function includes(array, value) {
  68. return array.indexOf(value) > -1;
  69. }
  70. function push(array, items) {
  71. array.push(...toArray(items));
  72. return array;
  73. }
  74. function toggleClass(elm, classes, add) {
  75. if (elm) {
  76. forEach(classes, (name) => {
  77. if (name) {
  78. elm.classList[add ? "add" : "remove"](name);
  79. }
  80. });
  81. }
  82. }
  83. function addClass(elm, classes) {
  84. toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true);
  85. }
  86. function append(parent, children) {
  87. forEach(children, parent.appendChild.bind(parent));
  88. }
  89. function before(nodes, ref) {
  90. forEach(nodes, (node) => {
  91. const parent = (ref || node).parentNode;
  92. if (parent) {
  93. parent.insertBefore(node, ref);
  94. }
  95. });
  96. }
  97. function matches(elm, selector) {
  98. return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector);
  99. }
  100. function children(parent, selector) {
  101. const children2 = parent ? slice(parent.children) : [];
  102. return selector ? children2.filter((child) => matches(child, selector)) : children2;
  103. }
  104. function child(parent, selector) {
  105. return selector ? children(parent, selector)[0] : parent.firstElementChild;
  106. }
  107. const ownKeys = Object.keys;
  108. function forOwn(object, iteratee, right) {
  109. if (object) {
  110. (right ? ownKeys(object).reverse() : ownKeys(object)).forEach((key) => {
  111. key !== "__proto__" && iteratee(object[key], key);
  112. });
  113. }
  114. return object;
  115. }
  116. function assign(object) {
  117. slice(arguments, 1).forEach((source) => {
  118. forOwn(source, (value, key) => {
  119. object[key] = source[key];
  120. });
  121. });
  122. return object;
  123. }
  124. function merge(object) {
  125. slice(arguments, 1).forEach((source) => {
  126. forOwn(source, (value, key) => {
  127. if (isArray(value)) {
  128. object[key] = value.slice();
  129. } else if (isObject(value)) {
  130. object[key] = merge({}, isObject(object[key]) ? object[key] : {}, value);
  131. } else {
  132. object[key] = value;
  133. }
  134. });
  135. });
  136. return object;
  137. }
  138. function omit(object, keys) {
  139. forEach(keys || ownKeys(object), (key) => {
  140. delete object[key];
  141. });
  142. }
  143. function removeAttribute(elms, attrs) {
  144. forEach(elms, (elm) => {
  145. forEach(attrs, (attr) => {
  146. elm && elm.removeAttribute(attr);
  147. });
  148. });
  149. }
  150. function setAttribute(elms, attrs, value) {
  151. if (isObject(attrs)) {
  152. forOwn(attrs, (value2, name) => {
  153. setAttribute(elms, name, value2);
  154. });
  155. } else {
  156. forEach(elms, (elm) => {
  157. isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value));
  158. });
  159. }
  160. }
  161. function create(tag, attrs, parent) {
  162. const elm = document.createElement(tag);
  163. if (attrs) {
  164. isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs);
  165. }
  166. parent && append(parent, elm);
  167. return elm;
  168. }
  169. function style(elm, prop, value) {
  170. if (isUndefined(value)) {
  171. return getComputedStyle(elm)[prop];
  172. }
  173. if (!isNull(value)) {
  174. elm.style[prop] = `${value}`;
  175. }
  176. }
  177. function display(elm, display2) {
  178. style(elm, "display", display2);
  179. }
  180. function focus(elm) {
  181. elm["setActive"] && elm["setActive"]() || elm.focus({ preventScroll: true });
  182. }
  183. function getAttribute(elm, attr) {
  184. return elm.getAttribute(attr);
  185. }
  186. function hasClass(elm, className) {
  187. return elm && elm.classList.contains(className);
  188. }
  189. function rect(target) {
  190. return target.getBoundingClientRect();
  191. }
  192. function remove(nodes) {
  193. forEach(nodes, (node) => {
  194. if (node && node.parentNode) {
  195. node.parentNode.removeChild(node);
  196. }
  197. });
  198. }
  199. function parseHtml(html) {
  200. return child(new DOMParser().parseFromString(html, "text/html").body);
  201. }
  202. function prevent(e, stopPropagation) {
  203. e.preventDefault();
  204. if (stopPropagation) {
  205. e.stopPropagation();
  206. e.stopImmediatePropagation();
  207. }
  208. }
  209. function query(parent, selector) {
  210. return parent && parent.querySelector(selector);
  211. }
  212. function queryAll(parent, selector) {
  213. return selector ? slice(parent.querySelectorAll(selector)) : [];
  214. }
  215. function removeClass(elm, classes) {
  216. toggleClass(elm, classes, false);
  217. }
  218. function timeOf(e) {
  219. return e.timeStamp;
  220. }
  221. function unit(value) {
  222. return isString(value) ? value : value ? `${value}px` : "";
  223. }
  224. const PROJECT_CODE = "splide";
  225. const DATA_ATTRIBUTE = `data-${PROJECT_CODE}`;
  226. function assert(condition, message) {
  227. if (!condition) {
  228. throw new Error(`[${PROJECT_CODE}] ${message || ""}`);
  229. }
  230. }
  231. const { min, max, floor, ceil, abs } = Math;
  232. function approximatelyEqual(x, y, epsilon) {
  233. return abs(x - y) < epsilon;
  234. }
  235. function between(number, x, y, exclusive) {
  236. const minimum = min(x, y);
  237. const maximum = max(x, y);
  238. return exclusive ? minimum < number && number < maximum : minimum <= number && number <= maximum;
  239. }
  240. function clamp(number, x, y) {
  241. const minimum = min(x, y);
  242. const maximum = max(x, y);
  243. return min(max(minimum, number), maximum);
  244. }
  245. function sign(x) {
  246. return +(x > 0) - +(x < 0);
  247. }
  248. function camelToKebab(string) {
  249. return string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
  250. }
  251. function format(string, replacements) {
  252. forEach(replacements, (replacement) => {
  253. string = string.replace("%s", `${replacement}`);
  254. });
  255. return string;
  256. }
  257. function pad(number) {
  258. return number < 10 ? `0${number}` : `${number}`;
  259. }
  260. const ids = {};
  261. function uniqueId(prefix) {
  262. return `${prefix}${pad(ids[prefix] = (ids[prefix] || 0) + 1)}`;
  263. }
  264. function EventBinder() {
  265. let listeners = [];
  266. function bind(targets, events, callback, options) {
  267. forEachEvent(targets, events, (target, event, namespace) => {
  268. const isEventTarget = "addEventListener" in target;
  269. const remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback);
  270. isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback);
  271. listeners.push([target, event, namespace, callback, remover]);
  272. });
  273. }
  274. function unbind(targets, events, callback) {
  275. forEachEvent(targets, events, (target, event, namespace) => {
  276. listeners = listeners.filter((listener) => {
  277. if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) {
  278. listener[4]();
  279. return false;
  280. }
  281. return true;
  282. });
  283. });
  284. }
  285. function dispatch(target, type, detail) {
  286. let e;
  287. const bubbles = true;
  288. if (typeof CustomEvent === "function") {
  289. e = new CustomEvent(type, { bubbles, detail });
  290. } else {
  291. e = document.createEvent("CustomEvent");
  292. e.initCustomEvent(type, bubbles, false, detail);
  293. }
  294. target.dispatchEvent(e);
  295. return e;
  296. }
  297. function forEachEvent(targets, events, iteratee) {
  298. forEach(targets, (target) => {
  299. target && forEach(events, (events2) => {
  300. events2.split(" ").forEach((eventNS) => {
  301. const fragment = eventNS.split(".");
  302. iteratee(target, fragment[0], fragment[1]);
  303. });
  304. });
  305. });
  306. }
  307. function destroy() {
  308. listeners.forEach((data) => {
  309. data[4]();
  310. });
  311. empty(listeners);
  312. }
  313. return {
  314. bind,
  315. unbind,
  316. dispatch,
  317. destroy
  318. };
  319. }
  320. const EVENT_MOUNTED = "mounted";
  321. const EVENT_READY = "ready";
  322. const EVENT_MOVE = "move";
  323. const EVENT_MOVED = "moved";
  324. const EVENT_CLICK = "click";
  325. const EVENT_ACTIVE = "active";
  326. const EVENT_INACTIVE = "inactive";
  327. const EVENT_VISIBLE = "visible";
  328. const EVENT_HIDDEN = "hidden";
  329. const EVENT_REFRESH = "refresh";
  330. const EVENT_UPDATED = "updated";
  331. const EVENT_RESIZE = "resize";
  332. const EVENT_RESIZED = "resized";
  333. const EVENT_DRAG = "drag";
  334. const EVENT_DRAGGING = "dragging";
  335. const EVENT_DRAGGED = "dragged";
  336. const EVENT_SCROLL = "scroll";
  337. const EVENT_SCROLLED = "scrolled";
  338. const EVENT_OVERFLOW = "overflow";
  339. const EVENT_DESTROY = "destroy";
  340. const EVENT_ARROWS_MOUNTED = "arrows:mounted";
  341. const EVENT_ARROWS_UPDATED = "arrows:updated";
  342. const EVENT_PAGINATION_MOUNTED = "pagination:mounted";
  343. const EVENT_PAGINATION_UPDATED = "pagination:updated";
  344. const EVENT_NAVIGATION_MOUNTED = "navigation:mounted";
  345. const EVENT_AUTOPLAY_PLAY = "autoplay:play";
  346. const EVENT_AUTOPLAY_PLAYING = "autoplay:playing";
  347. const EVENT_AUTOPLAY_PAUSE = "autoplay:pause";
  348. const EVENT_LAZYLOAD_LOADED = "lazyload:loaded";
  349. const EVENT_SLIDE_KEYDOWN = "sk";
  350. const EVENT_SHIFTED = "sh";
  351. const EVENT_END_INDEX_CHANGED = "ei";
  352. function EventInterface(Splide2) {
  353. const bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment();
  354. const binder = EventBinder();
  355. function on(events, callback) {
  356. binder.bind(bus, toArray(events).join(" "), (e) => {
  357. callback.apply(callback, isArray(e.detail) ? e.detail : []);
  358. });
  359. }
  360. function emit(event) {
  361. binder.dispatch(bus, event, slice(arguments, 1));
  362. }
  363. if (Splide2) {
  364. Splide2.event.on(EVENT_DESTROY, binder.destroy);
  365. }
  366. return assign(binder, {
  367. bus,
  368. on,
  369. off: apply(binder.unbind, bus),
  370. emit
  371. });
  372. }
  373. function RequestInterval(interval, onInterval, onUpdate, limit) {
  374. const { now } = Date;
  375. let startTime;
  376. let rate = 0;
  377. let id;
  378. let paused = true;
  379. let count = 0;
  380. function update() {
  381. if (!paused) {
  382. rate = interval ? min((now() - startTime) / interval, 1) : 1;
  383. onUpdate && onUpdate(rate);
  384. if (rate >= 1) {
  385. onInterval();
  386. startTime = now();
  387. if (limit && ++count >= limit) {
  388. return pause();
  389. }
  390. }
  391. id = raf(update);
  392. }
  393. }
  394. function start(resume) {
  395. resume || cancel();
  396. startTime = now() - (resume ? rate * interval : 0);
  397. paused = false;
  398. id = raf(update);
  399. }
  400. function pause() {
  401. paused = true;
  402. }
  403. function rewind() {
  404. startTime = now();
  405. rate = 0;
  406. if (onUpdate) {
  407. onUpdate(rate);
  408. }
  409. }
  410. function cancel() {
  411. id && cancelAnimationFrame(id);
  412. rate = 0;
  413. id = 0;
  414. paused = true;
  415. }
  416. function set(time) {
  417. interval = time;
  418. }
  419. function isPaused() {
  420. return paused;
  421. }
  422. return {
  423. start,
  424. rewind,
  425. pause,
  426. cancel,
  427. set,
  428. isPaused
  429. };
  430. }
  431. function State(initialState) {
  432. let state = initialState;
  433. function set(value) {
  434. state = value;
  435. }
  436. function is(states) {
  437. return includes(toArray(states), state);
  438. }
  439. return { set, is };
  440. }
  441. function Throttle(func, duration) {
  442. const interval = RequestInterval(duration || 0, func, null, 1);
  443. return () => {
  444. interval.isPaused() && interval.start();
  445. };
  446. }
  447. function Media(Splide2, Components2, options) {
  448. const { state } = Splide2;
  449. const breakpoints = options.breakpoints || {};
  450. const reducedMotion = options.reducedMotion || {};
  451. const binder = EventBinder();
  452. const queries = [];
  453. function setup() {
  454. const isMin = options.mediaQuery === "min";
  455. ownKeys(breakpoints).sort((n, m) => isMin ? +n - +m : +m - +n).forEach((key) => {
  456. register(breakpoints[key], `(${isMin ? "min" : "max"}-width:${key}px)`);
  457. });
  458. register(reducedMotion, MEDIA_PREFERS_REDUCED_MOTION);
  459. update();
  460. }
  461. function destroy(completely) {
  462. if (completely) {
  463. binder.destroy();
  464. }
  465. }
  466. function register(options2, query) {
  467. const queryList = matchMedia(query);
  468. binder.bind(queryList, "change", update);
  469. queries.push([options2, queryList]);
  470. }
  471. function update() {
  472. const destroyed = state.is(DESTROYED);
  473. const direction = options.direction;
  474. const merged = queries.reduce((merged2, entry) => {
  475. return merge(merged2, entry[1].matches ? entry[0] : {});
  476. }, {});
  477. omit(options);
  478. set(merged);
  479. if (options.destroy) {
  480. Splide2.destroy(options.destroy === "completely");
  481. } else if (destroyed) {
  482. destroy(true);
  483. Splide2.mount();
  484. } else {
  485. direction !== options.direction && Splide2.refresh();
  486. }
  487. }
  488. function reduce(enable) {
  489. if (matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches) {
  490. enable ? merge(options, reducedMotion) : omit(options, ownKeys(reducedMotion));
  491. }
  492. }
  493. function set(opts, base, notify) {
  494. merge(options, opts);
  495. base && merge(Object.getPrototypeOf(options), opts);
  496. if (notify || !state.is(CREATED)) {
  497. Splide2.emit(EVENT_UPDATED, options);
  498. }
  499. }
  500. return {
  501. setup,
  502. destroy,
  503. reduce,
  504. set
  505. };
  506. }
  507. const ARROW = "Arrow";
  508. const ARROW_LEFT = `${ARROW}Left`;
  509. const ARROW_RIGHT = `${ARROW}Right`;
  510. const ARROW_UP = `${ARROW}Up`;
  511. const ARROW_DOWN = `${ARROW}Down`;
  512. const LTR = "ltr";
  513. const RTL = "rtl";
  514. const TTB = "ttb";
  515. const ORIENTATION_MAP = {
  516. width: ["height"],
  517. left: ["top", "right"],
  518. right: ["bottom", "left"],
  519. x: ["y"],
  520. X: ["Y"],
  521. Y: ["X"],
  522. ArrowLeft: [ARROW_UP, ARROW_RIGHT],
  523. ArrowRight: [ARROW_DOWN, ARROW_LEFT]
  524. };
  525. function Direction(Splide2, Components2, options) {
  526. function resolve(prop, axisOnly, direction) {
  527. direction = direction || options.direction;
  528. const index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1;
  529. return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, (match, offset) => {
  530. const replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match;
  531. return offset > 0 ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement;
  532. });
  533. }
  534. function orient(value) {
  535. return value * (options.direction === RTL ? 1 : -1);
  536. }
  537. return {
  538. resolve,
  539. orient
  540. };
  541. }
  542. const ROLE = "role";
  543. const TAB_INDEX = "tabindex";
  544. const DISABLED = "disabled";
  545. const ARIA_PREFIX = "aria-";
  546. const ARIA_CONTROLS = `${ARIA_PREFIX}controls`;
  547. const ARIA_CURRENT = `${ARIA_PREFIX}current`;
  548. const ARIA_SELECTED = `${ARIA_PREFIX}selected`;
  549. const ARIA_LABEL = `${ARIA_PREFIX}label`;
  550. const ARIA_LABELLEDBY = `${ARIA_PREFIX}labelledby`;
  551. const ARIA_HIDDEN = `${ARIA_PREFIX}hidden`;
  552. const ARIA_ORIENTATION = `${ARIA_PREFIX}orientation`;
  553. const ARIA_ROLEDESCRIPTION = `${ARIA_PREFIX}roledescription`;
  554. const ARIA_LIVE = `${ARIA_PREFIX}live`;
  555. const ARIA_BUSY = `${ARIA_PREFIX}busy`;
  556. const ARIA_ATOMIC = `${ARIA_PREFIX}atomic`;
  557. const ALL_ATTRIBUTES = [
  558. ROLE,
  559. TAB_INDEX,
  560. DISABLED,
  561. ARIA_CONTROLS,
  562. ARIA_CURRENT,
  563. ARIA_LABEL,
  564. ARIA_LABELLEDBY,
  565. ARIA_HIDDEN,
  566. ARIA_ORIENTATION,
  567. ARIA_ROLEDESCRIPTION
  568. ];
  569. const CLASS_PREFIX = `${PROJECT_CODE}__`;
  570. const STATUS_CLASS_PREFIX = "is-";
  571. const CLASS_ROOT = PROJECT_CODE;
  572. const CLASS_TRACK = `${CLASS_PREFIX}track`;
  573. const CLASS_LIST = `${CLASS_PREFIX}list`;
  574. const CLASS_SLIDE = `${CLASS_PREFIX}slide`;
  575. const CLASS_CLONE = `${CLASS_SLIDE}--clone`;
  576. const CLASS_CONTAINER = `${CLASS_SLIDE}__container`;
  577. const CLASS_ARROWS = `${CLASS_PREFIX}arrows`;
  578. const CLASS_ARROW = `${CLASS_PREFIX}arrow`;
  579. const CLASS_ARROW_PREV = `${CLASS_ARROW}--prev`;
  580. const CLASS_ARROW_NEXT = `${CLASS_ARROW}--next`;
  581. const CLASS_PAGINATION = `${CLASS_PREFIX}pagination`;
  582. const CLASS_PAGINATION_PAGE = `${CLASS_PAGINATION}__page`;
  583. const CLASS_PROGRESS = `${CLASS_PREFIX}progress`;
  584. const CLASS_PROGRESS_BAR = `${CLASS_PROGRESS}__bar`;
  585. const CLASS_TOGGLE = `${CLASS_PREFIX}toggle`;
  586. const CLASS_TOGGLE_PLAY = `${CLASS_TOGGLE}__play`;
  587. const CLASS_TOGGLE_PAUSE = `${CLASS_TOGGLE}__pause`;
  588. const CLASS_SPINNER = `${CLASS_PREFIX}spinner`;
  589. const CLASS_SR = `${CLASS_PREFIX}sr`;
  590. const CLASS_INITIALIZED = `${STATUS_CLASS_PREFIX}initialized`;
  591. const CLASS_ACTIVE = `${STATUS_CLASS_PREFIX}active`;
  592. const CLASS_PREV = `${STATUS_CLASS_PREFIX}prev`;
  593. const CLASS_NEXT = `${STATUS_CLASS_PREFIX}next`;
  594. const CLASS_VISIBLE = `${STATUS_CLASS_PREFIX}visible`;
  595. const CLASS_LOADING = `${STATUS_CLASS_PREFIX}loading`;
  596. const CLASS_FOCUS_IN = `${STATUS_CLASS_PREFIX}focus-in`;
  597. const CLASS_OVERFLOW = `${STATUS_CLASS_PREFIX}overflow`;
  598. const STATUS_CLASSES = [
  599. CLASS_ACTIVE,
  600. CLASS_VISIBLE,
  601. CLASS_PREV,
  602. CLASS_NEXT,
  603. CLASS_LOADING,
  604. CLASS_FOCUS_IN,
  605. CLASS_OVERFLOW
  606. ];
  607. const CLASSES = {
  608. slide: CLASS_SLIDE,
  609. clone: CLASS_CLONE,
  610. arrows: CLASS_ARROWS,
  611. arrow: CLASS_ARROW,
  612. prev: CLASS_ARROW_PREV,
  613. next: CLASS_ARROW_NEXT,
  614. pagination: CLASS_PAGINATION,
  615. page: CLASS_PAGINATION_PAGE,
  616. spinner: CLASS_SPINNER
  617. };
  618. function closest(from, selector) {
  619. if (isFunction(from.closest)) {
  620. return from.closest(selector);
  621. }
  622. let elm = from;
  623. while (elm && elm.nodeType === 1) {
  624. if (matches(elm, selector)) {
  625. break;
  626. }
  627. elm = elm.parentElement;
  628. }
  629. return elm;
  630. }
  631. const FRICTION = 5;
  632. const LOG_INTERVAL = 200;
  633. const POINTER_DOWN_EVENTS = "touchstart mousedown";
  634. const POINTER_MOVE_EVENTS = "touchmove mousemove";
  635. const POINTER_UP_EVENTS = "touchend touchcancel mouseup click";
  636. function Elements(Splide2, Components2, options) {
  637. const { on, bind } = EventInterface(Splide2);
  638. const { root } = Splide2;
  639. const { i18n } = options;
  640. const elements = {};
  641. const slides = [];
  642. let rootClasses = [];
  643. let trackClasses = [];
  644. let track;
  645. let list;
  646. let isUsingKey;
  647. function setup() {
  648. collect();
  649. init();
  650. update();
  651. }
  652. function mount() {
  653. on(EVENT_REFRESH, destroy);
  654. on(EVENT_REFRESH, setup);
  655. on(EVENT_UPDATED, update);
  656. bind(document, `${POINTER_DOWN_EVENTS} keydown`, (e) => {
  657. isUsingKey = e.type === "keydown";
  658. }, { capture: true });
  659. bind(root, "focusin", () => {
  660. toggleClass(root, CLASS_FOCUS_IN, !!isUsingKey);
  661. });
  662. }
  663. function destroy(completely) {
  664. const attrs = ALL_ATTRIBUTES.concat("style");
  665. empty(slides);
  666. removeClass(root, rootClasses);
  667. removeClass(track, trackClasses);
  668. removeAttribute([track, list], attrs);
  669. removeAttribute(root, completely ? attrs : ["style", ARIA_ROLEDESCRIPTION]);
  670. }
  671. function update() {
  672. removeClass(root, rootClasses);
  673. removeClass(track, trackClasses);
  674. rootClasses = getClasses(CLASS_ROOT);
  675. trackClasses = getClasses(CLASS_TRACK);
  676. addClass(root, rootClasses);
  677. addClass(track, trackClasses);
  678. setAttribute(root, ARIA_LABEL, options.label);
  679. setAttribute(root, ARIA_LABELLEDBY, options.labelledby);
  680. }
  681. function collect() {
  682. track = find(`.${CLASS_TRACK}`);
  683. list = child(track, `.${CLASS_LIST}`);
  684. assert(track && list, "A track/list element is missing.");
  685. push(slides, children(list, `.${CLASS_SLIDE}:not(.${CLASS_CLONE})`));
  686. forOwn({
  687. arrows: CLASS_ARROWS,
  688. pagination: CLASS_PAGINATION,
  689. prev: CLASS_ARROW_PREV,
  690. next: CLASS_ARROW_NEXT,
  691. bar: CLASS_PROGRESS_BAR,
  692. toggle: CLASS_TOGGLE
  693. }, (className, key) => {
  694. elements[key] = find(`.${className}`);
  695. });
  696. assign(elements, { root, track, list, slides });
  697. }
  698. function init() {
  699. const id = root.id || uniqueId(PROJECT_CODE);
  700. const role = options.role;
  701. root.id = id;
  702. track.id = track.id || `${id}-track`;
  703. list.id = list.id || `${id}-list`;
  704. if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) {
  705. setAttribute(root, ROLE, role);
  706. }
  707. setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel);
  708. setAttribute(list, ROLE, "presentation");
  709. }
  710. function find(selector) {
  711. const elm = query(root, selector);
  712. return elm && closest(elm, `.${CLASS_ROOT}`) === root ? elm : void 0;
  713. }
  714. function getClasses(base) {
  715. return [
  716. `${base}--${options.type}`,
  717. `${base}--${options.direction}`,
  718. options.drag && `${base}--draggable`,
  719. options.isNavigation && `${base}--nav`,
  720. base === CLASS_ROOT && CLASS_ACTIVE
  721. ];
  722. }
  723. return assign(elements, {
  724. setup,
  725. mount,
  726. destroy
  727. });
  728. }
  729. const SLIDE = "slide";
  730. const LOOP = "loop";
  731. const FADE = "fade";
  732. function Slide$1(Splide2, index, slideIndex, slide) {
  733. const event = EventInterface(Splide2);
  734. const { on, emit, bind } = event;
  735. const { Components, root, options } = Splide2;
  736. const { isNavigation, updateOnMove, i18n, pagination, slideFocus } = options;
  737. const { resolve } = Components.Direction;
  738. const styles = getAttribute(slide, "style");
  739. const label = getAttribute(slide, ARIA_LABEL);
  740. const isClone = slideIndex > -1;
  741. const container = child(slide, `.${CLASS_CONTAINER}`);
  742. let destroyed;
  743. function mount() {
  744. if (!isClone) {
  745. slide.id = `${root.id}-slide${pad(index + 1)}`;
  746. setAttribute(slide, ROLE, pagination ? "tabpanel" : "group");
  747. setAttribute(slide, ARIA_ROLEDESCRIPTION, i18n.slide);
  748. setAttribute(slide, ARIA_LABEL, label || format(i18n.slideLabel, [index + 1, Splide2.length]));
  749. }
  750. listen();
  751. }
  752. function listen() {
  753. bind(slide, "click", apply(emit, EVENT_CLICK, self));
  754. bind(slide, "keydown", apply(emit, EVENT_SLIDE_KEYDOWN, self));
  755. on([EVENT_MOVED, EVENT_SHIFTED, EVENT_SCROLLED], update);
  756. on(EVENT_NAVIGATION_MOUNTED, initNavigation);
  757. if (updateOnMove) {
  758. on(EVENT_MOVE, onMove);
  759. }
  760. }
  761. function destroy() {
  762. destroyed = true;
  763. event.destroy();
  764. removeClass(slide, STATUS_CLASSES);
  765. removeAttribute(slide, ALL_ATTRIBUTES);
  766. setAttribute(slide, "style", styles);
  767. setAttribute(slide, ARIA_LABEL, label || "");
  768. }
  769. function initNavigation() {
  770. const controls = Splide2.splides.map((target) => {
  771. const Slide2 = target.splide.Components.Slides.getAt(index);
  772. return Slide2 ? Slide2.slide.id : "";
  773. }).join(" ");
  774. setAttribute(slide, ARIA_LABEL, format(i18n.slideX, (isClone ? slideIndex : index) + 1));
  775. setAttribute(slide, ARIA_CONTROLS, controls);
  776. setAttribute(slide, ROLE, slideFocus ? "button" : "");
  777. slideFocus && removeAttribute(slide, ARIA_ROLEDESCRIPTION);
  778. }
  779. function onMove() {
  780. if (!destroyed) {
  781. update();
  782. }
  783. }
  784. function update() {
  785. if (!destroyed) {
  786. const { index: curr } = Splide2;
  787. updateActivity();
  788. updateVisibility();
  789. toggleClass(slide, CLASS_PREV, index === curr - 1);
  790. toggleClass(slide, CLASS_NEXT, index === curr + 1);
  791. }
  792. }
  793. function updateActivity() {
  794. const active = isActive();
  795. if (active !== hasClass(slide, CLASS_ACTIVE)) {
  796. toggleClass(slide, CLASS_ACTIVE, active);
  797. setAttribute(slide, ARIA_CURRENT, isNavigation && active || "");
  798. emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self);
  799. }
  800. }
  801. function updateVisibility() {
  802. const visible = isVisible();
  803. const hidden = !visible && (!isActive() || isClone);
  804. if (!Splide2.state.is([MOVING, SCROLLING])) {
  805. setAttribute(slide, ARIA_HIDDEN, hidden || "");
  806. }
  807. setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : "");
  808. if (slideFocus) {
  809. setAttribute(slide, TAB_INDEX, hidden ? -1 : 0);
  810. }
  811. if (visible !== hasClass(slide, CLASS_VISIBLE)) {
  812. toggleClass(slide, CLASS_VISIBLE, visible);
  813. emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self);
  814. }
  815. if (!visible && document.activeElement === slide) {
  816. const Slide2 = Components.Slides.getAt(Splide2.index);
  817. Slide2 && focus(Slide2.slide);
  818. }
  819. }
  820. function style$1(prop, value, useContainer) {
  821. style(useContainer && container || slide, prop, value);
  822. }
  823. function isActive() {
  824. const { index: curr } = Splide2;
  825. return curr === index || options.cloneStatus && curr === slideIndex;
  826. }
  827. function isVisible() {
  828. if (Splide2.is(FADE)) {
  829. return isActive();
  830. }
  831. const trackRect = rect(Components.Elements.track);
  832. const slideRect = rect(slide);
  833. const left = resolve("left", true);
  834. const right = resolve("right", true);
  835. return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]);
  836. }
  837. function isWithin(from, distance) {
  838. let diff = abs(from - index);
  839. if (!isClone && (options.rewind || Splide2.is(LOOP))) {
  840. diff = min(diff, Splide2.length - diff);
  841. }
  842. return diff <= distance;
  843. }
  844. const self = {
  845. index,
  846. slideIndex,
  847. slide,
  848. container,
  849. isClone,
  850. mount,
  851. destroy,
  852. update,
  853. style: style$1,
  854. isWithin
  855. };
  856. return self;
  857. }
  858. function Slides(Splide2, Components2, options) {
  859. const { on, emit, bind } = EventInterface(Splide2);
  860. const { slides, list } = Components2.Elements;
  861. const Slides2 = [];
  862. function mount() {
  863. init();
  864. on(EVENT_REFRESH, destroy);
  865. on(EVENT_REFRESH, init);
  866. }
  867. function init() {
  868. slides.forEach((slide, index) => {
  869. register(slide, index, -1);
  870. });
  871. }
  872. function destroy() {
  873. forEach$1((Slide2) => {
  874. Slide2.destroy();
  875. });
  876. empty(Slides2);
  877. }
  878. function update() {
  879. forEach$1((Slide2) => {
  880. Slide2.update();
  881. });
  882. }
  883. function register(slide, index, slideIndex) {
  884. const object = Slide$1(Splide2, index, slideIndex, slide);
  885. object.mount();
  886. Slides2.push(object);
  887. Slides2.sort((Slide1, Slide2) => Slide1.index - Slide2.index);
  888. }
  889. function get(excludeClones) {
  890. return excludeClones ? filter((Slide2) => !Slide2.isClone) : Slides2;
  891. }
  892. function getIn(page) {
  893. const { Controller } = Components2;
  894. const index = Controller.toIndex(page);
  895. const max = Controller.hasFocus() ? 1 : options.perPage;
  896. return filter((Slide2) => between(Slide2.index, index, index + max - 1));
  897. }
  898. function getAt(index) {
  899. return filter(index)[0];
  900. }
  901. function add(items, index) {
  902. forEach(items, (slide) => {
  903. if (isString(slide)) {
  904. slide = parseHtml(slide);
  905. }
  906. if (isHTMLElement(slide)) {
  907. const ref = slides[index];
  908. ref ? before(slide, ref) : append(list, slide);
  909. addClass(slide, options.classes.slide);
  910. observeImages(slide, apply(emit, EVENT_RESIZE));
  911. }
  912. });
  913. emit(EVENT_REFRESH);
  914. }
  915. function remove$1(matcher) {
  916. remove(filter(matcher).map((Slide2) => Slide2.slide));
  917. emit(EVENT_REFRESH);
  918. }
  919. function forEach$1(iteratee, excludeClones) {
  920. get(excludeClones).forEach(iteratee);
  921. }
  922. function filter(matcher) {
  923. return Slides2.filter(
  924. isFunction(matcher) ? matcher : (Slide2) => isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index)
  925. );
  926. }
  927. function style(prop, value, useContainer) {
  928. forEach$1((Slide2) => {
  929. Slide2.style(prop, value, useContainer);
  930. });
  931. }
  932. function observeImages(elm, callback) {
  933. const images = queryAll(elm, "img");
  934. let { length } = images;
  935. if (length) {
  936. images.forEach((img) => {
  937. bind(img, "load error", () => {
  938. if (!--length) {
  939. callback();
  940. }
  941. });
  942. });
  943. } else {
  944. callback();
  945. }
  946. }
  947. function getLength(excludeClones) {
  948. return excludeClones ? slides.length : Slides2.length;
  949. }
  950. function isEnough() {
  951. return Slides2.length > options.perPage;
  952. }
  953. return {
  954. mount,
  955. destroy,
  956. update,
  957. register,
  958. get,
  959. getIn,
  960. getAt,
  961. add,
  962. remove: remove$1,
  963. forEach: forEach$1,
  964. filter,
  965. style,
  966. getLength,
  967. isEnough
  968. };
  969. }
  970. function Layout(Splide2, Components2, options) {
  971. const { on, bind, emit } = EventInterface(Splide2);
  972. const { Slides } = Components2;
  973. const { resolve } = Components2.Direction;
  974. const { root, track, list } = Components2.Elements;
  975. const { getAt, style: styleSlides } = Slides;
  976. let vertical;
  977. let rootRect;
  978. let overflow;
  979. function mount() {
  980. init();
  981. bind(window, "resize load", Throttle(apply(emit, EVENT_RESIZE)));
  982. on([EVENT_UPDATED, EVENT_REFRESH], init);
  983. on(EVENT_RESIZE, resize);
  984. }
  985. function init() {
  986. vertical = options.direction === TTB;
  987. style(root, "maxWidth", unit(options.width));
  988. style(track, resolve("paddingLeft"), cssPadding(false));
  989. style(track, resolve("paddingRight"), cssPadding(true));
  990. resize(true);
  991. }
  992. function resize(force) {
  993. const newRect = rect(root);
  994. if (force || rootRect.width !== newRect.width || rootRect.height !== newRect.height) {
  995. style(track, "height", cssTrackHeight());
  996. styleSlides(resolve("marginRight"), unit(options.gap));
  997. styleSlides("width", cssSlideWidth());
  998. styleSlides("height", cssSlideHeight(), true);
  999. rootRect = newRect;
  1000. emit(EVENT_RESIZED);
  1001. if (overflow !== (overflow = isOverflow())) {
  1002. toggleClass(root, CLASS_OVERFLOW, overflow);
  1003. emit(EVENT_OVERFLOW, overflow);
  1004. }
  1005. }
  1006. }
  1007. function cssPadding(right) {
  1008. const { padding } = options;
  1009. const prop = resolve(right ? "right" : "left");
  1010. return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px";
  1011. }
  1012. function cssTrackHeight() {
  1013. let height = "";
  1014. if (vertical) {
  1015. height = cssHeight();
  1016. assert(height, "height or heightRatio is missing.");
  1017. height = `calc(${height} - ${cssPadding(false)} - ${cssPadding(true)})`;
  1018. }
  1019. return height;
  1020. }
  1021. function cssHeight() {
  1022. return unit(options.height || rect(list).width * options.heightRatio);
  1023. }
  1024. function cssSlideWidth() {
  1025. return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize());
  1026. }
  1027. function cssSlideHeight() {
  1028. return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight());
  1029. }
  1030. function cssSlideSize() {
  1031. const gap = unit(options.gap);
  1032. return `calc((100%${gap && ` + ${gap}`})/${options.perPage || 1}${gap && ` - ${gap}`})`;
  1033. }
  1034. function listSize() {
  1035. return rect(list)[resolve("width")];
  1036. }
  1037. function slideSize(index, withoutGap) {
  1038. const Slide = getAt(index || 0);
  1039. return Slide ? rect(Slide.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0;
  1040. }
  1041. function totalSize(index, withoutGap) {
  1042. const Slide = getAt(index);
  1043. if (Slide) {
  1044. const right = rect(Slide.slide)[resolve("right")];
  1045. const left = rect(list)[resolve("left")];
  1046. return abs(right - left) + (withoutGap ? 0 : getGap());
  1047. }
  1048. return 0;
  1049. }
  1050. function sliderSize(withoutGap) {
  1051. return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, withoutGap);
  1052. }
  1053. function getGap() {
  1054. const Slide = getAt(0);
  1055. return Slide && parseFloat(style(Slide.slide, resolve("marginRight"))) || 0;
  1056. }
  1057. function getPadding(right) {
  1058. return parseFloat(style(track, resolve(`padding${right ? "Right" : "Left"}`))) || 0;
  1059. }
  1060. function isOverflow() {
  1061. return Splide2.is(FADE) || sliderSize(true) > listSize();
  1062. }
  1063. return {
  1064. mount,
  1065. resize,
  1066. listSize,
  1067. slideSize,
  1068. sliderSize,
  1069. totalSize,
  1070. getPadding,
  1071. isOverflow
  1072. };
  1073. }
  1074. const MULTIPLIER = 2;
  1075. function Clones(Splide2, Components2, options) {
  1076. const event = EventInterface(Splide2);
  1077. const { on } = event;
  1078. const { Elements, Slides } = Components2;
  1079. const { resolve } = Components2.Direction;
  1080. const clones = [];
  1081. let cloneCount;
  1082. function mount() {
  1083. on(EVENT_REFRESH, remount);
  1084. on([EVENT_UPDATED, EVENT_RESIZE], observe);
  1085. if (cloneCount = computeCloneCount()) {
  1086. generate(cloneCount);
  1087. Components2.Layout.resize(true);
  1088. }
  1089. }
  1090. function remount() {
  1091. destroy();
  1092. mount();
  1093. }
  1094. function destroy() {
  1095. remove(clones);
  1096. empty(clones);
  1097. event.destroy();
  1098. }
  1099. function observe() {
  1100. const count = computeCloneCount();
  1101. if (cloneCount !== count) {
  1102. if (cloneCount < count || !count) {
  1103. event.emit(EVENT_REFRESH);
  1104. }
  1105. }
  1106. }
  1107. function generate(count) {
  1108. const slides = Slides.get().slice();
  1109. const { length } = slides;
  1110. if (length) {
  1111. while (slides.length < count) {
  1112. push(slides, slides);
  1113. }
  1114. push(slides.slice(-count), slides.slice(0, count)).forEach((Slide, index) => {
  1115. const isHead = index < count;
  1116. const clone = cloneDeep(Slide.slide, index);
  1117. isHead ? before(clone, slides[0].slide) : append(Elements.list, clone);
  1118. push(clones, clone);
  1119. Slides.register(clone, index - count + (isHead ? 0 : length), Slide.index);
  1120. });
  1121. }
  1122. }
  1123. function cloneDeep(elm, index) {
  1124. const clone = elm.cloneNode(true);
  1125. addClass(clone, options.classes.clone);
  1126. clone.id = `${Splide2.root.id}-clone${pad(index + 1)}`;
  1127. return clone;
  1128. }
  1129. function computeCloneCount() {
  1130. let { clones: clones2 } = options;
  1131. if (!Splide2.is(LOOP)) {
  1132. clones2 = 0;
  1133. } else if (isUndefined(clones2)) {
  1134. const fixedSize = options[resolve("fixedWidth")] && Components2.Layout.slideSize(0);
  1135. const fixedCount = fixedSize && ceil(rect(Elements.track)[resolve("width")] / fixedSize);
  1136. clones2 = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage * MULTIPLIER;
  1137. }
  1138. return clones2;
  1139. }
  1140. return {
  1141. mount,
  1142. destroy
  1143. };
  1144. }
  1145. function Move(Splide2, Components2, options) {
  1146. const { on, emit } = EventInterface(Splide2);
  1147. const { set } = Splide2.state;
  1148. const { slideSize, getPadding, totalSize, listSize, sliderSize } = Components2.Layout;
  1149. const { resolve, orient } = Components2.Direction;
  1150. const { list, track } = Components2.Elements;
  1151. let Transition;
  1152. function mount() {
  1153. Transition = Components2.Transition;
  1154. on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition);
  1155. }
  1156. function reposition() {
  1157. if (!Components2.Controller.isBusy()) {
  1158. Components2.Scroll.cancel();
  1159. jump(Splide2.index);
  1160. Components2.Slides.update();
  1161. }
  1162. }
  1163. function move(dest, index, prev, callback) {
  1164. if (dest !== index && canShift(dest > prev)) {
  1165. cancel();
  1166. translate(shift(getPosition(), dest > prev), true);
  1167. }
  1168. set(MOVING);
  1169. emit(EVENT_MOVE, index, prev, dest);
  1170. Transition.start(index, () => {
  1171. set(IDLE);
  1172. emit(EVENT_MOVED, index, prev, dest);
  1173. callback && callback();
  1174. });
  1175. }
  1176. function jump(index) {
  1177. translate(toPosition(index, true));
  1178. }
  1179. function translate(position, preventLoop) {
  1180. if (!Splide2.is(FADE)) {
  1181. const destination = preventLoop ? position : loop(position);
  1182. style(list, "transform", `translate${resolve("X")}(${destination}px)`);
  1183. position !== destination && emit(EVENT_SHIFTED);
  1184. }
  1185. }
  1186. function loop(position) {
  1187. if (Splide2.is(LOOP)) {
  1188. const index = toIndex(position);
  1189. const exceededMax = index > Components2.Controller.getEnd();
  1190. const exceededMin = index < 0;
  1191. if (exceededMin || exceededMax) {
  1192. position = shift(position, exceededMax);
  1193. }
  1194. }
  1195. return position;
  1196. }
  1197. function shift(position, backwards) {
  1198. const excess = position - getLimit(backwards);
  1199. const size = sliderSize();
  1200. position -= orient(size * (ceil(abs(excess) / size) || 1)) * (backwards ? 1 : -1);
  1201. return position;
  1202. }
  1203. function cancel() {
  1204. translate(getPosition(), true);
  1205. Transition.cancel();
  1206. }
  1207. function toIndex(position) {
  1208. const Slides = Components2.Slides.get();
  1209. let index = 0;
  1210. let minDistance = Infinity;
  1211. for (let i = 0; i < Slides.length; i++) {
  1212. const slideIndex = Slides[i].index;
  1213. const distance = abs(toPosition(slideIndex, true) - position);
  1214. if (distance <= minDistance) {
  1215. minDistance = distance;
  1216. index = slideIndex;
  1217. } else {
  1218. break;
  1219. }
  1220. }
  1221. return index;
  1222. }
  1223. function toPosition(index, trimming) {
  1224. const position = orient(totalSize(index - 1) - offset(index));
  1225. return trimming ? trim(position) : position;
  1226. }
  1227. function getPosition() {
  1228. const left = resolve("left");
  1229. return rect(list)[left] - rect(track)[left] + orient(getPadding(false));
  1230. }
  1231. function trim(position) {
  1232. if (options.trimSpace && Splide2.is(SLIDE)) {
  1233. position = clamp(position, 0, orient(sliderSize(true) - listSize()));
  1234. }
  1235. return position;
  1236. }
  1237. function offset(index) {
  1238. const { focus } = options;
  1239. return focus === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus * slideSize(index) || 0;
  1240. }
  1241. function getLimit(max) {
  1242. return toPosition(max ? Components2.Controller.getEnd() : 0, !!options.trimSpace);
  1243. }
  1244. function canShift(backwards) {
  1245. const shifted = orient(shift(getPosition(), backwards));
  1246. return backwards ? shifted >= 0 : shifted <= list[resolve("scrollWidth")] - rect(track)[resolve("width")];
  1247. }
  1248. function exceededLimit(max, position) {
  1249. position = isUndefined(position) ? getPosition() : position;
  1250. const exceededMin = max !== true && orient(position) < orient(getLimit(false));
  1251. const exceededMax = max !== false && orient(position) > orient(getLimit(true));
  1252. return exceededMin || exceededMax;
  1253. }
  1254. return {
  1255. mount,
  1256. move,
  1257. jump,
  1258. translate,
  1259. shift,
  1260. cancel,
  1261. toIndex,
  1262. toPosition,
  1263. getPosition,
  1264. getLimit,
  1265. exceededLimit,
  1266. reposition
  1267. };
  1268. }
  1269. function Controller(Splide2, Components2, options) {
  1270. const { on, emit } = EventInterface(Splide2);
  1271. const { Move } = Components2;
  1272. const { getPosition, getLimit, toPosition } = Move;
  1273. const { isEnough, getLength } = Components2.Slides;
  1274. const { omitEnd } = options;
  1275. const isLoop = Splide2.is(LOOP);
  1276. const isSlide = Splide2.is(SLIDE);
  1277. const getNext = apply(getAdjacent, false);
  1278. const getPrev = apply(getAdjacent, true);
  1279. let currIndex = options.start || 0;
  1280. let endIndex;
  1281. let prevIndex = currIndex;
  1282. let slideCount;
  1283. let perMove;
  1284. let perPage;
  1285. function mount() {
  1286. init();
  1287. on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], init);
  1288. on(EVENT_RESIZED, onResized);
  1289. }
  1290. function init() {
  1291. slideCount = getLength(true);
  1292. perMove = options.perMove;
  1293. perPage = options.perPage;
  1294. endIndex = getEnd();
  1295. const index = clamp(currIndex, 0, omitEnd ? endIndex : slideCount - 1);
  1296. if (index !== currIndex) {
  1297. currIndex = index;
  1298. Move.reposition();
  1299. }
  1300. }
  1301. function onResized() {
  1302. if (endIndex !== getEnd()) {
  1303. emit(EVENT_END_INDEX_CHANGED);
  1304. }
  1305. }
  1306. function go(control, allowSameIndex, callback) {
  1307. if (!isBusy()) {
  1308. const dest = parse(control);
  1309. const index = loop(dest);
  1310. if (index > -1 && (allowSameIndex || index !== currIndex)) {
  1311. setIndex(index);
  1312. Move.move(dest, index, prevIndex, callback);
  1313. }
  1314. }
  1315. }
  1316. function scroll(destination, duration, snap, callback) {
  1317. Components2.Scroll.scroll(destination, duration, snap, () => {
  1318. const index = loop(Move.toIndex(getPosition()));
  1319. setIndex(omitEnd ? min(index, endIndex) : index);
  1320. callback && callback();
  1321. });
  1322. }
  1323. function parse(control) {
  1324. let index = currIndex;
  1325. if (isString(control)) {
  1326. const [, indicator, number] = control.match(/([+\-<>])(\d+)?/) || [];
  1327. if (indicator === "+" || indicator === "-") {
  1328. index = computeDestIndex(currIndex + +`${indicator}${+number || 1}`, currIndex);
  1329. } else if (indicator === ">") {
  1330. index = number ? toIndex(+number) : getNext(true);
  1331. } else if (indicator === "<") {
  1332. index = getPrev(true);
  1333. }
  1334. } else {
  1335. index = isLoop ? control : clamp(control, 0, endIndex);
  1336. }
  1337. return index;
  1338. }
  1339. function getAdjacent(prev, destination) {
  1340. const number = perMove || (hasFocus() ? 1 : perPage);
  1341. const dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex, !(perMove || hasFocus()));
  1342. if (dest === -1 && isSlide) {
  1343. if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) {
  1344. return prev ? 0 : endIndex;
  1345. }
  1346. }
  1347. return destination ? dest : loop(dest);
  1348. }
  1349. function computeDestIndex(dest, from, snapPage) {
  1350. if (isEnough() || hasFocus()) {
  1351. const index = computeMovableDestIndex(dest);
  1352. if (index !== dest) {
  1353. from = dest;
  1354. dest = index;
  1355. snapPage = false;
  1356. }
  1357. if (dest < 0 || dest > endIndex) {
  1358. if (!perMove && (between(0, dest, from, true) || between(endIndex, from, dest, true))) {
  1359. dest = toIndex(toPage(dest));
  1360. } else {
  1361. if (isLoop) {
  1362. dest = snapPage ? dest < 0 ? -(slideCount % perPage || perPage) : slideCount : dest;
  1363. } else if (options.rewind) {
  1364. dest = dest < 0 ? endIndex : 0;
  1365. } else {
  1366. dest = -1;
  1367. }
  1368. }
  1369. } else {
  1370. if (snapPage && dest !== from) {
  1371. dest = toIndex(toPage(from) + (dest < from ? -1 : 1));
  1372. }
  1373. }
  1374. } else {
  1375. dest = -1;
  1376. }
  1377. return dest;
  1378. }
  1379. function computeMovableDestIndex(dest) {
  1380. if (isSlide && options.trimSpace === "move" && dest !== currIndex) {
  1381. const position = getPosition();
  1382. while (position === toPosition(dest, true) && between(dest, 0, Splide2.length - 1, !options.rewind)) {
  1383. dest < currIndex ? --dest : ++dest;
  1384. }
  1385. }
  1386. return dest;
  1387. }
  1388. function loop(index) {
  1389. return isLoop ? (index + slideCount) % slideCount || 0 : index;
  1390. }
  1391. function getEnd() {
  1392. let end = slideCount - (hasFocus() || isLoop && perMove ? 1 : perPage);
  1393. while (omitEnd && end-- > 0) {
  1394. if (toPosition(slideCount - 1, true) !== toPosition(end, true)) {
  1395. end++;
  1396. break;
  1397. }
  1398. }
  1399. return clamp(end, 0, slideCount - 1);
  1400. }
  1401. function toIndex(page) {
  1402. return clamp(hasFocus() ? page : perPage * page, 0, endIndex);
  1403. }
  1404. function toPage(index) {
  1405. return hasFocus() ? min(index, endIndex) : floor((index >= endIndex ? slideCount - 1 : index) / perPage);
  1406. }
  1407. function toDest(destination) {
  1408. const closest = Move.toIndex(destination);
  1409. return isSlide ? clamp(closest, 0, endIndex) : closest;
  1410. }
  1411. function setIndex(index) {
  1412. if (index !== currIndex) {
  1413. prevIndex = currIndex;
  1414. currIndex = index;
  1415. }
  1416. }
  1417. function getIndex(prev) {
  1418. return prev ? prevIndex : currIndex;
  1419. }
  1420. function hasFocus() {
  1421. return !isUndefined(options.focus) || options.isNavigation;
  1422. }
  1423. function isBusy() {
  1424. return Splide2.state.is([MOVING, SCROLLING]) && !!options.waitForTransition;
  1425. }
  1426. return {
  1427. mount,
  1428. go,
  1429. scroll,
  1430. getNext,
  1431. getPrev,
  1432. getAdjacent,
  1433. getEnd,
  1434. setIndex,
  1435. getIndex,
  1436. toIndex,
  1437. toPage,
  1438. toDest,
  1439. hasFocus,
  1440. isBusy
  1441. };
  1442. }
  1443. const XML_NAME_SPACE = "http://www.w3.org/2000/svg";
  1444. const 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";
  1445. const SIZE = 40;
  1446. function Arrows(Splide2, Components2, options) {
  1447. const event = EventInterface(Splide2);
  1448. const { on, bind, emit } = event;
  1449. const { classes, i18n } = options;
  1450. const { Elements, Controller } = Components2;
  1451. const { arrows: placeholder, track } = Elements;
  1452. let wrapper = placeholder;
  1453. let prev = Elements.prev;
  1454. let next = Elements.next;
  1455. let created;
  1456. let wrapperClasses;
  1457. const arrows = {};
  1458. function mount() {
  1459. init();
  1460. on(EVENT_UPDATED, remount);
  1461. }
  1462. function remount() {
  1463. destroy();
  1464. mount();
  1465. }
  1466. function init() {
  1467. const enabled = options.arrows;
  1468. if (enabled && !(prev && next)) {
  1469. createArrows();
  1470. }
  1471. if (prev && next) {
  1472. assign(arrows, { prev, next });
  1473. display(wrapper, enabled ? "" : "none");
  1474. addClass(wrapper, wrapperClasses = `${CLASS_ARROWS}--${options.direction}`);
  1475. if (enabled) {
  1476. listen();
  1477. update();
  1478. setAttribute([prev, next], ARIA_CONTROLS, track.id);
  1479. emit(EVENT_ARROWS_MOUNTED, prev, next);
  1480. }
  1481. }
  1482. }
  1483. function destroy() {
  1484. event.destroy();
  1485. removeClass(wrapper, wrapperClasses);
  1486. if (created) {
  1487. remove(placeholder ? [prev, next] : wrapper);
  1488. prev = next = null;
  1489. } else {
  1490. removeAttribute([prev, next], ALL_ATTRIBUTES);
  1491. }
  1492. }
  1493. function listen() {
  1494. on([EVENT_MOUNTED, EVENT_MOVED, EVENT_REFRESH, EVENT_SCROLLED, EVENT_END_INDEX_CHANGED], update);
  1495. bind(next, "click", apply(go, ">"));
  1496. bind(prev, "click", apply(go, "<"));
  1497. }
  1498. function go(control) {
  1499. Controller.go(control, true);
  1500. }
  1501. function createArrows() {
  1502. wrapper = placeholder || create("div", classes.arrows);
  1503. prev = createArrow(true);
  1504. next = createArrow(false);
  1505. created = true;
  1506. append(wrapper, [prev, next]);
  1507. !placeholder && before(wrapper, track);
  1508. }
  1509. function createArrow(prev2) {
  1510. const arrow = `<button class="${classes.arrow} ${prev2 ? classes.prev : classes.next}" type="button"><svg xmlns="${XML_NAME_SPACE}" viewBox="0 0 ${SIZE} ${SIZE}" width="${SIZE}" height="${SIZE}" focusable="false"><path d="${options.arrowPath || PATH}" />`;
  1511. return parseHtml(arrow);
  1512. }
  1513. function update() {
  1514. if (prev && next) {
  1515. const index = Splide2.index;
  1516. const prevIndex = Controller.getPrev();
  1517. const nextIndex = Controller.getNext();
  1518. const prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev;
  1519. const nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next;
  1520. prev.disabled = prevIndex < 0;
  1521. next.disabled = nextIndex < 0;
  1522. setAttribute(prev, ARIA_LABEL, prevLabel);
  1523. setAttribute(next, ARIA_LABEL, nextLabel);
  1524. emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex);
  1525. }
  1526. }
  1527. return {
  1528. arrows,
  1529. mount,
  1530. destroy,
  1531. update
  1532. };
  1533. }
  1534. const INTERVAL_DATA_ATTRIBUTE = `${DATA_ATTRIBUTE}-interval`;
  1535. function Autoplay(Splide2, Components2, options) {
  1536. const { on, bind, emit } = EventInterface(Splide2);
  1537. const interval = RequestInterval(options.interval, Splide2.go.bind(Splide2, ">"), onAnimationFrame);
  1538. const { isPaused } = interval;
  1539. const { Elements, Elements: { root, toggle } } = Components2;
  1540. const { autoplay } = options;
  1541. let hovered;
  1542. let focused;
  1543. let stopped = autoplay === "pause";
  1544. function mount() {
  1545. if (autoplay) {
  1546. listen();
  1547. toggle && setAttribute(toggle, ARIA_CONTROLS, Elements.track.id);
  1548. stopped || play();
  1549. update();
  1550. }
  1551. }
  1552. function listen() {
  1553. if (options.pauseOnHover) {
  1554. bind(root, "mouseenter mouseleave", (e) => {
  1555. hovered = e.type === "mouseenter";
  1556. autoToggle();
  1557. });
  1558. }
  1559. if (options.pauseOnFocus) {
  1560. bind(root, "focusin focusout", (e) => {
  1561. focused = e.type === "focusin";
  1562. autoToggle();
  1563. });
  1564. }
  1565. if (toggle) {
  1566. bind(toggle, "click", () => {
  1567. stopped ? play() : pause(true);
  1568. });
  1569. }
  1570. on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind);
  1571. on(EVENT_MOVE, onMove);
  1572. }
  1573. function play() {
  1574. if (isPaused() && Components2.Slides.isEnough()) {
  1575. interval.start(!options.resetProgress);
  1576. focused = hovered = stopped = false;
  1577. update();
  1578. emit(EVENT_AUTOPLAY_PLAY);
  1579. }
  1580. }
  1581. function pause(stop = true) {
  1582. stopped = !!stop;
  1583. update();
  1584. if (!isPaused()) {
  1585. interval.pause();
  1586. emit(EVENT_AUTOPLAY_PAUSE);
  1587. }
  1588. }
  1589. function autoToggle() {
  1590. if (!stopped) {
  1591. hovered || focused ? pause(false) : play();
  1592. }
  1593. }
  1594. function update() {
  1595. if (toggle) {
  1596. toggleClass(toggle, CLASS_ACTIVE, !stopped);
  1597. setAttribute(toggle, ARIA_LABEL, options.i18n[stopped ? "play" : "pause"]);
  1598. }
  1599. }
  1600. function onAnimationFrame(rate) {
  1601. const { bar } = Elements;
  1602. bar && style(bar, "width", `${rate * 100}%`);
  1603. emit(EVENT_AUTOPLAY_PLAYING, rate);
  1604. }
  1605. function onMove(index) {
  1606. const Slide = Components2.Slides.getAt(index);
  1607. interval.set(Slide && +getAttribute(Slide.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval);
  1608. }
  1609. return {
  1610. mount,
  1611. destroy: interval.cancel,
  1612. play,
  1613. pause,
  1614. isPaused
  1615. };
  1616. }
  1617. function Cover(Splide2, Components2, options) {
  1618. const { on } = EventInterface(Splide2);
  1619. function mount() {
  1620. if (options.cover) {
  1621. on(EVENT_LAZYLOAD_LOADED, apply(toggle, true));
  1622. on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply(cover, true));
  1623. }
  1624. }
  1625. function cover(cover2) {
  1626. Components2.Slides.forEach((Slide) => {
  1627. const img = child(Slide.container || Slide.slide, "img");
  1628. if (img && img.src) {
  1629. toggle(cover2, img, Slide);
  1630. }
  1631. });
  1632. }
  1633. function toggle(cover2, img, Slide) {
  1634. Slide.style("background", cover2 ? `center/cover no-repeat url("${img.src}")` : "", true);
  1635. display(img, cover2 ? "none" : "");
  1636. }
  1637. return {
  1638. mount,
  1639. destroy: apply(cover, false)
  1640. };
  1641. }
  1642. const BOUNCE_DIFF_THRESHOLD = 10;
  1643. const BOUNCE_DURATION = 600;
  1644. const FRICTION_FACTOR = 0.6;
  1645. const BASE_VELOCITY = 1.5;
  1646. const MIN_DURATION = 800;
  1647. function Scroll(Splide2, Components2, options) {
  1648. const { on, emit } = EventInterface(Splide2);
  1649. const { state: { set } } = Splide2;
  1650. const { Move } = Components2;
  1651. const { getPosition, getLimit, exceededLimit, translate } = Move;
  1652. const isSlide = Splide2.is(SLIDE);
  1653. let interval;
  1654. let callback;
  1655. let friction = 1;
  1656. function mount() {
  1657. on(EVENT_MOVE, clear);
  1658. on([EVENT_UPDATED, EVENT_REFRESH], cancel);
  1659. }
  1660. function scroll(destination, duration, snap, onScrolled, noConstrain) {
  1661. const from = getPosition();
  1662. clear();
  1663. if (snap && (!isSlide || !exceededLimit())) {
  1664. const size = Components2.Layout.sliderSize();
  1665. const offset = sign(destination) * size * floor(abs(destination) / size) || 0;
  1666. destination = Move.toPosition(Components2.Controller.toDest(destination % size)) + offset;
  1667. }
  1668. const noDistance = approximatelyEqual(from, destination, 1);
  1669. friction = 1;
  1670. duration = noDistance ? 0 : duration || max(abs(destination - from) / BASE_VELOCITY, MIN_DURATION);
  1671. callback = onScrolled;
  1672. interval = RequestInterval(duration, onEnd, apply(update, from, destination, noConstrain), 1);
  1673. set(SCROLLING);
  1674. emit(EVENT_SCROLL);
  1675. interval.start();
  1676. }
  1677. function onEnd() {
  1678. set(IDLE);
  1679. callback && callback();
  1680. emit(EVENT_SCROLLED);
  1681. }
  1682. function update(from, to, noConstrain, rate) {
  1683. const position = getPosition();
  1684. const target = from + (to - from) * easing(rate);
  1685. const diff = (target - position) * friction;
  1686. translate(position + diff);
  1687. if (isSlide && !noConstrain && exceededLimit()) {
  1688. friction *= FRICTION_FACTOR;
  1689. if (abs(diff) < BOUNCE_DIFF_THRESHOLD) {
  1690. scroll(getLimit(exceededLimit(true)), BOUNCE_DURATION, false, callback, true);
  1691. }
  1692. }
  1693. }
  1694. function clear() {
  1695. if (interval) {
  1696. interval.cancel();
  1697. }
  1698. }
  1699. function cancel() {
  1700. if (interval && !interval.isPaused()) {
  1701. clear();
  1702. onEnd();
  1703. }
  1704. }
  1705. function easing(t) {
  1706. const { easingFunc } = options;
  1707. return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4);
  1708. }
  1709. return {
  1710. mount,
  1711. destroy: clear,
  1712. scroll,
  1713. cancel
  1714. };
  1715. }
  1716. const SCROLL_LISTENER_OPTIONS = { passive: false, capture: true };
  1717. function Drag(Splide2, Components2, options) {
  1718. const { on, emit, bind, unbind } = EventInterface(Splide2);
  1719. const { state } = Splide2;
  1720. const { Move, Scroll, Controller, Elements: { track }, Media: { reduce } } = Components2;
  1721. const { resolve, orient } = Components2.Direction;
  1722. const { getPosition, exceededLimit } = Move;
  1723. let basePosition;
  1724. let baseEvent;
  1725. let prevBaseEvent;
  1726. let isFree;
  1727. let dragging;
  1728. let exceeded = false;
  1729. let clickPrevented;
  1730. let disabled;
  1731. let target;
  1732. function mount() {
  1733. bind(track, POINTER_MOVE_EVENTS, noop, SCROLL_LISTENER_OPTIONS);
  1734. bind(track, POINTER_UP_EVENTS, noop, SCROLL_LISTENER_OPTIONS);
  1735. bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS);
  1736. bind(track, "click", onClick, { capture: true });
  1737. bind(track, "dragstart", prevent);
  1738. on([EVENT_MOUNTED, EVENT_UPDATED], init);
  1739. }
  1740. function init() {
  1741. const { drag } = options;
  1742. disable(!drag);
  1743. isFree = drag === "free";
  1744. }
  1745. function onPointerDown(e) {
  1746. clickPrevented = false;
  1747. if (!disabled) {
  1748. const isTouch = isTouchEvent(e);
  1749. if (isDraggable(e.target) && (isTouch || !e.button)) {
  1750. if (!Controller.isBusy()) {
  1751. target = isTouch ? track : window;
  1752. dragging = state.is([MOVING, SCROLLING]);
  1753. prevBaseEvent = null;
  1754. bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS);
  1755. bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS);
  1756. Move.cancel();
  1757. Scroll.cancel();
  1758. save(e);
  1759. } else {
  1760. prevent(e, true);
  1761. }
  1762. }
  1763. }
  1764. }
  1765. function onPointerMove(e) {
  1766. if (!state.is(DRAGGING)) {
  1767. state.set(DRAGGING);
  1768. emit(EVENT_DRAG);
  1769. }
  1770. if (e.cancelable) {
  1771. if (dragging) {
  1772. Move.translate(basePosition + constrain(diffCoord(e)));
  1773. const expired = diffTime(e) > LOG_INTERVAL;
  1774. const hasExceeded = exceeded !== (exceeded = exceededLimit());
  1775. if (expired || hasExceeded) {
  1776. save(e);
  1777. }
  1778. clickPrevented = true;
  1779. emit(EVENT_DRAGGING);
  1780. prevent(e);
  1781. } else if (isSliderDirection(e)) {
  1782. dragging = shouldStart(e);
  1783. prevent(e);
  1784. }
  1785. }
  1786. }
  1787. function onPointerUp(e) {
  1788. if (state.is(DRAGGING)) {
  1789. state.set(IDLE);
  1790. emit(EVENT_DRAGGED);
  1791. }
  1792. if (dragging) {
  1793. move(e);
  1794. prevent(e);
  1795. }
  1796. unbind(target, POINTER_MOVE_EVENTS, onPointerMove);
  1797. unbind(target, POINTER_UP_EVENTS, onPointerUp);
  1798. dragging = false;
  1799. }
  1800. function onClick(e) {
  1801. if (!disabled && clickPrevented) {
  1802. prevent(e, true);
  1803. }
  1804. }
  1805. function save(e) {
  1806. prevBaseEvent = baseEvent;
  1807. baseEvent = e;
  1808. basePosition = getPosition();
  1809. }
  1810. function move(e) {
  1811. const velocity = computeVelocity(e);
  1812. const destination = computeDestination(velocity);
  1813. const rewind = options.rewind && options.rewindByDrag;
  1814. reduce(false);
  1815. if (isFree) {
  1816. Controller.scroll(destination, 0, options.snap);
  1817. } else if (Splide2.is(FADE)) {
  1818. Controller.go(orient(sign(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+");
  1819. } else if (Splide2.is(SLIDE) && exceeded && rewind) {
  1820. Controller.go(exceededLimit(true) ? ">" : "<");
  1821. } else {
  1822. Controller.go(Controller.toDest(destination), true);
  1823. }
  1824. reduce(true);
  1825. }
  1826. function shouldStart(e) {
  1827. const { dragMinThreshold: thresholds } = options;
  1828. const isObj = isObject(thresholds);
  1829. const mouse = isObj && thresholds.mouse || 0;
  1830. const touch = (isObj ? thresholds.touch : +thresholds) || 10;
  1831. return abs(diffCoord(e)) > (isTouchEvent(e) ? touch : mouse);
  1832. }
  1833. function isSliderDirection(e) {
  1834. return abs(diffCoord(e)) > abs(diffCoord(e, true));
  1835. }
  1836. function computeVelocity(e) {
  1837. if (Splide2.is(LOOP) || !exceeded) {
  1838. const time = diffTime(e);
  1839. if (time && time < LOG_INTERVAL) {
  1840. return diffCoord(e) / time;
  1841. }
  1842. }
  1843. return 0;
  1844. }
  1845. function computeDestination(velocity) {
  1846. return getPosition() + sign(velocity) * min(
  1847. abs(velocity) * (options.flickPower || 600),
  1848. isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1)
  1849. );
  1850. }
  1851. function diffCoord(e, orthogonal) {
  1852. return coordOf(e, orthogonal) - coordOf(getBaseEvent(e), orthogonal);
  1853. }
  1854. function diffTime(e) {
  1855. return timeOf(e) - timeOf(getBaseEvent(e));
  1856. }
  1857. function getBaseEvent(e) {
  1858. return baseEvent === e && prevBaseEvent || baseEvent;
  1859. }
  1860. function coordOf(e, orthogonal) {
  1861. return (isTouchEvent(e) ? e.changedTouches[0] : e)[`page${resolve(orthogonal ? "Y" : "X")}`];
  1862. }
  1863. function constrain(diff) {
  1864. return diff / (exceeded && Splide2.is(SLIDE) ? FRICTION : 1);
  1865. }
  1866. function isDraggable(target2) {
  1867. const { noDrag } = options;
  1868. return !matches(target2, `.${CLASS_PAGINATION_PAGE}, .${CLASS_ARROW}`) && (!noDrag || !matches(target2, noDrag));
  1869. }
  1870. function isTouchEvent(e) {
  1871. return typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
  1872. }
  1873. function isDragging() {
  1874. return dragging;
  1875. }
  1876. function disable(value) {
  1877. disabled = value;
  1878. }
  1879. return {
  1880. mount,
  1881. disable,
  1882. isDragging
  1883. };
  1884. }
  1885. const NORMALIZATION_MAP = {
  1886. Spacebar: " ",
  1887. Right: ARROW_RIGHT,
  1888. Left: ARROW_LEFT,
  1889. Up: ARROW_UP,
  1890. Down: ARROW_DOWN
  1891. };
  1892. function normalizeKey(key) {
  1893. key = isString(key) ? key : key.key;
  1894. return NORMALIZATION_MAP[key] || key;
  1895. }
  1896. const KEYBOARD_EVENT = "keydown";
  1897. function Keyboard(Splide2, Components2, options) {
  1898. const { on, bind, unbind } = EventInterface(Splide2);
  1899. const { root } = Splide2;
  1900. const { resolve } = Components2.Direction;
  1901. let target;
  1902. let disabled;
  1903. function mount() {
  1904. init();
  1905. on(EVENT_UPDATED, destroy);
  1906. on(EVENT_UPDATED, init);
  1907. on(EVENT_MOVE, onMove);
  1908. }
  1909. function init() {
  1910. const { keyboard } = options;
  1911. if (keyboard) {
  1912. target = keyboard === "global" ? window : root;
  1913. bind(target, KEYBOARD_EVENT, onKeydown);
  1914. }
  1915. }
  1916. function destroy() {
  1917. unbind(target, KEYBOARD_EVENT);
  1918. }
  1919. function disable(value) {
  1920. disabled = value;
  1921. }
  1922. function onMove() {
  1923. const _disabled = disabled;
  1924. disabled = true;
  1925. nextTick(() => {
  1926. disabled = _disabled;
  1927. });
  1928. }
  1929. function onKeydown(e) {
  1930. if (!disabled) {
  1931. const key = normalizeKey(e);
  1932. if (key === resolve(ARROW_LEFT)) {
  1933. Splide2.go("<");
  1934. } else if (key === resolve(ARROW_RIGHT)) {
  1935. Splide2.go(">");
  1936. }
  1937. }
  1938. }
  1939. return {
  1940. mount,
  1941. destroy,
  1942. disable
  1943. };
  1944. }
  1945. const SRC_DATA_ATTRIBUTE = `${DATA_ATTRIBUTE}-lazy`;
  1946. const SRCSET_DATA_ATTRIBUTE = `${SRC_DATA_ATTRIBUTE}-srcset`;
  1947. const IMAGE_SELECTOR = `[${SRC_DATA_ATTRIBUTE}], [${SRCSET_DATA_ATTRIBUTE}]`;
  1948. function LazyLoad(Splide2, Components2, options) {
  1949. const { on, off, bind, emit } = EventInterface(Splide2);
  1950. const isSequential = options.lazyLoad === "sequential";
  1951. const events = [EVENT_MOVED, EVENT_SCROLLED];
  1952. let entries = [];
  1953. function mount() {
  1954. if (options.lazyLoad) {
  1955. init();
  1956. on(EVENT_REFRESH, init);
  1957. }
  1958. }
  1959. function init() {
  1960. empty(entries);
  1961. register();
  1962. if (isSequential) {
  1963. loadNext();
  1964. } else {
  1965. off(events);
  1966. on(events, check);
  1967. check();
  1968. }
  1969. }
  1970. function register() {
  1971. Components2.Slides.forEach((Slide) => {
  1972. queryAll(Slide.slide, IMAGE_SELECTOR).forEach((img) => {
  1973. const src = getAttribute(img, SRC_DATA_ATTRIBUTE);
  1974. const srcset = getAttribute(img, SRCSET_DATA_ATTRIBUTE);
  1975. if (src !== img.src || srcset !== img.srcset) {
  1976. const className = options.classes.spinner;
  1977. const parent = img.parentElement;
  1978. const spinner = child(parent, `.${className}`) || create("span", className, parent);
  1979. entries.push([img, Slide, spinner]);
  1980. img.src || display(img, "none");
  1981. }
  1982. });
  1983. });
  1984. }
  1985. function check() {
  1986. entries = entries.filter((data) => {
  1987. const distance = options.perPage * ((options.preloadPages || 1) + 1) - 1;
  1988. return data[1].isWithin(Splide2.index, distance) ? load(data) : true;
  1989. });
  1990. entries.length || off(events);
  1991. }
  1992. function load(data) {
  1993. const [img] = data;
  1994. addClass(data[1].slide, CLASS_LOADING);
  1995. bind(img, "load error", apply(onLoad, data));
  1996. setAttribute(img, "src", getAttribute(img, SRC_DATA_ATTRIBUTE));
  1997. setAttribute(img, "srcset", getAttribute(img, SRCSET_DATA_ATTRIBUTE));
  1998. removeAttribute(img, SRC_DATA_ATTRIBUTE);
  1999. removeAttribute(img, SRCSET_DATA_ATTRIBUTE);
  2000. }
  2001. function onLoad(data, e) {
  2002. const [img, Slide] = data;
  2003. removeClass(Slide.slide, CLASS_LOADING);
  2004. if (e.type !== "error") {
  2005. remove(data[2]);
  2006. display(img, "");
  2007. emit(EVENT_LAZYLOAD_LOADED, img, Slide);
  2008. emit(EVENT_RESIZE);
  2009. }
  2010. isSequential && loadNext();
  2011. }
  2012. function loadNext() {
  2013. entries.length && load(entries.shift());
  2014. }
  2015. return {
  2016. mount,
  2017. destroy: apply(empty, entries),
  2018. check
  2019. };
  2020. }
  2021. function Pagination(Splide2, Components2, options) {
  2022. const event = EventInterface(Splide2);
  2023. const { on, emit, bind } = event;
  2024. const { Slides, Elements, Controller } = Components2;
  2025. const { hasFocus, getIndex, go } = Controller;
  2026. const { resolve } = Components2.Direction;
  2027. const { pagination: placeholder } = Elements;
  2028. const items = [];
  2029. let list;
  2030. let paginationClasses;
  2031. function mount() {
  2032. destroy();
  2033. on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], mount);
  2034. const enabled = options.pagination;
  2035. placeholder && display(placeholder, enabled ? "" : "none");
  2036. if (enabled) {
  2037. on([EVENT_MOVE, EVENT_SCROLL, EVENT_SCROLLED], update);
  2038. createPagination();
  2039. update();
  2040. emit(EVENT_PAGINATION_MOUNTED, { list, items }, getAt(Splide2.index));
  2041. }
  2042. }
  2043. function destroy() {
  2044. if (list) {
  2045. remove(placeholder ? slice(list.children) : list);
  2046. removeClass(list, paginationClasses);
  2047. empty(items);
  2048. list = null;
  2049. }
  2050. event.destroy();
  2051. }
  2052. function createPagination() {
  2053. const { length } = Splide2;
  2054. const { classes, i18n, perPage } = options;
  2055. const max = hasFocus() ? Controller.getEnd() + 1 : ceil(length / perPage);
  2056. list = placeholder || create("ul", classes.pagination, Elements.track.parentElement);
  2057. addClass(list, paginationClasses = `${CLASS_PAGINATION}--${getDirection()}`);
  2058. setAttribute(list, ROLE, "tablist");
  2059. setAttribute(list, ARIA_LABEL, i18n.select);
  2060. setAttribute(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : "");
  2061. for (let i = 0; i < max; i++) {
  2062. const li = create("li", null, list);
  2063. const button = create("button", { class: classes.page, type: "button" }, li);
  2064. const controls = Slides.getIn(i).map((Slide) => Slide.slide.id);
  2065. const text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX;
  2066. bind(button, "click", apply(onClick, i));
  2067. if (options.paginationKeyboard) {
  2068. bind(button, "keydown", apply(onKeydown, i));
  2069. }
  2070. setAttribute(li, ROLE, "presentation");
  2071. setAttribute(button, ROLE, "tab");
  2072. setAttribute(button, ARIA_CONTROLS, controls.join(" "));
  2073. setAttribute(button, ARIA_LABEL, format(text, i + 1));
  2074. setAttribute(button, TAB_INDEX, -1);
  2075. items.push({ li, button, page: i });
  2076. }
  2077. }
  2078. function onClick(page) {
  2079. go(`>${page}`, true);
  2080. }
  2081. function onKeydown(page, e) {
  2082. const { length } = items;
  2083. const key = normalizeKey(e);
  2084. const dir = getDirection();
  2085. let nextPage = -1;
  2086. if (key === resolve(ARROW_RIGHT, false, dir)) {
  2087. nextPage = ++page % length;
  2088. } else if (key === resolve(ARROW_LEFT, false, dir)) {
  2089. nextPage = (--page + length) % length;
  2090. } else if (key === "Home") {
  2091. nextPage = 0;
  2092. } else if (key === "End") {
  2093. nextPage = length - 1;
  2094. }
  2095. const item = items[nextPage];
  2096. if (item) {
  2097. focus(item.button);
  2098. go(`>${nextPage}`);
  2099. prevent(e, true);
  2100. }
  2101. }
  2102. function getDirection() {
  2103. return options.paginationDirection || options.direction;
  2104. }
  2105. function getAt(index) {
  2106. return items[Controller.toPage(index)];
  2107. }
  2108. function update() {
  2109. const prev = getAt(getIndex(true));
  2110. const curr = getAt(getIndex());
  2111. if (prev) {
  2112. const { button } = prev;
  2113. removeClass(button, CLASS_ACTIVE);
  2114. removeAttribute(button, ARIA_SELECTED);
  2115. setAttribute(button, TAB_INDEX, -1);
  2116. }
  2117. if (curr) {
  2118. const { button } = curr;
  2119. addClass(button, CLASS_ACTIVE);
  2120. setAttribute(button, ARIA_SELECTED, true);
  2121. setAttribute(button, TAB_INDEX, "");
  2122. }
  2123. emit(EVENT_PAGINATION_UPDATED, { list, items }, prev, curr);
  2124. }
  2125. return {
  2126. items,
  2127. mount,
  2128. destroy,
  2129. getAt,
  2130. update
  2131. };
  2132. }
  2133. const TRIGGER_KEYS = [" ", "Enter"];
  2134. function Sync(Splide2, Components2, options) {
  2135. const { isNavigation, slideFocus } = options;
  2136. const events = [];
  2137. function mount() {
  2138. Splide2.splides.forEach((target) => {
  2139. if (!target.isParent) {
  2140. sync(Splide2, target.splide);
  2141. sync(target.splide, Splide2);
  2142. }
  2143. });
  2144. if (isNavigation) {
  2145. navigate();
  2146. }
  2147. }
  2148. function destroy() {
  2149. events.forEach((event) => {
  2150. event.destroy();
  2151. });
  2152. empty(events);
  2153. }
  2154. function remount() {
  2155. destroy();
  2156. mount();
  2157. }
  2158. function sync(splide, target) {
  2159. const event = EventInterface(splide);
  2160. event.on(EVENT_MOVE, (index, prev, dest) => {
  2161. target.go(target.is(LOOP) ? dest : index);
  2162. });
  2163. events.push(event);
  2164. }
  2165. function navigate() {
  2166. const event = EventInterface(Splide2);
  2167. const { on } = event;
  2168. on(EVENT_CLICK, onClick);
  2169. on(EVENT_SLIDE_KEYDOWN, onKeydown);
  2170. on([EVENT_MOUNTED, EVENT_UPDATED], update);
  2171. events.push(event);
  2172. event.emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides);
  2173. }
  2174. function update() {
  2175. setAttribute(Components2.Elements.list, ARIA_ORIENTATION, options.direction === TTB ? "vertical" : "");
  2176. }
  2177. function onClick(Slide) {
  2178. Splide2.go(Slide.index);
  2179. }
  2180. function onKeydown(Slide, e) {
  2181. if (includes(TRIGGER_KEYS, normalizeKey(e))) {
  2182. onClick(Slide);
  2183. prevent(e);
  2184. }
  2185. }
  2186. return {
  2187. setup: apply(
  2188. Components2.Media.set,
  2189. { slideFocus: isUndefined(slideFocus) ? isNavigation : slideFocus },
  2190. true
  2191. ),
  2192. mount,
  2193. destroy,
  2194. remount
  2195. };
  2196. }
  2197. function Wheel(Splide2, Components2, options) {
  2198. const { bind } = EventInterface(Splide2);
  2199. let lastTime = 0;
  2200. function mount() {
  2201. if (options.wheel) {
  2202. bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS);
  2203. }
  2204. }
  2205. function onWheel(e) {
  2206. if (e.cancelable) {
  2207. const { deltaY } = e;
  2208. const backwards = deltaY < 0;
  2209. const timeStamp = timeOf(e);
  2210. const min = options.wheelMinThreshold || 0;
  2211. const sleep = options.wheelSleep || 0;
  2212. if (abs(deltaY) > min && timeStamp - lastTime > sleep) {
  2213. Splide2.go(backwards ? "<" : ">");
  2214. lastTime = timeStamp;
  2215. }
  2216. shouldPrevent(backwards) && prevent(e);
  2217. }
  2218. }
  2219. function shouldPrevent(backwards) {
  2220. return !options.releaseWheel || Splide2.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1;
  2221. }
  2222. return {
  2223. mount
  2224. };
  2225. }
  2226. const SR_REMOVAL_DELAY = 90;
  2227. function Live(Splide2, Components2, options) {
  2228. const { on } = EventInterface(Splide2);
  2229. const { track } = Components2.Elements;
  2230. const enabled = options.live && !options.isNavigation;
  2231. const sr = create("span", CLASS_SR);
  2232. const interval = RequestInterval(SR_REMOVAL_DELAY, apply(toggle, false));
  2233. function mount() {
  2234. if (enabled) {
  2235. disable(!Components2.Autoplay.isPaused());
  2236. setAttribute(track, ARIA_ATOMIC, true);
  2237. sr.textContent = "\u2026";
  2238. on(EVENT_AUTOPLAY_PLAY, apply(disable, true));
  2239. on(EVENT_AUTOPLAY_PAUSE, apply(disable, false));
  2240. on([EVENT_MOVED, EVENT_SCROLLED], apply(toggle, true));
  2241. }
  2242. }
  2243. function toggle(active) {
  2244. setAttribute(track, ARIA_BUSY, active);
  2245. if (active) {
  2246. append(track, sr);
  2247. interval.start();
  2248. } else {
  2249. remove(sr);
  2250. interval.cancel();
  2251. }
  2252. }
  2253. function destroy() {
  2254. removeAttribute(track, [ARIA_LIVE, ARIA_ATOMIC, ARIA_BUSY]);
  2255. remove(sr);
  2256. }
  2257. function disable(disabled) {
  2258. if (enabled) {
  2259. setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite");
  2260. }
  2261. }
  2262. return {
  2263. mount,
  2264. disable,
  2265. destroy
  2266. };
  2267. }
  2268. var ComponentConstructors = /*#__PURE__*/Object.freeze({
  2269. __proto__: null,
  2270. Media: Media,
  2271. Direction: Direction,
  2272. Elements: Elements,
  2273. Slides: Slides,
  2274. Layout: Layout,
  2275. Clones: Clones,
  2276. Move: Move,
  2277. Controller: Controller,
  2278. Arrows: Arrows,
  2279. Autoplay: Autoplay,
  2280. Cover: Cover,
  2281. Scroll: Scroll,
  2282. Drag: Drag,
  2283. Keyboard: Keyboard,
  2284. LazyLoad: LazyLoad,
  2285. Pagination: Pagination,
  2286. Sync: Sync,
  2287. Wheel: Wheel,
  2288. Live: Live
  2289. });
  2290. const I18N = {
  2291. prev: "Previous slide",
  2292. next: "Next slide",
  2293. first: "Go to first slide",
  2294. last: "Go to last slide",
  2295. slideX: "Go to slide %s",
  2296. pageX: "Go to page %s",
  2297. play: "Start autoplay",
  2298. pause: "Pause autoplay",
  2299. carousel: "carousel",
  2300. slide: "slide",
  2301. select: "Select a slide to show",
  2302. slideLabel: "%s of %s"
  2303. };
  2304. const DEFAULTS = {
  2305. type: "slide",
  2306. role: "region",
  2307. speed: 400,
  2308. perPage: 1,
  2309. cloneStatus: true,
  2310. arrows: true,
  2311. pagination: true,
  2312. paginationKeyboard: true,
  2313. interval: 5e3,
  2314. pauseOnHover: true,
  2315. pauseOnFocus: true,
  2316. resetProgress: true,
  2317. easing: "cubic-bezier(0.25, 1, 0.5, 1)",
  2318. drag: true,
  2319. direction: "ltr",
  2320. trimSpace: true,
  2321. focusableNodes: "a, button, textarea, input, select, iframe",
  2322. live: true,
  2323. classes: CLASSES,
  2324. i18n: I18N,
  2325. reducedMotion: {
  2326. speed: 0,
  2327. rewindSpeed: 0,
  2328. autoplay: "pause"
  2329. }
  2330. };
  2331. function Fade(Splide2, Components2, options) {
  2332. const { Slides } = Components2;
  2333. function mount() {
  2334. EventInterface(Splide2).on([EVENT_MOUNTED, EVENT_REFRESH], init);
  2335. }
  2336. function init() {
  2337. Slides.forEach((Slide) => {
  2338. Slide.style("transform", `translateX(-${100 * Slide.index}%)`);
  2339. });
  2340. }
  2341. function start(index, done) {
  2342. Slides.style("transition", `opacity ${options.speed}ms ${options.easing}`);
  2343. nextTick(done);
  2344. }
  2345. return {
  2346. mount,
  2347. start,
  2348. cancel: noop
  2349. };
  2350. }
  2351. function Slide(Splide2, Components2, options) {
  2352. const { Move, Controller, Scroll } = Components2;
  2353. const { list } = Components2.Elements;
  2354. const transition = apply(style, list, "transition");
  2355. let endCallback;
  2356. function mount() {
  2357. EventInterface(Splide2).bind(list, "transitionend", (e) => {
  2358. if (e.target === list && endCallback) {
  2359. cancel();
  2360. endCallback();
  2361. }
  2362. });
  2363. }
  2364. function start(index, done) {
  2365. const destination = Move.toPosition(index, true);
  2366. const position = Move.getPosition();
  2367. const speed = getSpeed(index);
  2368. if (abs(destination - position) >= 1 && speed >= 1) {
  2369. if (options.useScroll) {
  2370. Scroll.scroll(destination, speed, false, done);
  2371. } else {
  2372. transition(`transform ${speed}ms ${options.easing}`);
  2373. Move.translate(destination, true);
  2374. endCallback = done;
  2375. }
  2376. } else {
  2377. Move.jump(index);
  2378. done();
  2379. }
  2380. }
  2381. function cancel() {
  2382. transition("");
  2383. Scroll.cancel();
  2384. }
  2385. function getSpeed(index) {
  2386. const { rewindSpeed } = options;
  2387. if (Splide2.is(SLIDE) && rewindSpeed) {
  2388. const prev = Controller.getIndex(true);
  2389. const end = Controller.getEnd();
  2390. if (prev === 0 && index >= end || prev >= end && index === 0) {
  2391. return rewindSpeed;
  2392. }
  2393. }
  2394. return options.speed;
  2395. }
  2396. return {
  2397. mount,
  2398. start,
  2399. cancel
  2400. };
  2401. }
  2402. class Splide {
  2403. static defaults = {};
  2404. static STATES = STATES;
  2405. root;
  2406. event = EventInterface();
  2407. Components = {};
  2408. state = State(CREATED);
  2409. splides = [];
  2410. _o = {};
  2411. _C;
  2412. _E = {};
  2413. _T;
  2414. constructor(target, options) {
  2415. const root = isString(target) ? query(document, target) : target;
  2416. assert(root, `${root} is invalid.`);
  2417. this.root = root;
  2418. options = merge({
  2419. label: getAttribute(root, ARIA_LABEL) || "",
  2420. labelledby: getAttribute(root, ARIA_LABELLEDBY) || ""
  2421. }, DEFAULTS, Splide.defaults, options || {});
  2422. try {
  2423. merge(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE)));
  2424. } catch (e) {
  2425. assert(false, "Invalid JSON");
  2426. }
  2427. this._o = Object.create(merge({}, options));
  2428. }
  2429. mount(Extensions, Transition) {
  2430. const { state, Components: Components2 } = this;
  2431. assert(state.is([CREATED, DESTROYED]), "Already mounted!");
  2432. state.set(CREATED);
  2433. this._C = Components2;
  2434. this._T = Transition || this._T || (this.is(FADE) ? Fade : Slide);
  2435. this._E = Extensions || this._E;
  2436. const Constructors = assign({}, ComponentConstructors, this._E, { Transition: this._T });
  2437. forOwn(Constructors, (Component, key) => {
  2438. const component = Component(this, Components2, this._o);
  2439. Components2[key] = component;
  2440. component.setup && component.setup();
  2441. });
  2442. forOwn(Components2, (component) => {
  2443. component.mount && component.mount();
  2444. });
  2445. this.emit(EVENT_MOUNTED);
  2446. addClass(this.root, CLASS_INITIALIZED);
  2447. state.set(IDLE);
  2448. this.emit(EVENT_READY);
  2449. return this;
  2450. }
  2451. sync(splide) {
  2452. this.splides.push({ splide });
  2453. splide.splides.push({ splide: this, isParent: true });
  2454. if (this.state.is(IDLE)) {
  2455. this._C.Sync.remount();
  2456. splide.Components.Sync.remount();
  2457. }
  2458. return this;
  2459. }
  2460. go(control) {
  2461. this._C.Controller.go(control);
  2462. return this;
  2463. }
  2464. on(events, callback) {
  2465. this.event.on(events, callback);
  2466. return this;
  2467. }
  2468. off(events) {
  2469. this.event.off(events);
  2470. return this;
  2471. }
  2472. emit(event) {
  2473. this.event.emit(event, ...slice(arguments, 1));
  2474. return this;
  2475. }
  2476. add(slides, index) {
  2477. this._C.Slides.add(slides, index);
  2478. return this;
  2479. }
  2480. remove(matcher) {
  2481. this._C.Slides.remove(matcher);
  2482. return this;
  2483. }
  2484. is(type) {
  2485. return this._o.type === type;
  2486. }
  2487. refresh() {
  2488. this.emit(EVENT_REFRESH);
  2489. return this;
  2490. }
  2491. destroy(completely = true) {
  2492. const { event, state } = this;
  2493. if (state.is(CREATED)) {
  2494. EventInterface(this).on(EVENT_READY, this.destroy.bind(this, completely));
  2495. } else {
  2496. forOwn(this._C, (component) => {
  2497. component.destroy && component.destroy(completely);
  2498. }, true);
  2499. event.emit(EVENT_DESTROY);
  2500. event.destroy();
  2501. completely && empty(this.splides);
  2502. state.set(DESTROYED);
  2503. }
  2504. return this;
  2505. }
  2506. get options() {
  2507. return this._o;
  2508. }
  2509. set options(options) {
  2510. this._C.Media.set(options, true, true);
  2511. }
  2512. get length() {
  2513. return this._C.Slides.getLength(true);
  2514. }
  2515. get index() {
  2516. return this._C.Controller.getIndex();
  2517. }
  2518. }
  2519. const CLASS_RENDERED = "is-rendered";
  2520. const RENDERER_DEFAULT_CONFIG = {
  2521. listTag: "ul",
  2522. slideTag: "li"
  2523. };
  2524. class Style {
  2525. styles = {};
  2526. id;
  2527. options;
  2528. constructor(id, options) {
  2529. this.id = id;
  2530. this.options = options;
  2531. }
  2532. rule(selector, prop, value, breakpoint) {
  2533. breakpoint = breakpoint || "default";
  2534. const selectors = this.styles[breakpoint] = this.styles[breakpoint] || {};
  2535. const styles = selectors[selector] = selectors[selector] || {};
  2536. styles[prop] = value;
  2537. }
  2538. build() {
  2539. let css = "";
  2540. if (this.styles.default) {
  2541. css += this.buildSelectors(this.styles.default);
  2542. }
  2543. Object.keys(this.styles).sort((n, m) => this.options.mediaQuery === "min" ? +n - +m : +m - +n).forEach((breakpoint) => {
  2544. if (breakpoint !== "default") {
  2545. css += `@media screen and (max-width: ${breakpoint}px) {`;
  2546. css += this.buildSelectors(this.styles[breakpoint]);
  2547. css += `}`;
  2548. }
  2549. });
  2550. return css;
  2551. }
  2552. buildSelectors(selectors) {
  2553. let css = "";
  2554. forOwn(selectors, (styles, selector) => {
  2555. selector = `#${this.id} ${selector}`.trim();
  2556. css += `${selector} {`;
  2557. forOwn(styles, (value, prop) => {
  2558. if (value || value === 0) {
  2559. css += `${prop}: ${value};`;
  2560. }
  2561. });
  2562. css += "}";
  2563. });
  2564. return css;
  2565. }
  2566. }
  2567. class SplideRenderer {
  2568. static clean(splide) {
  2569. const { on } = EventInterface(splide);
  2570. const { root } = splide;
  2571. const clones = queryAll(root, `.${CLASS_CLONE}`);
  2572. on(EVENT_MOUNTED, () => {
  2573. remove(child(root, "style"));
  2574. });
  2575. remove(clones);
  2576. }
  2577. contents;
  2578. slides = [];
  2579. Direction;
  2580. Style;
  2581. options = {};
  2582. config;
  2583. id;
  2584. breakpoints = [];
  2585. constructor(contents, options, config, defaults) {
  2586. merge(DEFAULTS, defaults || {});
  2587. merge(merge(this.options, DEFAULTS), options || {});
  2588. this.contents = contents;
  2589. this.config = assign({}, RENDERER_DEFAULT_CONFIG, config || {});
  2590. this.id = this.config.id || uniqueId("splide");
  2591. this.Style = new Style(this.id, this.options);
  2592. this.Direction = Direction(null, null, this.options);
  2593. assert(this.contents.length, "Provide at least 1 content.");
  2594. this.init();
  2595. }
  2596. init() {
  2597. this.parseBreakpoints();
  2598. this.initSlides();
  2599. this.registerRootStyles();
  2600. this.registerTrackStyles();
  2601. this.registerSlideStyles();
  2602. this.registerListStyles();
  2603. }
  2604. initSlides() {
  2605. push(this.slides, this.contents.map((content, index) => {
  2606. content = isString(content) ? { html: content } : content;
  2607. content.styles = content.styles || {};
  2608. content.attrs = content.attrs || {};
  2609. this.cover(content);
  2610. const classes = `${this.options.classes.slide} ${index === 0 ? CLASS_ACTIVE : ""}`;
  2611. assign(content.attrs, {
  2612. class: `${classes} ${content.attrs.class || ""}`.trim(),
  2613. style: this.buildStyles(content.styles)
  2614. });
  2615. return content;
  2616. }));
  2617. if (this.isLoop()) {
  2618. this.generateClones(this.slides);
  2619. }
  2620. }
  2621. registerRootStyles() {
  2622. this.breakpoints.forEach(([width, options]) => {
  2623. this.Style.rule(" ", "max-width", unit(options.width), width);
  2624. });
  2625. }
  2626. registerTrackStyles() {
  2627. const { Style: Style2 } = this;
  2628. const selector = `.${CLASS_TRACK}`;
  2629. this.breakpoints.forEach(([width, options]) => {
  2630. Style2.rule(selector, this.resolve("paddingLeft"), this.cssPadding(options, false), width);
  2631. Style2.rule(selector, this.resolve("paddingRight"), this.cssPadding(options, true), width);
  2632. Style2.rule(selector, "height", this.cssTrackHeight(options), width);
  2633. });
  2634. }
  2635. registerListStyles() {
  2636. const { Style: Style2 } = this;
  2637. const selector = `.${CLASS_LIST}`;
  2638. this.breakpoints.forEach(([width, options]) => {
  2639. Style2.rule(selector, "transform", this.buildTranslate(options), width);
  2640. if (!this.cssSlideHeight(options)) {
  2641. Style2.rule(selector, "aspect-ratio", this.cssAspectRatio(options), width);
  2642. }
  2643. });
  2644. }
  2645. registerSlideStyles() {
  2646. const { Style: Style2 } = this;
  2647. const selector = `.${CLASS_SLIDE}`;
  2648. this.breakpoints.forEach(([width, options]) => {
  2649. Style2.rule(selector, "width", this.cssSlideWidth(options), width);
  2650. Style2.rule(selector, "height", this.cssSlideHeight(options) || "100%", width);
  2651. Style2.rule(selector, this.resolve("marginRight"), unit(options.gap) || "0px", width);
  2652. Style2.rule(`${selector} > img`, "display", options.cover ? "none" : "inline", width);
  2653. });
  2654. }
  2655. buildTranslate(options) {
  2656. const { resolve, orient } = this.Direction;
  2657. const values = [];
  2658. values.push(this.cssOffsetClones(options));
  2659. values.push(this.cssOffsetGaps(options));
  2660. if (this.isCenter(options)) {
  2661. values.push(this.buildCssValue(orient(-50), "%"));
  2662. values.push(...this.cssOffsetCenter(options));
  2663. }
  2664. return values.filter(Boolean).map((value) => `translate${resolve("X")}(${value})`).join(" ");
  2665. }
  2666. cssOffsetClones(options) {
  2667. const { resolve, orient } = this.Direction;
  2668. const cloneCount = this.getCloneCount();
  2669. if (this.isFixedWidth(options)) {
  2670. const { value, unit: unit2 } = this.parseCssValue(options[resolve("fixedWidth")]);
  2671. return this.buildCssValue(orient(value) * cloneCount, unit2);
  2672. }
  2673. const percent = 100 * cloneCount / options.perPage;
  2674. return `${orient(percent)}%`;
  2675. }
  2676. cssOffsetCenter(options) {
  2677. const { resolve, orient } = this.Direction;
  2678. if (this.isFixedWidth(options)) {
  2679. const { value, unit: unit2 } = this.parseCssValue(options[resolve("fixedWidth")]);
  2680. return [this.buildCssValue(orient(value / 2), unit2)];
  2681. }
  2682. const values = [];
  2683. const { perPage, gap } = options;
  2684. values.push(`${orient(50 / perPage)}%`);
  2685. if (gap) {
  2686. const { value, unit: unit2 } = this.parseCssValue(gap);
  2687. const gapOffset = (value / perPage - value) / 2;
  2688. values.push(this.buildCssValue(orient(gapOffset), unit2));
  2689. }
  2690. return values;
  2691. }
  2692. cssOffsetGaps(options) {
  2693. const cloneCount = this.getCloneCount();
  2694. if (cloneCount && options.gap) {
  2695. const { orient } = this.Direction;
  2696. const { value, unit: unit2 } = this.parseCssValue(options.gap);
  2697. if (this.isFixedWidth(options)) {
  2698. return this.buildCssValue(orient(value * cloneCount), unit2);
  2699. }
  2700. const { perPage } = options;
  2701. const gaps = cloneCount / perPage;
  2702. return this.buildCssValue(orient(gaps * value), unit2);
  2703. }
  2704. return "";
  2705. }
  2706. resolve(prop) {
  2707. return camelToKebab(this.Direction.resolve(prop));
  2708. }
  2709. cssPadding(options, right) {
  2710. const { padding } = options;
  2711. const prop = this.Direction.resolve(right ? "right" : "left", true);
  2712. return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px";
  2713. }
  2714. cssTrackHeight(options) {
  2715. let height = "";
  2716. if (this.isVertical()) {
  2717. height = this.cssHeight(options);
  2718. assert(height, '"height" is missing.');
  2719. height = `calc(${height} - ${this.cssPadding(options, false)} - ${this.cssPadding(options, true)})`;
  2720. }
  2721. return height;
  2722. }
  2723. cssHeight(options) {
  2724. return unit(options.height);
  2725. }
  2726. cssSlideWidth(options) {
  2727. return options.autoWidth ? "" : unit(options.fixedWidth) || (this.isVertical() ? "" : this.cssSlideSize(options));
  2728. }
  2729. cssSlideHeight(options) {
  2730. return unit(options.fixedHeight) || (this.isVertical() ? options.autoHeight ? "" : this.cssSlideSize(options) : this.cssHeight(options));
  2731. }
  2732. cssSlideSize(options) {
  2733. const gap = unit(options.gap);
  2734. return `calc((100%${gap && ` + ${gap}`})/${options.perPage || 1}${gap && ` - ${gap}`})`;
  2735. }
  2736. cssAspectRatio(options) {
  2737. const { heightRatio } = options;
  2738. return heightRatio ? `${1 / heightRatio}` : "";
  2739. }
  2740. buildCssValue(value, unit2) {
  2741. return `${value}${unit2}`;
  2742. }
  2743. parseCssValue(value) {
  2744. if (isString(value)) {
  2745. const number = parseFloat(value) || 0;
  2746. const unit2 = value.replace(/\d*(\.\d*)?/, "") || "px";
  2747. return { value: number, unit: unit2 };
  2748. }
  2749. return { value, unit: "px" };
  2750. }
  2751. parseBreakpoints() {
  2752. const { breakpoints } = this.options;
  2753. this.breakpoints.push(["default", this.options]);
  2754. if (breakpoints) {
  2755. forOwn(breakpoints, (options, width) => {
  2756. this.breakpoints.push([width, merge(merge({}, this.options), options)]);
  2757. });
  2758. }
  2759. }
  2760. isFixedWidth(options) {
  2761. return !!options[this.Direction.resolve("fixedWidth")];
  2762. }
  2763. isLoop() {
  2764. return this.options.type === LOOP;
  2765. }
  2766. isCenter(options) {
  2767. if (options.focus === "center") {
  2768. if (this.isLoop()) {
  2769. return true;
  2770. }
  2771. if (this.options.type === SLIDE) {
  2772. return !this.options.trimSpace;
  2773. }
  2774. }
  2775. return false;
  2776. }
  2777. isVertical() {
  2778. return this.options.direction === TTB;
  2779. }
  2780. buildClasses() {
  2781. const { options } = this;
  2782. return [
  2783. CLASS_ROOT,
  2784. `${CLASS_ROOT}--${options.type}`,
  2785. `${CLASS_ROOT}--${options.direction}`,
  2786. options.drag && `${CLASS_ROOT}--draggable`,
  2787. options.isNavigation && `${CLASS_ROOT}--nav`,
  2788. CLASS_ACTIVE,
  2789. !this.config.hidden && CLASS_RENDERED
  2790. ].filter(Boolean).join(" ");
  2791. }
  2792. buildAttrs(attrs) {
  2793. let attr = "";
  2794. forOwn(attrs, (value, key) => {
  2795. attr += value ? ` ${camelToKebab(key)}="${value}"` : "";
  2796. });
  2797. return attr.trim();
  2798. }
  2799. buildStyles(styles) {
  2800. let style = "";
  2801. forOwn(styles, (value, key) => {
  2802. style += ` ${camelToKebab(key)}:${value};`;
  2803. });
  2804. return style.trim();
  2805. }
  2806. renderSlides() {
  2807. const { slideTag: tag } = this.config;
  2808. return this.slides.map((content) => {
  2809. return `<${tag} ${this.buildAttrs(content.attrs)}>${content.html || ""}</${tag}>`;
  2810. }).join("");
  2811. }
  2812. cover(content) {
  2813. const { styles, html = "" } = content;
  2814. if (this.options.cover && !this.options.lazyLoad) {
  2815. const src = html.match(/<img.*?src\s*=\s*(['"])(.+?)\1.*?>/);
  2816. if (src && src[2]) {
  2817. styles.background = `center/cover no-repeat url('${src[2]}')`;
  2818. }
  2819. }
  2820. }
  2821. generateClones(contents) {
  2822. const { classes } = this.options;
  2823. const count = this.getCloneCount();
  2824. const slides = contents.slice();
  2825. while (slides.length < count) {
  2826. push(slides, slides);
  2827. }
  2828. push(slides.slice(-count).reverse(), slides.slice(0, count)).forEach((content, index) => {
  2829. const attrs = assign({}, content.attrs, { class: `${content.attrs.class} ${classes.clone}` });
  2830. const clone = assign({}, content, { attrs });
  2831. index < count ? contents.unshift(clone) : contents.push(clone);
  2832. });
  2833. }
  2834. getCloneCount() {
  2835. if (this.isLoop()) {
  2836. const { options } = this;
  2837. if (options.clones) {
  2838. return options.clones;
  2839. }
  2840. const perPage = max(...this.breakpoints.map(([, options2]) => options2.perPage));
  2841. return perPage * ((options.flickMaxPages || 1) + 1);
  2842. }
  2843. return 0;
  2844. }
  2845. renderArrows() {
  2846. let html = "";
  2847. html += `<div class="${this.options.classes.arrows}">`;
  2848. html += this.renderArrow(true);
  2849. html += this.renderArrow(false);
  2850. html += `</div>`;
  2851. return html;
  2852. }
  2853. renderArrow(prev) {
  2854. const { classes, i18n } = this.options;
  2855. const attrs = {
  2856. class: `${classes.arrow} ${prev ? classes.prev : classes.next}`,
  2857. type: "button",
  2858. ariaLabel: prev ? i18n.prev : i18n.next
  2859. };
  2860. return `<button ${this.buildAttrs(attrs)}><svg xmlns="${XML_NAME_SPACE}" viewBox="0 0 ${SIZE} ${SIZE}" width="${SIZE}" height="${SIZE}"><path d="${this.options.arrowPath || PATH}" /></svg></button>`;
  2861. }
  2862. html() {
  2863. const { rootClass, listTag, arrows, beforeTrack, afterTrack, slider, beforeSlider, afterSlider } = this.config;
  2864. let html = "";
  2865. html += `<div id="${this.id}" class="${this.buildClasses()} ${rootClass || ""}">`;
  2866. html += `<style>${this.Style.build()}</style>`;
  2867. if (slider) {
  2868. html += beforeSlider || "";
  2869. html += `<div class="splide__slider">`;
  2870. }
  2871. html += beforeTrack || "";
  2872. if (arrows) {
  2873. html += this.renderArrows();
  2874. }
  2875. html += `<div class="splide__track">`;
  2876. html += `<${listTag} class="splide__list">`;
  2877. html += this.renderSlides();
  2878. html += `</${listTag}>`;
  2879. html += `</div>`;
  2880. html += afterTrack || "";
  2881. if (slider) {
  2882. html += `</div>`;
  2883. html += afterSlider || "";
  2884. }
  2885. html += `</div>`;
  2886. return html;
  2887. }
  2888. }
  2889. exports.CLASSES = CLASSES;
  2890. exports.CLASS_ACTIVE = CLASS_ACTIVE;
  2891. exports.CLASS_ARROW = CLASS_ARROW;
  2892. exports.CLASS_ARROWS = CLASS_ARROWS;
  2893. exports.CLASS_ARROW_NEXT = CLASS_ARROW_NEXT;
  2894. exports.CLASS_ARROW_PREV = CLASS_ARROW_PREV;
  2895. exports.CLASS_CLONE = CLASS_CLONE;
  2896. exports.CLASS_CONTAINER = CLASS_CONTAINER;
  2897. exports.CLASS_FOCUS_IN = CLASS_FOCUS_IN;
  2898. exports.CLASS_INITIALIZED = CLASS_INITIALIZED;
  2899. exports.CLASS_LIST = CLASS_LIST;
  2900. exports.CLASS_LOADING = CLASS_LOADING;
  2901. exports.CLASS_NEXT = CLASS_NEXT;
  2902. exports.CLASS_OVERFLOW = CLASS_OVERFLOW;
  2903. exports.CLASS_PAGINATION = CLASS_PAGINATION;
  2904. exports.CLASS_PAGINATION_PAGE = CLASS_PAGINATION_PAGE;
  2905. exports.CLASS_PREV = CLASS_PREV;
  2906. exports.CLASS_PROGRESS = CLASS_PROGRESS;
  2907. exports.CLASS_PROGRESS_BAR = CLASS_PROGRESS_BAR;
  2908. exports.CLASS_ROOT = CLASS_ROOT;
  2909. exports.CLASS_SLIDE = CLASS_SLIDE;
  2910. exports.CLASS_SPINNER = CLASS_SPINNER;
  2911. exports.CLASS_SR = CLASS_SR;
  2912. exports.CLASS_TOGGLE = CLASS_TOGGLE;
  2913. exports.CLASS_TOGGLE_PAUSE = CLASS_TOGGLE_PAUSE;
  2914. exports.CLASS_TOGGLE_PLAY = CLASS_TOGGLE_PLAY;
  2915. exports.CLASS_TRACK = CLASS_TRACK;
  2916. exports.CLASS_VISIBLE = CLASS_VISIBLE;
  2917. exports.DEFAULTS = DEFAULTS;
  2918. exports.EVENT_ACTIVE = EVENT_ACTIVE;
  2919. exports.EVENT_ARROWS_MOUNTED = EVENT_ARROWS_MOUNTED;
  2920. exports.EVENT_ARROWS_UPDATED = EVENT_ARROWS_UPDATED;
  2921. exports.EVENT_AUTOPLAY_PAUSE = EVENT_AUTOPLAY_PAUSE;
  2922. exports.EVENT_AUTOPLAY_PLAY = EVENT_AUTOPLAY_PLAY;
  2923. exports.EVENT_AUTOPLAY_PLAYING = EVENT_AUTOPLAY_PLAYING;
  2924. exports.EVENT_CLICK = EVENT_CLICK;
  2925. exports.EVENT_DESTROY = EVENT_DESTROY;
  2926. exports.EVENT_DRAG = EVENT_DRAG;
  2927. exports.EVENT_DRAGGED = EVENT_DRAGGED;
  2928. exports.EVENT_DRAGGING = EVENT_DRAGGING;
  2929. exports.EVENT_END_INDEX_CHANGED = EVENT_END_INDEX_CHANGED;
  2930. exports.EVENT_HIDDEN = EVENT_HIDDEN;
  2931. exports.EVENT_INACTIVE = EVENT_INACTIVE;
  2932. exports.EVENT_LAZYLOAD_LOADED = EVENT_LAZYLOAD_LOADED;
  2933. exports.EVENT_MOUNTED = EVENT_MOUNTED;
  2934. exports.EVENT_MOVE = EVENT_MOVE;
  2935. exports.EVENT_MOVED = EVENT_MOVED;
  2936. exports.EVENT_NAVIGATION_MOUNTED = EVENT_NAVIGATION_MOUNTED;
  2937. exports.EVENT_OVERFLOW = EVENT_OVERFLOW;
  2938. exports.EVENT_PAGINATION_MOUNTED = EVENT_PAGINATION_MOUNTED;
  2939. exports.EVENT_PAGINATION_UPDATED = EVENT_PAGINATION_UPDATED;
  2940. exports.EVENT_READY = EVENT_READY;
  2941. exports.EVENT_REFRESH = EVENT_REFRESH;
  2942. exports.EVENT_RESIZE = EVENT_RESIZE;
  2943. exports.EVENT_RESIZED = EVENT_RESIZED;
  2944. exports.EVENT_SCROLL = EVENT_SCROLL;
  2945. exports.EVENT_SCROLLED = EVENT_SCROLLED;
  2946. exports.EVENT_SHIFTED = EVENT_SHIFTED;
  2947. exports.EVENT_SLIDE_KEYDOWN = EVENT_SLIDE_KEYDOWN;
  2948. exports.EVENT_UPDATED = EVENT_UPDATED;
  2949. exports.EVENT_VISIBLE = EVENT_VISIBLE;
  2950. exports.EventBinder = EventBinder;
  2951. exports.EventInterface = EventInterface;
  2952. exports.FADE = FADE;
  2953. exports.LOOP = LOOP;
  2954. exports.LTR = LTR;
  2955. exports.RTL = RTL;
  2956. exports.RequestInterval = RequestInterval;
  2957. exports.SLIDE = SLIDE;
  2958. exports.STATUS_CLASSES = STATUS_CLASSES;
  2959. exports.Splide = Splide;
  2960. exports.SplideRenderer = SplideRenderer;
  2961. exports.State = State;
  2962. exports.TTB = TTB;
  2963. exports.Throttle = Throttle;
  2964. exports["default"] = Splide;