bootstrap.js 153 KB
Newer Older
XhmikosR's avatar
XhmikosR committed
1001
1002
1003
1004
  if ($$1) {
    var JQUERY_NO_CONFLICT = $$1.fn[NAME];
    $$1.fn[NAME] = Alert.jQueryInterface;
    $$1.fn[NAME].Constructor = Alert;
Jacob Thornton's avatar
Jacob Thornton committed
1005

XhmikosR's avatar
XhmikosR committed
1006
1007
1008
    $$1.fn[NAME].noConflict = function () {
      $$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Alert.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1009
1010
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
1011

XhmikosR's avatar
Dist    
XhmikosR committed
1012
1013
1014
1015
1016
1017
1018
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$1 = 'button';
XhmikosR's avatar
XhmikosR committed
1019
  var VERSION$1 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
  var DATA_KEY$1 = 'bs.button';
  var EVENT_KEY$1 = "." + DATA_KEY$1;
  var DATA_API_KEY$1 = '.data-api';
  var ClassName$1 = {
    ACTIVE: 'active',
    BUTTON: 'btn',
    FOCUS: 'focus'
  };
  var Selector$1 = {
    DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
    DATA_TOGGLE: '[data-toggle="buttons"]',
Mark Otto's avatar
dist    
Mark Otto committed
1031
    INPUT: 'input:not([type="hidden"])',
XhmikosR's avatar
Dist    
XhmikosR committed
1032
1033
1034
    ACTIVE: '.active',
    BUTTON: '.btn'
  };
XhmikosR's avatar
XhmikosR committed
1035
  var Event$2 = {
XhmikosR's avatar
Dist    
XhmikosR committed
1036
    CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
XhmikosR's avatar
XhmikosR committed
1037
1038
    FOCUS_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1,
    BLUR_DATA_API: "blur" + EVENT_KEY$1 + DATA_API_KEY$1
Mark Otto's avatar
dist    
Mark Otto committed
1039
1040
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1041
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
1042
1043
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
1044

XhmikosR's avatar
Dist    
XhmikosR committed
1045
  };
Jacob Thornton's avatar
Jacob Thornton committed
1046

XhmikosR's avatar
Dist    
XhmikosR committed
1047
1048
1049
1050
1051
  var Button =
  /*#__PURE__*/
  function () {
    function Button(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
1052
      Data.setData(element, DATA_KEY$1, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1053
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
1054
1055


XhmikosR's avatar
Dist    
XhmikosR committed
1056
    var _proto = Button.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
1057

XhmikosR's avatar
Dist    
XhmikosR committed
1058
1059
1060
1061
    // Public
    _proto.toggle = function toggle() {
      var triggerChangeEvent = true;
      var addAriaPressed = true;
XhmikosR's avatar
XhmikosR committed
1062
      var rootElement = SelectorEngine.closest(this._element, Selector$1.DATA_TOGGLE);
XhmikosR's avatar
Dist    
XhmikosR committed
1063
1064

      if (rootElement) {
XhmikosR's avatar
XhmikosR committed
1065
        var input = SelectorEngine.findOne(Selector$1.INPUT, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1066

XhmikosR's avatar
XhmikosR committed
1067
1068
1069
1070
1071
        if (input && input.type === 'radio') {
          if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
            triggerChangeEvent = false;
          } else {
            var activeElement = SelectorEngine.findOne(Selector$1.ACTIVE, rootElement);
Jacob Thornton's avatar
Jacob Thornton committed
1072

XhmikosR's avatar
XhmikosR committed
1073
1074
            if (activeElement) {
              activeElement.classList.remove(ClassName$1.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1075
1076
            }
          }
Mark Otto's avatar
dist    
Mark Otto committed
1077

XhmikosR's avatar
Dist    
XhmikosR committed
1078
1079
1080
          if (triggerChangeEvent) {
            if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
              return;
Johann-S's avatar
build    
Johann-S committed
1081
            }
Mark Otto's avatar
dist    
Mark Otto committed
1082

XhmikosR's avatar
Dist    
XhmikosR committed
1083
            input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
XhmikosR's avatar
XhmikosR committed
1084
            EventHandler.trigger(input, 'change');
Jacob Thornton's avatar
Jacob Thornton committed
1085
1086
          }

XhmikosR's avatar
Dist    
XhmikosR committed
1087
1088
          input.focus();
          addAriaPressed = false;
Jacob Thornton's avatar
Jacob Thornton committed
1089
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1090
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1091

XhmikosR's avatar
Dist    
XhmikosR committed
1092
1093
1094
      if (addAriaPressed) {
        this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1095

XhmikosR's avatar
Dist    
XhmikosR committed
1096
      if (triggerChangeEvent) {
XhmikosR's avatar
XhmikosR committed
1097
        this._element.classList.toggle(ClassName$1.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1098
1099
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1100

XhmikosR's avatar
Dist    
XhmikosR committed
1101
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1102
      Data.removeData(this._element, DATA_KEY$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1103
      this._element = null;
Mark Otto's avatar
Mark Otto committed
1104
1105
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
1106

XhmikosR's avatar
XhmikosR committed
1107
    Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
1108
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1109
        var data = Data.getData(this, DATA_KEY$1);
Jacob Thornton's avatar
Jacob Thornton committed
1110

XhmikosR's avatar
Dist    
XhmikosR committed
1111
1112
1113
        if (!data) {
          data = new Button(this);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1114

XhmikosR's avatar
Dist    
XhmikosR committed
1115
1116
        if (config === 'toggle') {
          data[config]();
Mark Otto's avatar
grunt    
Mark Otto committed
1117
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1118
1119
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1120

XhmikosR's avatar
XhmikosR committed
1121
    Button.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1122
1123
1124
      return Data.getData(element, DATA_KEY$1);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1125
1126
1127
1128
1129
1130
    _createClass(Button, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$1;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
1131

XhmikosR's avatar
Dist    
XhmikosR committed
1132
1133
1134
1135
1136
1137
1138
    return Button;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
1139
1140


XhmikosR's avatar
XhmikosR committed
1141
  EventHandler.on(document, Event$2.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1142
1143
    event.preventDefault();
    var button = event.target;
Jacob Thornton's avatar
Jacob Thornton committed
1144

XhmikosR's avatar
XhmikosR committed
1145
1146
    if (!button.classList.contains(ClassName$1.BUTTON)) {
      button = SelectorEngine.closest(button, Selector$1.BUTTON);
XhmikosR's avatar
Dist    
XhmikosR committed
1147
    }
Mark Otto's avatar
dist    
Mark Otto committed
1148

XhmikosR's avatar
XhmikosR committed
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
    var data = Data.getData(button, DATA_KEY$1);

    if (!data) {
      data = new Button(button);
    }

    data.toggle();
  });
  EventHandler.on(document, Event$2.FOCUS_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
    var button = SelectorEngine.closest(event.target, Selector$1.BUTTON);
XhmikosR's avatar
XhmikosR committed
1159
1160
1161
1162

    if (button) {
      button.classList.add(ClassName$1.FOCUS);
    }
XhmikosR's avatar
XhmikosR committed
1163
1164
1165
  });
  EventHandler.on(document, Event$2.BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
    var button = SelectorEngine.closest(event.target, Selector$1.BUTTON);
XhmikosR's avatar
XhmikosR committed
1166
1167
1168
1169

    if (button) {
      button.classList.remove(ClassName$1.FOCUS);
    }
XhmikosR's avatar
Dist    
XhmikosR committed
1170
  });
XhmikosR's avatar
XhmikosR committed
1171
  var $$2 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
1172
1173
1174
1175
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1176
1177
1178
   * add .button to jQuery only if jQuery is present
   */

1179
1180
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1181
1182
1183
1184
  if ($$2) {
    var JQUERY_NO_CONFLICT$1 = $$2.fn[NAME$1];
    $$2.fn[NAME$1] = Button.jQueryInterface;
    $$2.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
XhmikosR committed
1185

XhmikosR's avatar
XhmikosR committed
1186
1187
1188
    $$2.fn[NAME$1].noConflict = function () {
      $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
      return Button.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1189
1190
1191
1192
1193
1194
1195
1196
    };
  }

  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.3.1): dom/manipulator.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1197
   */
XhmikosR's avatar
XhmikosR committed
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
  function normalizeData(val) {
    if (val === 'true') {
      return true;
    }

    if (val === 'false') {
      return false;
    }

    if (val === Number(val).toString()) {
      return Number(val);
    }

    if (val === '' || val === 'null') {
      return null;
    }

    return val;
  }
Jacob Thornton's avatar
Jacob Thornton committed
1217

XhmikosR's avatar
XhmikosR committed
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
  function normalizeDataKey(key) {
    return key.replace(/[A-Z]/g, function (chr) {
      return chr.toLowerCase();
    });
  }

  var Manipulator = {
    setDataAttribute: function setDataAttribute(element, key, value) {
      element.setAttribute("data-" + normalizeDataKey(key), value);
    },
    removeDataAttribute: function removeDataAttribute(element, key) {
      element.removeAttribute("data-" + normalizeDataKey(key));
    },
    getDataAttributes: function getDataAttributes(element) {
      if (!element) {
        return {};
      }

1236
      var attributes = _objectSpread2({}, element.dataset);
XhmikosR's avatar
XhmikosR committed
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262

      Object.keys(attributes).forEach(function (key) {
        attributes[key] = normalizeData(attributes[key]);
      });
      return attributes;
    },
    getDataAttribute: function getDataAttribute(element, key) {
      return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
    },
    offset: function offset(element) {
      var rect = element.getBoundingClientRect();
      return {
        top: rect.top + document.body.scrollTop,
        left: rect.left + document.body.scrollLeft
      };
    },
    position: function position(element) {
      return {
        top: element.offsetTop,
        left: element.offsetLeft
      };
    },
    toggleClass: function toggleClass(element, className) {
      if (!element) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1263

XhmikosR's avatar
XhmikosR committed
1264
1265
1266
1267
1268
1269
      if (element.classList.contains(className)) {
        element.classList.remove(className);
      } else {
        element.classList.add(className);
      }
    }
XhmikosR's avatar
Dist    
XhmikosR committed
1270
  };
Jacob Thornton's avatar
Jacob Thornton committed
1271
1272

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
1273
1274
1275
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
1276
   */
Mark Otto's avatar
dist    
Mark Otto committed
1277

XhmikosR's avatar
Dist    
XhmikosR committed
1278
  var NAME$2 = 'carousel';
XhmikosR's avatar
XhmikosR committed
1279
  var VERSION$2 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
  var DATA_KEY$2 = 'bs.carousel';
  var EVENT_KEY$2 = "." + DATA_KEY$2;
  var DATA_API_KEY$2 = '.data-api';
  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key

  var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key

  var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch

  var SWIPE_THRESHOLD = 40;
  var Default = {
    interval: 5000,
    keyboard: true,
    slide: false,
    pause: 'hover',
    wrap: true,
    touch: true
  };
  var DefaultType = {
    interval: '(number|boolean)',
    keyboard: 'boolean',
    slide: '(boolean|string)',
    pause: '(string|boolean)',
    wrap: 'boolean',
    touch: 'boolean'
  };
  var Direction = {
    NEXT: 'next',
    PREV: 'prev',
    LEFT: 'left',
    RIGHT: 'right'
  };
XhmikosR's avatar
XhmikosR committed
1312
  var Event$3 = {
XhmikosR's avatar
Dist    
XhmikosR committed
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
    SLIDE: "slide" + EVENT_KEY$2,
    SLID: "slid" + EVENT_KEY$2,
    KEYDOWN: "keydown" + EVENT_KEY$2,
    MOUSEENTER: "mouseenter" + EVENT_KEY$2,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
    TOUCHSTART: "touchstart" + EVENT_KEY$2,
    TOUCHMOVE: "touchmove" + EVENT_KEY$2,
    TOUCHEND: "touchend" + EVENT_KEY$2,
    POINTERDOWN: "pointerdown" + EVENT_KEY$2,
    POINTERUP: "pointerup" + EVENT_KEY$2,
    DRAG_START: "dragstart" + EVENT_KEY$2,
    LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
    CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  };
  var ClassName$2 = {
    CAROUSEL: 'carousel',
    ACTIVE: 'active',
    SLIDE: 'slide',
    RIGHT: 'carousel-item-right',
    LEFT: 'carousel-item-left',
    NEXT: 'carousel-item-next',
    PREV: 'carousel-item-prev',
    ITEM: 'carousel-item',
    POINTER_EVENT: 'pointer-event'
  };
  var Selector$2 = {
    ACTIVE: '.active',
    ACTIVE_ITEM: '.active.carousel-item',
    ITEM: '.carousel-item',
    ITEM_IMG: '.carousel-item img',
    NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
    INDICATORS: '.carousel-indicators',
    DATA_SLIDE: '[data-slide], [data-slide-to]',
    DATA_RIDE: '[data-ride="carousel"]'
  };
  var PointerType = {
    TOUCH: 'touch',
    PEN: 'pen'
Mark Otto's avatar
dist    
Mark Otto committed
1351
1352
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1353
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
1354
1355
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
1356

XhmikosR's avatar
Dist    
XhmikosR committed
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
  };

  var Carousel =
  /*#__PURE__*/
  function () {
    function Carousel(element, config) {
      this._items = null;
      this._interval = null;
      this._activeElement = null;
      this._isPaused = false;
      this._isSliding = false;
      this.touchTimeout = null;
      this.touchStartX = 0;
      this.touchDeltaX = 0;
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
1373
      this._indicatorsElement = SelectorEngine.findOne(Selector$2.INDICATORS, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1374
1375
1376
1377
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
      this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);

      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
1378
1379

      Data.setData(element, DATA_KEY$2, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
    } // Getters


    var _proto = Carousel.prototype;

    // Public
    _proto.next = function next() {
      if (!this._isSliding) {
        this._slide(Direction.NEXT);
      }
Mark Otto's avatar
dist    
Mark Otto committed
1390
    };
Jacob Thornton's avatar
Jacob Thornton committed
1391

XhmikosR's avatar
Dist    
XhmikosR committed
1392
1393
1394
    _proto.nextWhenVisible = function nextWhenVisible() {
      // Don't call next when the page isn't visible
      // or the carousel or its parent isn't visible
XhmikosR's avatar
XhmikosR committed
1395
      if (!document.hidden && isVisible(this._element)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1396
1397
        this.next();
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1398
1399
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1400
1401
1402
1403
1404
    _proto.prev = function prev() {
      if (!this._isSliding) {
        this._slide(Direction.PREV);
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1405

XhmikosR's avatar
Dist    
XhmikosR committed
1406
1407
1408
1409
    _proto.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1410

XhmikosR's avatar
XhmikosR committed
1411
1412
      if (SelectorEngine.findOne(Selector$2.NEXT_PREV, this._element)) {
        triggerTransitionEnd(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1413
1414
        this.cycle(true);
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1415

XhmikosR's avatar
Dist    
XhmikosR committed
1416
1417
1418
      clearInterval(this._interval);
      this._interval = null;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1419

XhmikosR's avatar
Dist    
XhmikosR committed
1420
1421
1422
1423
    _proto.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1424

XhmikosR's avatar
Dist    
XhmikosR committed
1425
      if (this._interval) {
Mark Otto's avatar
dist    
Mark Otto committed
1426
1427
        clearInterval(this._interval);
        this._interval = null;
XhmikosR's avatar
Dist    
XhmikosR committed
1428
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1429

XhmikosR's avatar
XhmikosR committed
1430
      if (this._config && this._config.interval && !this._isPaused) {
XhmikosR's avatar
Dist    
XhmikosR committed
1431
1432
1433
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1434

XhmikosR's avatar
Dist    
XhmikosR committed
1435
1436
    _proto.to = function to(index) {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
1437

XhmikosR's avatar
XhmikosR committed
1438
      this._activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element);
Jacob Thornton's avatar
Jacob Thornton committed
1439

XhmikosR's avatar
Dist    
XhmikosR committed
1440
      var activeIndex = this._getItemIndex(this._activeElement);
Jacob Thornton's avatar
Jacob Thornton committed
1441

XhmikosR's avatar
Dist    
XhmikosR committed
1442
1443
1444
      if (index > this._items.length - 1 || index < 0) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1445

XhmikosR's avatar
Dist    
XhmikosR committed
1446
      if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1447
        EventHandler.one(this._element, Event$3.SLID, function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1448
1449
1450
1451
          return _this.to(index);
        });
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1452

XhmikosR's avatar
Dist    
XhmikosR committed
1453
1454
1455
1456
1457
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1458

XhmikosR's avatar
Dist    
XhmikosR committed
1459
      var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
Mark Otto's avatar
dist    
Mark Otto committed
1460

XhmikosR's avatar
Dist    
XhmikosR committed
1461
1462
      this._slide(direction, this._items[index]);
    };
Mark Otto's avatar
dist    
Mark Otto committed
1463

XhmikosR's avatar
Dist    
XhmikosR committed
1464
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1465
1466
      EventHandler.off(this._element, EVENT_KEY$2);
      Data.removeData(this._element, DATA_KEY$2);
XhmikosR's avatar
Dist    
XhmikosR committed
1467
1468
1469
1470
1471
1472
1473
1474
      this._items = null;
      this._config = null;
      this._element = null;
      this._interval = null;
      this._isPaused = null;
      this._isSliding = null;
      this._activeElement = null;
      this._indicatorsElement = null;
Mark Otto's avatar
Mark Otto committed
1475
1476
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
1477
1478

    _proto._getConfig = function _getConfig(config) {
1479
      config = _objectSpread2({}, Default, {}, config);
XhmikosR's avatar
XhmikosR committed
1480
      typeCheckConfig(NAME$2, config, DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
1481
1482
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
1483

XhmikosR's avatar
Dist    
XhmikosR committed
1484
1485
    _proto._handleSwipe = function _handleSwipe() {
      var absDeltax = Math.abs(this.touchDeltaX);
Mark Otto's avatar
dist    
Mark Otto committed
1486

XhmikosR's avatar
Dist    
XhmikosR committed
1487
1488
1489
      if (absDeltax <= SWIPE_THRESHOLD) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1490

XhmikosR's avatar
XhmikosR committed
1491
1492
      var direction = absDeltax / this.touchDeltaX;
      this.touchDeltaX = 0; // swipe left
Jacob Thornton's avatar
Jacob Thornton committed
1493

XhmikosR's avatar
Dist    
XhmikosR committed
1494
1495
1496
      if (direction > 0) {
        this.prev();
      } // swipe right
Mark Otto's avatar
dist    
Mark Otto committed
1497
1498


XhmikosR's avatar
Dist    
XhmikosR committed
1499
1500
1501
1502
      if (direction < 0) {
        this.next();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1503

XhmikosR's avatar
Dist    
XhmikosR committed
1504
1505
    _proto._addEventListeners = function _addEventListeners() {
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1506

XhmikosR's avatar
Dist    
XhmikosR committed
1507
      if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1508
        EventHandler.on(this._element, Event$3.KEYDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1509
1510
1511
          return _this2._keydown(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
1512

XhmikosR's avatar
Dist    
XhmikosR committed
1513
      if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1514
        EventHandler.on(this._element, Event$3.MOUSEENTER, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1515
          return _this2.pause(event);
XhmikosR's avatar
XhmikosR committed
1516
1517
        });
        EventHandler.on(this._element, Event$3.MOUSELEAVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1518
1519
1520
          return _this2.cycle(event);
        });
      }
Jacob Thornton's avatar
Jacob Thornton committed
1521

1522
      if (this._config.touch && this._touchSupported) {
Mark Otto's avatar
Mark Otto committed
1523
1524
        this._addTouchEventListeners();
      }
XhmikosR's avatar
Dist    
XhmikosR committed
1525
    };
Jacob Thornton's avatar
Jacob Thornton committed
1526

XhmikosR's avatar
Dist    
XhmikosR committed
1527
1528
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1529

XhmikosR's avatar
Dist    
XhmikosR committed
1530
      var start = function start(event) {
XhmikosR's avatar
XhmikosR committed
1531
1532
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchStartX = event.clientX;
XhmikosR's avatar
Dist    
XhmikosR committed
1533
        } else if (!_this3._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1534
          _this3.touchStartX = event.touches[0].clientX;
Mark Otto's avatar
dist    
Mark Otto committed
1535
1536
        }
      };
Jacob Thornton's avatar
Jacob Thornton committed
1537

XhmikosR's avatar
Dist    
XhmikosR committed
1538
1539
      var move = function move(event) {
        // ensure swiping with one touch and not pinching
XhmikosR's avatar
XhmikosR committed
1540
        if (event.touches && event.touches.length > 1) {
XhmikosR's avatar
Dist    
XhmikosR committed
1541
1542
          _this3.touchDeltaX = 0;
        } else {
XhmikosR's avatar
XhmikosR committed
1543
          _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1544
        }
Mark Otto's avatar
dist    
Mark Otto committed
1545
      };
Jacob Thornton's avatar
Jacob Thornton committed
1546

XhmikosR's avatar
Dist    
XhmikosR committed
1547
      var end = function end(event) {
XhmikosR's avatar
XhmikosR committed
1548
1549
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1550
        }
Jacob Thornton's avatar
Jacob Thornton committed
1551

XhmikosR's avatar
Dist    
XhmikosR committed
1552
        _this3._handleSwipe();
Mark Otto's avatar
dist    
Mark Otto committed
1553

XhmikosR's avatar
Dist    
XhmikosR committed
1554
1555
1556
1557
1558
1559
1560
1561
1562
        if (_this3._config.pause === 'hover') {
          // If it's a touch-enabled device, mouseenter/leave are fired as
          // part of the mouse compatibility events on first tap - the carousel
          // would stop cycling until user tapped out of it;
          // here, we listen for touchend, explicitly pause the carousel
          // (as if it's the second time we tap on it, mouseenter compat event
          // is NOT fired) and after a timeout (to allow for mouse compatibility
          // events to fire) we explicitly restart cycling
          _this3.pause();
Mark Otto's avatar
dist    
Mark Otto committed
1563

XhmikosR's avatar
Dist    
XhmikosR committed
1564
1565
1566
          if (_this3.touchTimeout) {
            clearTimeout(_this3.touchTimeout);
          }
Jacob Thornton's avatar
Jacob Thornton committed
1567

XhmikosR's avatar
Dist    
XhmikosR committed
1568
1569
1570
1571
          _this3.touchTimeout = setTimeout(function (event) {
            return _this3.cycle(event);
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
        }
Mark Otto's avatar
dist    
Mark Otto committed
1572
      };
Jacob Thornton's avatar
Jacob Thornton committed
1573

XhmikosR's avatar
XhmikosR committed
1574
1575
1576
1577
      makeArray(SelectorEngine.find(Selector$2.ITEM_IMG, this._element)).forEach(function (itemImg) {
        EventHandler.on(itemImg, Event$3.DRAG_START, function (e) {
          return e.preventDefault();
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1578
      });
Jacob Thornton's avatar
Jacob Thornton committed
1579

XhmikosR's avatar
Dist    
XhmikosR committed
1580
      if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1581
        EventHandler.on(this._element, Event$3.POINTERDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1582
1583
          return start(event);
        });
XhmikosR's avatar
XhmikosR committed
1584
        EventHandler.on(this._element, Event$3.POINTERUP, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1585
1586
          return end(event);
        });
Jacob Thornton's avatar
Jacob Thornton committed
1587

XhmikosR's avatar
Dist    
XhmikosR committed
1588
1589
        this._element.classList.add(ClassName$2.POINTER_EVENT);
      } else {
XhmikosR's avatar
XhmikosR committed
1590
        EventHandler.on(this._element, Event$3.TOUCHSTART, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1591
          return start(event);
Mark Otto's avatar
dist    
Mark Otto committed
1592
        });
XhmikosR's avatar
XhmikosR committed
1593
        EventHandler.on(this._element, Event$3.TOUCHMOVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1594
1595
          return move(event);
        });
XhmikosR's avatar
XhmikosR committed
1596
        EventHandler.on(this._element, Event$3.TOUCHEND, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1597
1598
1599
1600
          return end(event);
        });
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1601

XhmikosR's avatar
Dist    
XhmikosR committed
1602
1603
1604
1605
    _proto._keydown = function _keydown(event) {
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1606

XhmikosR's avatar
Dist    
XhmikosR committed
1607
1608
1609
1610
1611
      switch (event.which) {
        case ARROW_LEFT_KEYCODE:
          event.preventDefault();
          this.prev();
          break;
Mark Otto's avatar
dist    
Mark Otto committed
1612

XhmikosR's avatar
Dist    
XhmikosR committed
1613
1614
1615
1616
        case ARROW_RIGHT_KEYCODE:
          event.preventDefault();
          this.next();
          break;
Mark Otto's avatar
dist    
Mark Otto committed
1617

XhmikosR's avatar
Dist    
XhmikosR committed
1618
1619
1620
        default:
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1621

XhmikosR's avatar
Dist    
XhmikosR committed
1622
    _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
XhmikosR committed
1623
      this._items = element && element.parentNode ? makeArray(SelectorEngine.find(Selector$2.ITEM, element.parentNode)) : [];
XhmikosR's avatar
Dist    
XhmikosR committed
1624
1625
      return this._items.indexOf(element);
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1626

XhmikosR's avatar
Dist    
XhmikosR committed
1627
1628
1629
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
      var isNextDirection = direction === Direction.NEXT;
      var isPrevDirection = direction === Direction.PREV;
Mark Otto's avatar
grunt    
Mark Otto committed
1630

XhmikosR's avatar
Dist    
XhmikosR committed
1631
      var activeIndex = this._getItemIndex(activeElement);
Jacob Thornton's avatar
Jacob Thornton committed
1632

XhmikosR's avatar
Dist    
XhmikosR committed
1633
1634
      var lastItemIndex = this._items.length - 1;
      var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
Mark Otto's avatar
dist    
Mark Otto committed
1635

XhmikosR's avatar
Dist    
XhmikosR committed
1636
1637
1638
      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1639

XhmikosR's avatar
Dist    
XhmikosR committed
1640
1641
1642
1643
      var delta = direction === Direction.PREV ? -1 : 1;
      var itemIndex = (activeIndex + delta) % this._items.length;
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
    };
Jacob Thornton's avatar
Jacob Thornton committed
1644

XhmikosR's avatar
Dist    
XhmikosR committed
1645
1646
    _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
      var targetIndex = this._getItemIndex(relatedTarget);
Mark Otto's avatar
grunt    
Mark Otto committed
1647

XhmikosR's avatar
XhmikosR committed
1648
      var fromIndex = this._getItemIndex(SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element));
Jacob Thornton's avatar
Jacob Thornton committed
1649

XhmikosR's avatar
XhmikosR committed
1650
      return EventHandler.trigger(this._element, Event$3.SLIDE, {
XhmikosR's avatar
Dist    
XhmikosR committed
1651
1652
1653
1654
1655
1656
        relatedTarget: relatedTarget,
        direction: eventDirectionName,
        from: fromIndex,
        to: targetIndex
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1657

XhmikosR's avatar
Dist    
XhmikosR committed
1658
1659
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1660
1661
1662
1663
1664
        var indicators = SelectorEngine.find(Selector$2.ACTIVE, this._indicatorsElement);

        for (var i = 0; i < indicators.length; i++) {
          indicators[i].classList.remove(ClassName$2.ACTIVE);
        }
Jacob Thornton's avatar
Jacob Thornton committed
1665

XhmikosR's avatar
Dist    
XhmikosR committed
1666
        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
Jacob Thornton's avatar
Jacob Thornton committed
1667

XhmikosR's avatar
Dist    
XhmikosR committed
1668
        if (nextIndicator) {
XhmikosR's avatar
XhmikosR committed
1669
          nextIndicator.classList.add(ClassName$2.ACTIVE);
Mark Otto's avatar
dist    
Mark Otto committed
1670
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1671
1672
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1673

XhmikosR's avatar
Dist    
XhmikosR committed
1674
1675
    _proto._slide = function _slide(direction, element) {
      var _this4 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1676

XhmikosR's avatar
XhmikosR committed
1677
      var activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element);
Mark Otto's avatar
dist    
Mark Otto committed
1678

XhmikosR's avatar
Dist    
XhmikosR committed
1679
      var activeElementIndex = this._getItemIndex(activeElement);
Mark Otto's avatar
dist    
Mark Otto committed
1680

XhmikosR's avatar
Dist    
XhmikosR committed
1681
      var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
Mark Otto's avatar
dist    
Mark Otto committed
1682

XhmikosR's avatar
Dist    
XhmikosR committed
1683
      var nextElementIndex = this._getItemIndex(nextElement);
Jacob Thornton's avatar
Jacob Thornton committed
1684

XhmikosR's avatar
Dist    
XhmikosR committed
1685
1686
1687
1688
      var isCycling = Boolean(this._interval);
      var directionalClassName;
      var orderClassName;
      var eventDirectionName;
Jacob Thornton's avatar
Jacob Thornton committed
1689

XhmikosR's avatar
Dist    
XhmikosR committed
1690
1691
1692
1693
1694
1695
1696
1697
1698
      if (direction === Direction.NEXT) {
        directionalClassName = ClassName$2.LEFT;
        orderClassName = ClassName$2.NEXT;
        eventDirectionName = Direction.LEFT;
      } else {
        directionalClassName = ClassName$2.RIGHT;
        orderClassName = ClassName$2.PREV;
        eventDirectionName = Direction.RIGHT;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1699

XhmikosR's avatar
XhmikosR committed
1700
      if (nextElement && nextElement.classList.contains(ClassName$2.ACTIVE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1701
1702
1703
        this._isSliding = false;
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1704

XhmikosR's avatar
Dist    
XhmikosR committed
1705
      var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
Mark Otto's avatar
dist    
Mark Otto committed
1706

XhmikosR's avatar
XhmikosR committed
1707
      if (slideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1708
1709
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1710

XhmikosR's avatar
Dist    
XhmikosR committed
1711
1712
1713
1714
      if (!activeElement || !nextElement) {
        // Some weirdness is happening, so we bail
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1715

XhmikosR's avatar
Dist    
XhmikosR committed
1716
      this._isSliding = true;
Jacob Thornton's avatar
Jacob Thornton committed
1717

XhmikosR's avatar
Dist    
XhmikosR committed
1718
1719
1720
      if (isCycling) {
        this.pause();
      }
Mark Otto's avatar
dist    
Mark Otto committed
1721

XhmikosR's avatar
Dist    
XhmikosR committed
1722
      this._setActiveIndicatorElement(nextElement);
Mark Otto's avatar
dist    
Mark Otto committed
1723

XhmikosR's avatar
XhmikosR committed
1724
1725
1726
1727
1728
      if (this._element.classList.contains(ClassName$2.SLIDE)) {
        nextElement.classList.add(orderClassName);
        reflow(nextElement);
        activeElement.classList.add(directionalClassName);
        nextElement.classList.add(directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1729
1730
1731
1732
1733
1734
1735
        var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);

        if (nextElementInterval) {
          this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
          this._config.interval = nextElementInterval;
        } else {
          this._config.interval = this._config.defaultInterval || this._config.interval;
Jacob Thornton's avatar
Jacob Thornton committed
1736
1737
        }

XhmikosR's avatar
XhmikosR committed
1738
1739
1740
1741
1742
1743
1744
1745
        var transitionDuration = getTransitionDurationFromElement(activeElement);
        EventHandler.one(activeElement, TRANSITION_END, function () {
          nextElement.classList.remove(directionalClassName);
          nextElement.classList.remove(orderClassName);
          nextElement.classList.add(ClassName$2.ACTIVE);
          activeElement.classList.remove(ClassName$2.ACTIVE);
          activeElement.classList.remove(orderClassName);
          activeElement.classList.remove(directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1746
1747
          _this4._isSliding = false;
          setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
1748
1749
1750
1751
1752
1753
            EventHandler.trigger(_this4._element, Event$3.SLID, {
              relatedTarget: nextElement,
              direction: eventDirectionName,
              from: activeElementIndex,
              to: nextElementIndex
            });
XhmikosR's avatar
Dist    
XhmikosR committed
1754
          }, 0);
XhmikosR's avatar
XhmikosR committed
1755
1756
        });
        emulateTransitionEnd(activeElement, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1757
      } else {
XhmikosR's avatar
XhmikosR committed
1758
1759
        activeElement.classList.remove(ClassName$2.ACTIVE);
        nextElement.classList.add(ClassName$2.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1760
        this._isSliding = false;
XhmikosR's avatar
XhmikosR committed
1761
1762
1763
1764
1765
1766
        EventHandler.trigger(this._element, Event$3.SLID, {
          relatedTarget: nextElement,
          direction: eventDirectionName,
          from: activeElementIndex,
          to: nextElementIndex
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1767
1768
1769
1770
1771
      }

      if (isCycling) {
        this.cycle();
      }
Mark Otto's avatar
Mark Otto committed
1772
1773
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
1774

XhmikosR's avatar
XhmikosR committed
1775
    Carousel.carouselInterface = function carouselInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1776
      var data = Data.getData(element, DATA_KEY$2);
Jacob Thornton's avatar
Jacob Thornton committed
1777

1778
      var _config = _objectSpread2({}, Default, {}, Manipulator.getDataAttributes(element));
Jacob Thornton's avatar
Jacob Thornton committed
1779

XhmikosR's avatar
XhmikosR committed
1780
      if (typeof config === 'object') {
1781
        _config = _objectSpread2({}, _config, {}, config);
XhmikosR's avatar
XhmikosR committed
1782
      }
Jacob Thornton's avatar
Jacob Thornton committed
1783

XhmikosR's avatar
XhmikosR committed
1784
      var action = typeof config === 'string' ? config : _config.slide;
Jacob Thornton's avatar
Jacob Thornton committed
1785

XhmikosR's avatar
XhmikosR committed
1786
1787
1788
1789
1790
1791
1792
1793
      if (!data) {
        data = new Carousel(element, _config);
      }

      if (typeof config === 'number') {
        data.to(config);
      } else if (typeof action === 'string') {
        if (typeof data[action] === 'undefined') {
XhmikosR's avatar
Dist.    
XhmikosR committed
1794
          throw new TypeError("No method named \"" + action + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
1795
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1796

XhmikosR's avatar
XhmikosR committed
1797
1798
1799
1800
1801
1802
        data[action]();
      } else if (_config.interval && _config.ride) {
        data.pause();
        data.cycle();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1803

XhmikosR's avatar
XhmikosR committed
1804
    Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
1805
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1806
        Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1807
1808
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1809

XhmikosR's avatar
XhmikosR committed
1810
1811
    Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
      var target = getElementFromSelector(this);
Jacob Thornton's avatar
Jacob Thornton committed
1812

XhmikosR's avatar
XhmikosR committed
1813
      if (!target || !target.classList.contains(ClassName$2.CAROUSEL)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1814
1815
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1816

1817
      var config = _objectSpread2({}, Manipulator.getDataAttributes(target), {}, Manipulator.getDataAttributes(this));
Mark Otto's avatar
dist    
Mark Otto committed
1818

XhmikosR's avatar
Dist    
XhmikosR committed
1819
      var slideIndex = this.getAttribute('data-slide-to');
Mark Otto's avatar
dist    
Mark Otto committed
1820

XhmikosR's avatar
Dist    
XhmikosR committed
1821
1822
      if (slideIndex) {
        config.interval = false;
Mark Otto's avatar
dist    
Mark Otto committed
1823
      }
Mark Otto's avatar
dist    
Mark Otto committed
1824

XhmikosR's avatar
XhmikosR committed
1825
      Carousel.carouselInterface(target, config);
Jacob Thornton's avatar
Jacob Thornton committed
1826

XhmikosR's avatar
Dist    
XhmikosR committed
1827
      if (slideIndex) {
XhmikosR's avatar
XhmikosR committed
1828
        Data.getData(target, DATA_KEY$2).to(slideIndex);
XhmikosR's avatar
Dist    
XhmikosR committed
1829
1830
1831
      }

      event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
1832
    };
Jacob Thornton's avatar
Jacob Thornton committed
1833

XhmikosR's avatar
XhmikosR committed
1834
    Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1835
1836
1837
      return Data.getData(element, DATA_KEY$2);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
    _createClass(Carousel, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$2;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default;
      }
    }]);

Mark Otto's avatar
dist    
Mark Otto committed
1850
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1851
1852
1853
1854
1855
1856
1857
1858
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
1859
  EventHandler.on(document, Event$3.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel.dataApiClickHandler);
XhmikosR's avatar
XhmikosR committed
1860
1861
  EventHandler.on(window, Event$3.LOAD_DATA_API, function () {
    var carousels = makeArray(SelectorEngine.find(Selector$2.DATA_RIDE));
XhmikosR's avatar
Dist    
XhmikosR committed
1862
1863

    for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1864
      Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist    
XhmikosR committed
1865
1866
    }
  });
XhmikosR's avatar
XhmikosR committed
1867
  var $$3 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
1868
1869
1870
1871
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1872
   * add .carousel to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1873
1874
   */

1875
1876
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1877
1878
1879
1880
  if ($$3) {
    var JQUERY_NO_CONFLICT$2 = $$3.fn[NAME$2];
    $$3.fn[NAME$2] = Carousel.jQueryInterface;
    $$3.fn[NAME$2].Constructor = Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1881

XhmikosR's avatar
XhmikosR committed
1882
1883
1884
    $$3.fn[NAME$2].noConflict = function () {
      $$3.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
      return Carousel.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1885
1886
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
1887

XhmikosR's avatar
Dist    
XhmikosR committed
1888
1889
1890
1891
1892
1893
1894
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$3 = 'collapse';
XhmikosR's avatar
XhmikosR committed
1895
  var VERSION$3 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
  var DATA_KEY$3 = 'bs.collapse';
  var EVENT_KEY$3 = "." + DATA_KEY$3;
  var DATA_API_KEY$3 = '.data-api';
  var Default$1 = {
    toggle: true,
    parent: ''
  };
  var DefaultType$1 = {
    toggle: 'boolean',
    parent: '(string|element)'
  };
XhmikosR's avatar
XhmikosR committed
1907
  var Event$4 = {
XhmikosR's avatar
Dist    
XhmikosR committed
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
    SHOW: "show" + EVENT_KEY$3,
    SHOWN: "shown" + EVENT_KEY$3,
    HIDE: "hide" + EVENT_KEY$3,
    HIDDEN: "hidden" + EVENT_KEY$3,
    CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  };
  var ClassName$3 = {
    SHOW: 'show',
    COLLAPSE: 'collapse',
    COLLAPSING: 'collapsing',
    COLLAPSED: 'collapsed'
  };
  var Dimension = {
    WIDTH: 'width',
    HEIGHT: 'height'
  };
  var Selector$3 = {
    ACTIVES: '.show, .collapsing',
    DATA_TOGGLE: '[data-toggle="collapse"]'
Mark Otto's avatar
dist    
Mark Otto committed
1927
1928
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1929
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
1930
1931
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
1932

XhmikosR's avatar
Dist    
XhmikosR committed
1933
1934
1935
1936
1937
1938
1939
1940
1941
  };

  var Collapse =
  /*#__PURE__*/
  function () {
    function Collapse(element, config) {
      this._isTransitioning = false;
      this._element = element;
      this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1942
1943
      this._triggerArray = makeArray(SelectorEngine.find("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
      var toggleList = makeArray(SelectorEngine.find(Selector$3.DATA_TOGGLE));
XhmikosR's avatar
Dist    
XhmikosR committed
1944
1945
1946

      for (var i = 0, len = toggleList.length; i < len; i++) {
        var elem = toggleList[i];
XhmikosR's avatar
XhmikosR committed
1947
1948
        var selector = getSelectorFromElement(elem);
        var filterElement = makeArray(SelectorEngine.find(selector)).filter(function (foundElem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1949
1950
          return foundElem === element;
        });
Johann-S's avatar
build    
Johann-S committed
1951

XhmikosR's avatar
XhmikosR committed
1952
        if (selector !== null && filterElement.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
1953
          this._selector = selector;
Jacob Thornton's avatar
Jacob Thornton committed
1954

XhmikosR's avatar
Dist    
XhmikosR committed
1955
          this._triggerArray.push(elem);
Mark Otto's avatar
dist    
Mark Otto committed
1956
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1957
      }
Jacob Thornton's avatar
Jacob Thornton committed
1958

XhmikosR's avatar
Dist    
XhmikosR committed
1959
      this._parent = this._config.parent ? this._getParent() : null;
Jacob Thornton's avatar
Jacob Thornton committed
1960

XhmikosR's avatar
Dist    
XhmikosR committed
1961
1962
1963
      if (!this._config.parent) {
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1964

XhmikosR's avatar
Dist    
XhmikosR committed
1965
1966
1967
      if (this._config.toggle) {
        this.toggle();
      }
XhmikosR's avatar
XhmikosR committed
1968
1969

      Data.setData(element, DATA_KEY$3, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1970
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
1971
1972


XhmikosR's avatar
Dist    
XhmikosR committed
1973
    var _proto = Collapse.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
1974

XhmikosR's avatar
Dist    
XhmikosR committed
1975
1976
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
1977
      if (this._element.classList.contains(ClassName$3.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1978
1979
1980
1981
1982
        this.hide();
      } else {
        this.show();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1983

XhmikosR's avatar
Dist    
XhmikosR committed
1984
1985
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
1986

XhmikosR's avatar
XhmikosR committed
1987
      if (this._isTransitioning || this._element.classList.contains(ClassName$3.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1988
1989
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1990

XhmikosR's avatar
Dist    
XhmikosR committed
1991
1992
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1993

XhmikosR's avatar
Dist    
XhmikosR committed
1994
      if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1995
        actives = makeArray(SelectorEngine.find(Selector$3.ACTIVES, this._parent)).filter(function (elem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1996
1997
          if (typeof _this._config.parent === 'string') {
            return elem.getAttribute('data-parent') === _this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
1998
          }
Jacob Thornton's avatar
Jacob Thornton committed
1999

XhmikosR's avatar
Dist    
XhmikosR committed
2000
          return elem.classList.contains(ClassName$3.COLLAPSE);
For faster browsing, not all history is shown. View entire blame