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