bootstrap.esm.js 141 KB
Newer Older
XhmikosR's avatar
Dist.  
XhmikosR committed
1
/*!
XhmikosR's avatar
XhmikosR committed
2
  * Bootstrap v5.0.0-alpha2 (https://getbootstrap.com/)
XhmikosR's avatar
XhmikosR committed
3
  * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
XhmikosR's avatar
XhmikosR committed
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
5
6
7
  */
import Popper from 'popper.js';

XhmikosR's avatar
XhmikosR committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function _defineProperties(target, props) {
  for (var i = 0; i < props.length; i++) {
    var descriptor = props[i];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor) descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}

function _createClass(Constructor, protoProps, staticProps) {
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  if (staticProps) _defineProperties(Constructor, staticProps);
  return Constructor;
}

XhmikosR's avatar
XhmikosR committed
24
25
26
27
28
29
30
31
32
33
function _extends() {
  _extends = Object.assign || function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];

      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
XhmikosR's avatar
XhmikosR committed
34
35
    }

XhmikosR's avatar
XhmikosR committed
36
37
38
39
    return target;
  };

  return _extends.apply(this, arguments);
XhmikosR's avatar
XhmikosR committed
40
41
42
43
44
45
46
47
}

function _inheritsLoose(subClass, superClass) {
  subClass.prototype = Object.create(superClass.prototype);
  subClass.prototype.constructor = subClass;
  subClass.__proto__ = superClass;
}

XhmikosR's avatar
Dist.  
XhmikosR committed
48
49
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
50
 * Bootstrap (v5.0.0-alpha2): util/index.js
XhmikosR's avatar
XhmikosR committed
51
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
52
53
 * --------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
54
55
var MAX_UID = 1000000;
var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
56
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
57
58

var toType = function toType(obj) {
XhmikosR's avatar
XhmikosR committed
59
60
61
62
  if (obj === null || obj === undefined) {
    return "" + obj;
  }

XhmikosR's avatar
XhmikosR committed
63
64
  return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
};
XhmikosR's avatar
Dist.  
XhmikosR committed
65
66
67
68
69
70
71
/**
 * --------------------------------------------------------------------------
 * Public Util Api
 * --------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
72
var getUID = function getUID(prefix) {
XhmikosR's avatar
Dist.  
XhmikosR committed
73
  do {
Mark Otto's avatar
Mark Otto committed
74
    prefix += Math.floor(Math.random() * MAX_UID);
XhmikosR's avatar
Dist.  
XhmikosR committed
75
76
77
78
79
  } while (document.getElementById(prefix));

  return prefix;
};

XhmikosR's avatar
XhmikosR committed
80
var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
81
  var selector = element.getAttribute('data-target');
XhmikosR's avatar
Dist.  
XhmikosR committed
82
83

  if (!selector || selector === '#') {
XhmikosR's avatar
XhmikosR committed
84
    var hrefAttr = element.getAttribute('href');
XhmikosR's avatar
XhmikosR committed
85
    selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
86
87
  }

XhmikosR's avatar
XhmikosR committed
88
89
90
91
92
93
94
  return selector;
};

var getSelectorFromElement = function getSelectorFromElement(element) {
  var selector = getSelector(element);

  if (selector) {
XhmikosR's avatar
Dist.  
XhmikosR committed
95
96
    return document.querySelector(selector) ? selector : null;
  }
XhmikosR's avatar
XhmikosR committed
97
98
99
100
101
102
103

  return null;
};

var getElementFromSelector = function getElementFromSelector(element) {
  var selector = getSelector(element);
  return selector ? document.querySelector(selector) : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
104
105
};

XhmikosR's avatar
XhmikosR committed
106
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
107
108
109
110
111
  if (!element) {
    return 0;
  } // Get transition-duration of the element


XhmikosR's avatar
XhmikosR committed
112
  var _window$getComputedSt = window.getComputedStyle(element),
XhmikosR's avatar
Dist.  
XhmikosR committed
113
114
115
      transitionDuration = _window$getComputedSt.transitionDuration,
      transitionDelay = _window$getComputedSt.transitionDelay;

XhmikosR's avatar
XhmikosR committed
116
117
  var floatTransitionDuration = parseFloat(transitionDuration);
  var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
XhmikosR's avatar
Dist.  
XhmikosR committed
118
119
120
121
122
123
124
125
126
127
128

  if (!floatTransitionDuration && !floatTransitionDelay) {
    return 0;
  } // If multiple durations are defined, take the first


  transitionDuration = transitionDuration.split(',')[0];
  transitionDelay = transitionDelay.split(',')[0];
  return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
};

XhmikosR's avatar
XhmikosR committed
129
var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
130
  element.dispatchEvent(new Event(TRANSITION_END));
XhmikosR's avatar
Dist.  
XhmikosR committed
131
132
};

XhmikosR's avatar
XhmikosR committed
133
134
135
var isElement = function isElement(obj) {
  return (obj[0] || obj).nodeType;
};
XhmikosR's avatar
Dist.  
XhmikosR committed
136

XhmikosR's avatar
XhmikosR committed
137
138
139
140
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
  var called = false;
  var durationPadding = 5;
  var emulatedDuration = duration + durationPadding;
XhmikosR's avatar
Dist.  
XhmikosR committed
141
142
143
144
145
146
147

  function listener() {
    called = true;
    element.removeEventListener(TRANSITION_END, listener);
  }

  element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
XhmikosR committed
148
  setTimeout(function () {
XhmikosR's avatar
Dist.  
XhmikosR committed
149
150
151
152
153
154
    if (!called) {
      triggerTransitionEnd(element);
    }
  }, emulatedDuration);
};

XhmikosR's avatar
XhmikosR committed
155
156
157
158
159
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
  Object.keys(configTypes).forEach(function (property) {
    var expectedTypes = configTypes[property];
    var value = config[property];
    var valueType = value && isElement(value) ? 'element' : toType(value);
XhmikosR's avatar
Dist.  
XhmikosR committed
160
161

    if (!new RegExp(expectedTypes).test(valueType)) {
XhmikosR's avatar
XhmikosR committed
162
      throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
XhmikosR's avatar
Dist.  
XhmikosR committed
163
164
165
166
    }
  });
};

XhmikosR's avatar
XhmikosR committed
167
var isVisible = function isVisible(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
168
169
170
171
172
  if (!element) {
    return false;
  }

  if (element.style && element.parentNode && element.parentNode.style) {
XhmikosR's avatar
XhmikosR committed
173
174
175
    var elementStyle = getComputedStyle(element);
    var parentNodeStyle = getComputedStyle(element.parentNode);
    return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
Dist.  
XhmikosR committed
176
177
178
179
180
  }

  return false;
};

XhmikosR's avatar
XhmikosR committed
181
var findShadowRoot = function findShadowRoot(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
182
183
184
185
186
187
  if (!document.documentElement.attachShadow) {
    return null;
  } // Can find the shadow root otherwise it'll return the document


  if (typeof element.getRootNode === 'function') {
XhmikosR's avatar
XhmikosR committed
188
    var root = element.getRootNode();
XhmikosR's avatar
Dist.  
XhmikosR committed
189
190
191
192
193
194
195
196
197
198
199
200
201
    return root instanceof ShadowRoot ? root : null;
  }

  if (element instanceof ShadowRoot) {
    return element;
  } // when we don't find a shadow root


  if (!element.parentNode) {
    return null;
  }

  return findShadowRoot(element.parentNode);
XhmikosR's avatar
XhmikosR committed
202
};
XhmikosR's avatar
Dist.  
XhmikosR committed
203

XhmikosR's avatar
XhmikosR committed
204
205
206
var noop = function noop() {
  return function () {};
};
XhmikosR's avatar
Dist.  
XhmikosR committed
207

XhmikosR's avatar
XhmikosR committed
208
209
210
var reflow = function reflow(element) {
  return element.offsetHeight;
};
XhmikosR's avatar
Dist.  
XhmikosR committed
211

XhmikosR's avatar
XhmikosR committed
212
213
214
215
216
217
218
219
220
221
222
var getjQuery = function getjQuery() {
  var _window = window,
      jQuery = _window.jQuery;

  if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
    return jQuery;
  }

  return null;
};

XhmikosR's avatar
Dist.  
XhmikosR committed
223
224
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
225
 * Bootstrap (v5.0.0-alpha2): dom/data.js
XhmikosR's avatar
XhmikosR committed
226
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
227
228
229
230
231
232
233
234
 * --------------------------------------------------------------------------
 */

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
235
236
237
var mapData = function () {
  var storeData = {};
  var id = 1;
XhmikosR's avatar
Dist.  
XhmikosR committed
238
  return {
XhmikosR's avatar
XhmikosR committed
239
    set: function set(element, key, data) {
XhmikosR's avatar
XhmikosR committed
240
241
      if (typeof element.bsKey === 'undefined') {
        element.bsKey = {
XhmikosR's avatar
XhmikosR committed
242
243
          key: key,
          id: id
XhmikosR's avatar
Dist.  
XhmikosR committed
244
245
246
247
        };
        id++;
      }

XhmikosR's avatar
XhmikosR committed
248
      storeData[element.bsKey.id] = data;
XhmikosR's avatar
Dist.  
XhmikosR committed
249
    },
XhmikosR's avatar
XhmikosR committed
250
    get: function get(element, key) {
XhmikosR's avatar
XhmikosR committed
251
      if (!element || typeof element.bsKey === 'undefined') {
XhmikosR's avatar
Dist.  
XhmikosR committed
252
253
254
        return null;
      }

XhmikosR's avatar
XhmikosR committed
255
      var keyProperties = element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
256
257
258
259
260
261
262

      if (keyProperties.key === key) {
        return storeData[keyProperties.id];
      }

      return null;
    },
XhmikosR's avatar
XhmikosR committed
263
    delete: function _delete(element, key) {
XhmikosR's avatar
XhmikosR committed
264
      if (typeof element.bsKey === 'undefined') {
XhmikosR's avatar
Dist.  
XhmikosR committed
265
266
267
        return;
      }

XhmikosR's avatar
XhmikosR committed
268
      var keyProperties = element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
269
270
271

      if (keyProperties.key === key) {
        delete storeData[keyProperties.id];
XhmikosR's avatar
XhmikosR committed
272
        delete element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
273
274
275
      }
    }
  };
XhmikosR's avatar
XhmikosR committed
276
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
277

XhmikosR's avatar
XhmikosR committed
278
279
var Data = {
  setData: function setData(instance, key, data) {
XhmikosR's avatar
Dist.  
XhmikosR committed
280
281
    mapData.set(instance, key, data);
  },
XhmikosR's avatar
XhmikosR committed
282
  getData: function getData(instance, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
283
284
    return mapData.get(instance, key);
  },
XhmikosR's avatar
XhmikosR committed
285
  removeData: function removeData(instance, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
286
287
    mapData.delete(instance, key);
  }
XhmikosR's avatar
XhmikosR committed
288
};
XhmikosR's avatar
Dist.  
XhmikosR committed
289

XhmikosR's avatar
XhmikosR committed
290
291
/* istanbul ignore file */
var find = Element.prototype.querySelectorAll;
XhmikosR's avatar
XhmikosR committed
292
var findOne = Element.prototype.querySelector; // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
XhmikosR's avatar
Dist.  
XhmikosR committed
293

XhmikosR's avatar
XhmikosR committed
294
var defaultPreventedPreservedOnDispatch = function () {
XhmikosR's avatar
XhmikosR committed
295
  var e = new CustomEvent('Bootstrap', {
XhmikosR's avatar
XhmikosR committed
296
297
298
299
300
301
302
303
304
305
    cancelable: true
  });
  var element = document.createElement('div');
  element.addEventListener('Bootstrap', function () {
    return null;
  });
  e.preventDefault();
  element.dispatchEvent(e);
  return e.defaultPrevented;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
306

XhmikosR's avatar
XhmikosR committed
307
var scopeSelectorRegex = /:scope\b/;
XhmikosR's avatar
Dist.  
XhmikosR committed
308

XhmikosR's avatar
XhmikosR committed
309
310
var supportScopeQuery = function () {
  var element = document.createElement('div');
XhmikosR's avatar
Dist.  
XhmikosR committed
311

XhmikosR's avatar
XhmikosR committed
312
313
  try {
    element.querySelectorAll(':scope *');
XhmikosR's avatar
XhmikosR committed
314
  } catch (_) {
XhmikosR's avatar
XhmikosR committed
315
316
    return false;
  }
XhmikosR's avatar
Dist.  
XhmikosR committed
317

XhmikosR's avatar
XhmikosR committed
318
319
320
321
322
323
324
325
326
327
  return true;
}();

if (!supportScopeQuery) {
  find = function find(selector) {
    if (!scopeSelectorRegex.test(selector)) {
      return this.querySelectorAll(selector);
    }

    var hasId = Boolean(this.id);
XhmikosR's avatar
Dist.  
XhmikosR committed
328

XhmikosR's avatar
XhmikosR committed
329
330
331
332
333
    if (!hasId) {
      this.id = getUID('scope');
    }

    var nodeList = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
334

XhmikosR's avatar
XhmikosR committed
335
336
337
338
339
340
    try {
      selector = selector.replace(scopeSelectorRegex, "#" + this.id);
      nodeList = this.querySelectorAll(selector);
    } finally {
      if (!hasId) {
        this.removeAttribute('id');
XhmikosR's avatar
Dist.  
XhmikosR committed
341
      }
XhmikosR's avatar
XhmikosR committed
342
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
343

XhmikosR's avatar
XhmikosR committed
344
345
    return nodeList;
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
346

XhmikosR's avatar
XhmikosR committed
347
348
349
350
351
352
353
354
355
356
357
358
  findOne = function findOne(selector) {
    if (!scopeSelectorRegex.test(selector)) {
      return this.querySelector(selector);
    }

    var matches = find.call(this, selector);

    if (typeof matches[0] !== 'undefined') {
      return matches[0];
    }

    return null;
XhmikosR's avatar
Dist.  
XhmikosR committed
359
  };
XhmikosR's avatar
XhmikosR committed
360
}
XhmikosR's avatar
Dist.  
XhmikosR committed
361
362
363

/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
364
 * Bootstrap (v5.0.0-alpha2): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
365
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
366
367
368
369
370
371
372
373
 * --------------------------------------------------------------------------
 */
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
374
var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
375
376
377
378
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
var stripNameRegex = /\..*/;
var stripUidRegex = /::\d+$/;
var eventRegistry = {}; // Events storage
XhmikosR's avatar
Dist.  
XhmikosR committed
379

XhmikosR's avatar
XhmikosR committed
380
381
var uidEvent = 1;
var customEvents = {
XhmikosR's avatar
Dist.  
XhmikosR committed
382
383
384
  mouseenter: 'mouseover',
  mouseleave: 'mouseout'
};
XhmikosR's avatar
XhmikosR committed
385
var nativeEvents = ['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll'];
XhmikosR's avatar
Dist.  
XhmikosR committed
386
387
388
389
390
391
392
/**
 * ------------------------------------------------------------------------
 * Private methods
 * ------------------------------------------------------------------------
 */

function getUidEvent(element, uid) {
XhmikosR's avatar
XhmikosR committed
393
  return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++;
XhmikosR's avatar
Dist.  
XhmikosR committed
394
395
396
}

function getEvent(element) {
XhmikosR's avatar
XhmikosR committed
397
  var uid = getUidEvent(element);
XhmikosR's avatar
Dist.  
XhmikosR committed
398
399
400
401
402
403
404
  element.uidEvent = uid;
  eventRegistry[uid] = eventRegistry[uid] || {};
  return eventRegistry[uid];
}

function bootstrapHandler(element, fn) {
  return function handler(event) {
XhmikosR's avatar
XhmikosR committed
405
406
    event.delegateTarget = element;

XhmikosR's avatar
Dist.  
XhmikosR committed
407
408
409
410
411
412
413
414
415
416
    if (handler.oneOff) {
      EventHandler.off(element, event.type, fn);
    }

    return fn.apply(element, [event]);
  };
}

function bootstrapDelegationHandler(element, selector, fn) {
  return function handler(event) {
XhmikosR's avatar
XhmikosR committed
417
    var domElements = element.querySelectorAll(selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
418

XhmikosR's avatar
XhmikosR committed
419
420
    for (var target = event.target; target && target !== this; target = target.parentNode) {
      for (var i = domElements.length; i--;) {
XhmikosR's avatar
Dist.  
XhmikosR committed
421
        if (domElements[i] === target) {
XhmikosR's avatar
XhmikosR committed
422
423
          event.delegateTarget = target;

XhmikosR's avatar
Dist.  
XhmikosR committed
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
          if (handler.oneOff) {
            EventHandler.off(element, event.type, fn);
          }

          return fn.apply(target, [event]);
        }
      }
    } // To please ESLint


    return null;
  };
}

function findHandler(events, handler, delegationSelector) {
  if (delegationSelector === void 0) {
    delegationSelector = null;
  }

Mark Otto's avatar
dist v5    
Mark Otto committed
443
444
445
446
  var uidEventList = Object.keys(events);

  for (var i = 0, len = uidEventList.length; i < len; i++) {
    var event = events[uidEventList[i]];
XhmikosR's avatar
Dist.  
XhmikosR committed
447
448

    if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
449
      return event;
XhmikosR's avatar
Dist.  
XhmikosR committed
450
451
452
453
454
455
456
    }
  }

  return null;
}

function normalizeParams(originalTypeEvent, handler, delegationFn) {
XhmikosR's avatar
XhmikosR committed
457
458
  var delegation = typeof handler === 'string';
  var originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
XhmikosR's avatar
Dist.  
XhmikosR committed
459

XhmikosR's avatar
XhmikosR committed
460
461
  var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
  var custom = customEvents[typeEvent];
XhmikosR's avatar
Dist.  
XhmikosR committed
462
463
464
465
466

  if (custom) {
    typeEvent = custom;
  }

XhmikosR's avatar
XhmikosR committed
467
  var isNative = nativeEvents.indexOf(typeEvent) > -1;
XhmikosR's avatar
Dist.  
XhmikosR committed
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485

  if (!isNative) {
    typeEvent = originalTypeEvent;
  }

  return [delegation, originalHandler, typeEvent];
}

function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
  if (typeof originalTypeEvent !== 'string' || !element) {
    return;
  }

  if (!handler) {
    handler = delegationFn;
    delegationFn = null;
  }

XhmikosR's avatar
XhmikosR committed
486
487
488
489
  var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
      delegation = _normalizeParams[0],
      originalHandler = _normalizeParams[1],
      typeEvent = _normalizeParams[2];
XhmikosR's avatar
Dist.  
XhmikosR committed
490

XhmikosR's avatar
XhmikosR committed
491
492
493
  var events = getEvent(element);
  var handlers = events[typeEvent] || (events[typeEvent] = {});
  var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
XhmikosR's avatar
Dist.  
XhmikosR committed
494
495
496
497
498
499

  if (previousFn) {
    previousFn.oneOff = previousFn.oneOff && oneOff;
    return;
  }

XhmikosR's avatar
XhmikosR committed
500
501
  var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
  var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
Dist.  
XhmikosR committed
502
503
504
505
506
507
508
509
510
  fn.delegationSelector = delegation ? handler : null;
  fn.originalHandler = originalHandler;
  fn.oneOff = oneOff;
  fn.uidEvent = uid;
  handlers[uid] = fn;
  element.addEventListener(typeEvent, fn, delegation);
}

function removeHandler(element, events, typeEvent, handler, delegationSelector) {
XhmikosR's avatar
XhmikosR committed
511
  var fn = findHandler(events[typeEvent], handler, delegationSelector);
XhmikosR's avatar
Dist.  
XhmikosR committed
512

Mark Otto's avatar
dist v5    
Mark Otto committed
513
  if (!fn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
514
515
516
517
518
519
520
521
    return;
  }

  element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
  delete events[typeEvent][fn.uidEvent];
}

function removeNamespacedHandlers(element, events, typeEvent, namespace) {
XhmikosR's avatar
XhmikosR committed
522
523
  var storeElementEvent = events[typeEvent] || {};
  Object.keys(storeElementEvent).forEach(function (handlerKey) {
XhmikosR's avatar
Dist.  
XhmikosR committed
524
    if (handlerKey.indexOf(namespace) > -1) {
XhmikosR's avatar
XhmikosR committed
525
      var event = storeElementEvent[handlerKey];
XhmikosR's avatar
Dist.  
XhmikosR committed
526
527
528
529
530
      removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
    }
  });
}

XhmikosR's avatar
XhmikosR committed
531
532
var EventHandler = {
  on: function on(element, event, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
533
534
    addHandler(element, event, handler, delegationFn, false);
  },
XhmikosR's avatar
XhmikosR committed
535
  one: function one(element, event, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
536
537
    addHandler(element, event, handler, delegationFn, true);
  },
XhmikosR's avatar
XhmikosR committed
538
  off: function off(element, originalTypeEvent, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
539
540
541
542
    if (typeof originalTypeEvent !== 'string' || !element) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
543
544
545
546
    var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
        delegation = _normalizeParams2[0],
        originalHandler = _normalizeParams2[1],
        typeEvent = _normalizeParams2[2];
XhmikosR's avatar
Dist.  
XhmikosR committed
547

XhmikosR's avatar
XhmikosR committed
548
549
550
    var inNamespace = typeEvent !== originalTypeEvent;
    var events = getEvent(element);
    var isNamespace = originalTypeEvent.charAt(0) === '.';
XhmikosR's avatar
Dist.  
XhmikosR committed
551
552
553
554
555
556
557
558
559
560
561
562

    if (typeof originalHandler !== 'undefined') {
      // Simplest case: handler is passed, remove that listener ONLY.
      if (!events || !events[typeEvent]) {
        return;
      }

      removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
      return;
    }

    if (isNamespace) {
XhmikosR's avatar
XhmikosR committed
563
      Object.keys(events).forEach(function (elementEvent) {
XhmikosR's avatar
XhmikosR committed
564
        removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
Dist.  
XhmikosR committed
565
566
567
      });
    }

XhmikosR's avatar
XhmikosR committed
568
569
570
    var storeElementEvent = events[typeEvent] || {};
    Object.keys(storeElementEvent).forEach(function (keyHandlers) {
      var handlerKey = keyHandlers.replace(stripUidRegex, '');
XhmikosR's avatar
Dist.  
XhmikosR committed
571
572

      if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
XhmikosR's avatar
XhmikosR committed
573
        var event = storeElementEvent[keyHandlers];
XhmikosR's avatar
Dist.  
XhmikosR committed
574
575
576
577
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
      }
    });
  },
XhmikosR's avatar
XhmikosR committed
578
  trigger: function trigger(element, event, args) {
XhmikosR's avatar
Dist.  
XhmikosR committed
579
580
581
582
    if (typeof event !== 'string' || !element) {
      return null;
    }

XhmikosR's avatar
XhmikosR committed
583
584
585
586
587
588
589
590
    var typeEvent = event.replace(stripNameRegex, '');
    var inNamespace = event !== typeEvent;
    var isNative = nativeEvents.indexOf(typeEvent) > -1;
    var jQueryEvent;
    var bubbles = true;
    var nativeDispatch = true;
    var defaultPrevented = false;
    var evt = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
591

XhmikosR's avatar
XhmikosR committed
592
593
594
    if (inNamespace && $) {
      jQueryEvent = $.Event(event, args);
      $(element).trigger(jQueryEvent);
XhmikosR's avatar
Dist.  
XhmikosR committed
595
596
597
598
599
600
601
602
603
      bubbles = !jQueryEvent.isPropagationStopped();
      nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
      defaultPrevented = jQueryEvent.isDefaultPrevented();
    }

    if (isNative) {
      evt = document.createEvent('HTMLEvents');
      evt.initEvent(typeEvent, bubbles, true);
    } else {
XhmikosR's avatar
XhmikosR committed
604
      evt = new CustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
605
        bubbles: bubbles,
XhmikosR's avatar
Dist.  
XhmikosR committed
606
607
        cancelable: true
      });
XhmikosR's avatar
XhmikosR committed
608
    } // merge custom information in our event
XhmikosR's avatar
Dist.  
XhmikosR committed
609
610
611


    if (typeof args !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
612
      Object.keys(args).forEach(function (key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
613
        Object.defineProperty(evt, key, {
XhmikosR's avatar
XhmikosR committed
614
          get: function get() {
XhmikosR's avatar
Dist.  
XhmikosR committed
615
616
617
618
619
620
621
622
623
            return args[key];
          }
        });
      });
    }

    if (defaultPrevented) {
      evt.preventDefault();

XhmikosR's avatar
XhmikosR committed
624
      if (!defaultPreventedPreservedOnDispatch) {
XhmikosR's avatar
Dist.  
XhmikosR committed
625
        Object.defineProperty(evt, 'defaultPrevented', {
XhmikosR's avatar
XhmikosR committed
626
627
628
          get: function get() {
            return true;
          }
XhmikosR's avatar
Dist.  
XhmikosR committed
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
        });
      }
    }

    if (nativeDispatch) {
      element.dispatchEvent(evt);
    }

    if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
      jQueryEvent.preventDefault();
    }

    return evt;
  }
};

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
651
var NAME = 'alert';
XhmikosR's avatar
XhmikosR committed
652
var VERSION = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
653
654
655
var DATA_KEY = 'bs.alert';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
XhmikosR's avatar
XhmikosR committed
656
657
658
659
660
661
662
var SELECTOR_DISMISS = '[data-dismiss="alert"]';
var EVENT_CLOSE = "close" + EVENT_KEY;
var EVENT_CLOSED = "closed" + EVENT_KEY;
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
var CLASSNAME_ALERT = 'alert';
var CLASSNAME_FADE = 'fade';
var CLASSNAME_SHOW = 'show';
XhmikosR's avatar
XhmikosR committed
663
664
665
666
667
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
668

XhmikosR's avatar
XhmikosR committed
669
var Alert = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
670
  function Alert(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
671
672
673
674
675
676
677
678
    this._element = element;

    if (this._element) {
      Data.setData(element, DATA_KEY, this);
    }
  } // Getters


XhmikosR's avatar
XhmikosR committed
679
  var _proto = Alert.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
680

XhmikosR's avatar
XhmikosR committed
681
682
  // Public
  _proto.close = function close(element) {
XhmikosR's avatar
XhmikosR committed
683
    var rootElement = element ? this._getRootElement(element) : this._element;
XhmikosR's avatar
Dist.  
XhmikosR committed
684

XhmikosR's avatar
XhmikosR committed
685
    var customEvent = this._triggerCloseEvent(rootElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
686
687
688
689
690
691

    if (customEvent === null || customEvent.defaultPrevented) {
      return;
    }

    this._removeElement(rootElement);
XhmikosR's avatar
XhmikosR committed
692
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
693

XhmikosR's avatar
XhmikosR committed
694
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
695
696
697
    Data.removeData(this._element, DATA_KEY);
    this._element = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
698
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
699

XhmikosR's avatar
XhmikosR committed
700
  _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
701
    return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
XhmikosR's avatar
XhmikosR committed
702
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
703

XhmikosR's avatar
XhmikosR committed
704
  _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
705
    return EventHandler.trigger(element, EVENT_CLOSE);
XhmikosR's avatar
XhmikosR committed
706
707
708
709
  };

  _proto._removeElement = function _removeElement(element) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
710

XhmikosR's avatar
XhmikosR committed
711
    element.classList.remove(CLASSNAME_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
712

XhmikosR's avatar
XhmikosR committed
713
    if (!element.classList.contains(CLASSNAME_FADE)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
714
715
716
717
718
      this._destroyElement(element);

      return;
    }

XhmikosR's avatar
XhmikosR committed
719
    var transitionDuration = getTransitionDurationFromElement(element);
720
721
    EventHandler.one(element, TRANSITION_END, function () {
      return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
722
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
723
    emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
724
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
725

XhmikosR's avatar
XhmikosR committed
726
  _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
727
728
729
730
    if (element.parentNode) {
      element.parentNode.removeChild(element);
    }

XhmikosR's avatar
XhmikosR committed
731
    EventHandler.trigger(element, EVENT_CLOSED);
XhmikosR's avatar
Dist.  
XhmikosR committed
732
  } // Static
XhmikosR's avatar
XhmikosR committed
733
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
734

XhmikosR's avatar
XhmikosR committed
735
  Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
736
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
737
      var data = Data.getData(this, DATA_KEY);
XhmikosR's avatar
Dist.  
XhmikosR committed
738
739
740
741
742
743
744
745
746

      if (!data) {
        data = new Alert(this);
      }

      if (config === 'close') {
        data[config](this);
      }
    });
XhmikosR's avatar
XhmikosR committed
747
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
748

XhmikosR's avatar
XhmikosR committed
749
  Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist.  
XhmikosR committed
750
751
752
753
754
755
756
    return function (event) {
      if (event) {
        event.preventDefault();
      }

      alertInstance.close(this);
    };
XhmikosR's avatar
XhmikosR committed
757
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
758

XhmikosR's avatar
XhmikosR committed
759
  Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
760
    return Data.getData(element, DATA_KEY);
XhmikosR's avatar
XhmikosR committed
761
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
762

XhmikosR's avatar
XhmikosR committed
763
764
765
766
767
768
769
770
771
  _createClass(Alert, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION;
    }
  }]);

  return Alert;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
772
773
774
775
776
777
778
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
779
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
XhmikosR's avatar
XhmikosR committed
780
var $$1 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
781
782
783
784
785
786
787
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .alert to jQuery only if jQuery is present
 */

788
789
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
790
791
792
793
if ($$1) {
  var JQUERY_NO_CONFLICT = $$1.fn[NAME];
  $$1.fn[NAME] = Alert.jQueryInterface;
  $$1.fn[NAME].Constructor = Alert;
XhmikosR's avatar
Dist.  
XhmikosR committed
794

XhmikosR's avatar
XhmikosR committed
795
796
797
  $$1.fn[NAME].noConflict = function () {
    $$1.fn[NAME] = JQUERY_NO_CONFLICT;
    return Alert.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
798
799
800
801
802
803
804
805
806
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
807
var NAME$1 = 'button';
XhmikosR's avatar
XhmikosR committed
808
var VERSION$1 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
809
810
811
var DATA_KEY$1 = 'bs.button';
var EVENT_KEY$1 = "." + DATA_KEY$1;
var DATA_API_KEY$1 = '.data-api';
XhmikosR's avatar
XhmikosR committed
812
var CLASS_NAME_ACTIVE = 'active';
XhmikosR's avatar
XhmikosR committed
813
var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
XhmikosR's avatar
XhmikosR committed
814
var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
XhmikosR's avatar
XhmikosR committed
815
816
817
818
819
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
820

XhmikosR's avatar
XhmikosR committed
821
var Button = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
822
  function Button(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
823
824
825
826
827
    this._element = element;
    Data.setData(element, DATA_KEY$1, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
828
  var _proto = Button.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
829

XhmikosR's avatar
XhmikosR committed
830
831
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
832
833
    // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
    this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
XhmikosR's avatar
XhmikosR committed
834
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
835

XhmikosR's avatar
XhmikosR committed
836
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
837
838
839
    Data.removeData(this._element, DATA_KEY$1);
    this._element = null;
  } // Static
XhmikosR's avatar
XhmikosR committed
840
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
841

XhmikosR's avatar
XhmikosR committed
842
  Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
843
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
844
      var data = Data.getData(this, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
845
846
847
848
849
850
851
852
853

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

      if (config === 'toggle') {
        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
854
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
855

XhmikosR's avatar
XhmikosR committed
856
  Button.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
857
    return Data.getData(element, DATA_KEY$1);
XhmikosR's avatar
XhmikosR committed
858
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
859

XhmikosR's avatar
XhmikosR committed
860
861
862
863
864
865
866
867
868
  _createClass(Button, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$1;
    }
  }]);

  return Button;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
869
870
871
872
873
874
875
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
876
EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
877
  event.preventDefault();
XhmikosR's avatar
XhmikosR committed
878
  var button = event.target.closest(SELECTOR_DATA_TOGGLE);
XhmikosR's avatar
XhmikosR committed
879
  var data = Data.getData(button, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
880
881
882
883
884
885
886

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

  data.toggle();
});
XhmikosR's avatar
XhmikosR committed
887
var $$2 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
888
889
890
891
892
893
894
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .button to jQuery only if jQuery is present
 */

895
896
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
897
898
899
900
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
Dist.  
XhmikosR committed
901

XhmikosR's avatar
XhmikosR committed
902
903
904
  $$2.fn[NAME$1].noConflict = function () {
    $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
    return Button.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
905
906
907
908
909
  };
}

/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
910
 * Bootstrap (v5.0.0-alpha2): dom/manipulator.js
XhmikosR's avatar
XhmikosR committed
911
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
 * --------------------------------------------------------------------------
 */
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;
}

function normalizeDataKey(key) {
XhmikosR's avatar
XhmikosR committed
935
  return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
936
    return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
937
  });
XhmikosR's avatar
Dist.  
XhmikosR committed
938
939
}

XhmikosR's avatar
XhmikosR committed
940
941
942
var Manipulator = {
  setDataAttribute: function setDataAttribute(element, key, value) {
    element.setAttribute("data-" + normalizeDataKey(key), value);
XhmikosR's avatar
Dist.  
XhmikosR committed
943
  },
XhmikosR's avatar
XhmikosR committed
944
945
  removeDataAttribute: function removeDataAttribute(element, key) {
    element.removeAttribute("data-" + normalizeDataKey(key));
XhmikosR's avatar
Dist.  
XhmikosR committed
946
  },
XhmikosR's avatar
XhmikosR committed
947
  getDataAttributes: function getDataAttributes(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
948
949
950
951
    if (!element) {
      return {};
    }

XhmikosR's avatar
XhmikosR committed
952
    var attributes = _extends({}, element.dataset);
XhmikosR's avatar
Dist.  
XhmikosR committed
953

XhmikosR's avatar
XhmikosR committed
954
    Object.keys(attributes).forEach(function (key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
955
956
957
958
      attributes[key] = normalizeData(attributes[key]);
    });
    return attributes;
  },
XhmikosR's avatar
XhmikosR committed
959
960
  getDataAttribute: function getDataAttribute(element, key) {
    return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
XhmikosR's avatar
Dist.  
XhmikosR committed
961
  },
XhmikosR's avatar
XhmikosR committed
962
963
  offset: function offset(element) {
    var rect = element.getBoundingClientRect();
XhmikosR's avatar
Dist.  
XhmikosR committed
964
965
966
967
968
    return {
      top: rect.top + document.body.scrollTop,
      left: rect.left + document.body.scrollLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
969
  position: function position(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
970
971
972
973
974
    return {
      top: element.offsetTop,
      left: element.offsetLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
975
  toggleClass: function toggleClass(element, className) {
XhmikosR's avatar
Dist.  
XhmikosR committed
976
977
978
979
980
981
982
983
984
985
986
987
    if (!element) {
      return;
    }

    if (element.classList.contains(className)) {
      element.classList.remove(className);
    } else {
      element.classList.add(className);
    }
  }
};

XhmikosR's avatar
XhmikosR committed
988
989
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
990
 * Bootstrap (v5.0.0-alpha2): dom/selector-engine.js
XhmikosR's avatar
XhmikosR committed
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 * --------------------------------------------------------------------------
 */
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

var NODE_TEXT = 3;
var SelectorEngine = {
  matches: function matches(element, selector) {
    return element.matches(selector);
  },
  find: function find$1(selector, element) {
    var _ref;

    if (element === void 0) {
      element = document.documentElement;
    }

    return (_ref = []).concat.apply(_ref, find.call(element, selector));
  },
  findOne: function findOne$1(selector, element) {
    if (element === void 0) {
      element = document.documentElement;
    }

    return findOne.call(element, selector);
  },
  children: function children(element, selector) {
    var _ref2;

    var children = (_ref2 = []).concat.apply(_ref2, element.children);

    return children.filter(function (child) {
      return child.matches(selector);
    });
  },
  parents: function parents(element, selector) {
    var parents = [];
    var ancestor = element.parentNode;

    while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
      if (this.matches(ancestor, selector)) {
        parents.push(ancestor);
      }

      ancestor = ancestor.parentNode;
    }

    return parents;
  },
  prev: function prev(element, selector) {
    var previous = element.previousElementSibling;

    while (previous) {
      if (previous.matches(selector)) {
        return [previous];
      }

      previous = previous.previousElementSibling;
    }

    return [];
  },
  next: function next(element, selector) {
    var next = element.nextElementSibling;

    while (next) {
      if (this.matches(next, selector)) {
        return [next];
      }

      next = next.nextElementSibling;
    }

    return [];
  }
};

XhmikosR's avatar
Dist.  
XhmikosR committed
1072
1073
1074
1075
1076
1077
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
1078
var NAME$2 = 'carousel';
XhmikosR's avatar
XhmikosR committed
1079
var VERSION$2 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
1080
1081
1082
var DATA_KEY$2 = 'bs.carousel';
var EVENT_KEY$2 = "." + DATA_KEY$2;
var DATA_API_KEY$2 = '.data-api';
XhmikosR's avatar
XhmikosR committed
1083
1084
var ARROW_LEFT_KEY = 'ArrowLeft';
var ARROW_RIGHT_KEY = 'ArrowRight';
XhmikosR's avatar
XhmikosR committed
1085
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
XhmikosR's avatar
Dist.  
XhmikosR committed
1086

XhmikosR's avatar
XhmikosR committed
1087
1088
var SWIPE_THRESHOLD = 40;
var Default = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1089
1090
1091
1092
1093
1094
1095
  interval: 5000,
  keyboard: true,
  slide: false,
  pause: 'hover',
  wrap: true,
  touch: true
};
XhmikosR's avatar
XhmikosR committed
1096
var DefaultType = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1097
1098
1099
1100
1101
1102
1103
  interval: '(number|boolean)',
  keyboard: 'boolean',
  slide: '(boolean|string)',
  pause: '(string|boolean)',
  wrap: 'boolean',
  touch: 'boolean'
};
XhmikosR's avatar
XhmikosR committed
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
var DIRECTION_NEXT = 'next';
var DIRECTION_PREV = 'prev';
var DIRECTION_LEFT = 'left';
var DIRECTION_RIGHT = 'right';
var EVENT_SLIDE = "slide" + EVENT_KEY$2;
var EVENT_SLID = "slid" + EVENT_KEY$2;
var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
var CLASS_NAME_CAROUSEL = 'carousel';
var CLASS_NAME_ACTIVE$1 = 'active';
var CLASS_NAME_SLIDE = 'slide';
var CLASS_NAME_RIGHT = 'carousel-item-right';
var CLASS_NAME_LEFT = 'carousel-item-left';
var CLASS_NAME_NEXT = 'carousel-item-next';
var CLASS_NAME_PREV = 'carousel-item-prev';
var CLASS_NAME_POINTER_EVENT = 'pointer-event';
XhmikosR's avatar
XhmikosR committed
1129
var SELECTOR_ACTIVE = '.active';
XhmikosR's avatar
XhmikosR committed
1130
1131
1132
1133
1134
1135
1136
var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
var SELECTOR_ITEM = '.carousel-item';
var SELECTOR_ITEM_IMG = '.carousel-item img';
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
var SELECTOR_INDICATORS = '.carousel-indicators';
var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
XhmikosR's avatar
XhmikosR committed
1137
var PointerType = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1138
1139
1140
  TOUCH: 'touch',
  PEN: 'pen'
};
XhmikosR's avatar
XhmikosR committed
1141
1142
1143
1144
1145
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
1146

XhmikosR's avatar
XhmikosR committed
1147
var Carousel = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
1148
  function Carousel(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
    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
1159
    this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1160
    this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
XhmikosR's avatar
XhmikosR committed
1161
    this._pointerEvent = Boolean(window.PointerEvent);
XhmikosR's avatar
Dist.  
XhmikosR committed
1162
1163
1164
1165
1166
1167
1168

    this._addEventListeners();

    Data.setData(element, DATA_KEY$2, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
1169
  var _proto = Carousel.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
1170

XhmikosR's avatar
XhmikosR committed
1171
1172
  // Public
  _proto.next = function next() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1173
    if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1174
      this._slide(DIRECTION_NEXT);
XhmikosR's avatar
Dist.  
XhmikosR committed
1175
    }
XhmikosR's avatar
XhmikosR committed
1176
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1177

XhmikosR's avatar
XhmikosR committed
1178
  _proto.nextWhenVisible = function nextWhenVisible() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1179
1180
1181
1182
1183
    // Don't call next when the page isn't visible
    // or the carousel or its parent isn't visible
    if (!document.hidden && isVisible(this._element)) {
      this.next();
    }
XhmikosR's avatar
XhmikosR committed
1184
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1185

XhmikosR's avatar
XhmikosR committed
1186
  _proto.prev = function prev() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1187
    if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1188
      this._slide(DIRECTION_PREV);
XhmikosR's avatar
Dist.  
XhmikosR committed
1189
    }
XhmikosR's avatar
XhmikosR committed
1190
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1191

XhmikosR's avatar
XhmikosR committed
1192
  _proto.pause = function pause(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1193
1194
1195
1196
    if (!event) {
      this._isPaused = true;
    }

XhmikosR's avatar
XhmikosR committed
1197
    if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1198
1199
1200
1201
1202
1203
      triggerTransitionEnd(this._element);
      this.cycle(true);
    }

    clearInterval(this._interval);
    this._interval = null;
XhmikosR's avatar
XhmikosR committed
1204
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1205

XhmikosR's avatar
XhmikosR committed
1206
  _proto.cycle = function cycle(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
    if (!event) {
      this._isPaused = false;
    }

    if (this._interval) {
      clearInterval(this._interval);
      this._interval = null;
    }

    if (this._config && this._config.interval && !this._isPaused) {
      this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
    }
XhmikosR's avatar
XhmikosR committed
1219
1220
1221
1222
  };

  _proto.to = function to(index) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1223

XhmikosR's avatar
XhmikosR committed
1224
    this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1225

XhmikosR's avatar
XhmikosR committed
1226
    var activeIndex = this._getItemIndex(this._activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1227
1228
1229
1230
1231
1232

    if (index > this._items.length - 1 || index < 0) {
      return;
    }

    if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1233
      EventHandler.one(this._element, EVENT_SLID, function () {
XhmikosR's avatar
XhmikosR committed
1234
1235
        return _this.to(index);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1236
1237
1238
1239
1240
1241
1242
1243
1244
      return;
    }

    if (activeIndex === index) {
      this.pause();
      this.cycle();
      return;
    }

XhmikosR's avatar
XhmikosR committed
1245
    var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
XhmikosR's avatar
Dist.  
XhmikosR committed
1246
1247

    this._slide(direction, this._items[index]);
XhmikosR's avatar
XhmikosR committed
1248
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1249

XhmikosR's avatar
XhmikosR committed
1250
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
    EventHandler.off(this._element, EVENT_KEY$2);
    Data.removeData(this._element, DATA_KEY$2);
    this._items = null;
    this._config = null;
    this._element = null;
    this._interval = null;
    this._isPaused = null;
    this._isSliding = null;
    this._activeElement = null;
    this._indicatorsElement = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
1262
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1263

XhmikosR's avatar
XhmikosR committed
1264
  _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
1265
    config = _extends({}, Default, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1266
1267
    typeCheckConfig(NAME$2, config, DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
1268
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1269

XhmikosR's avatar
XhmikosR committed
1270
1271
  _proto._handleSwipe = function _handleSwipe() {
    var absDeltax = Math.abs(this.touchDeltaX);
XhmikosR's avatar
Dist.  
XhmikosR committed
1272
1273
1274
1275
1276

    if (absDeltax <= SWIPE_THRESHOLD) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
1277
1278
    var direction = absDeltax / this.touchDeltaX;
    this.touchDeltaX = 0; // swipe left
XhmikosR's avatar
Dist.  
XhmikosR committed
1279
1280
1281
1282
1283
1284
1285
1286
1287

    if (direction > 0) {
      this.prev();
    } // swipe right


    if (direction < 0) {
      this.next();
    }
XhmikosR's avatar
XhmikosR committed
1288
1289
1290
1291
  };

  _proto._addEventListeners = function _addEventListeners() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1292
1293

    if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1294
      EventHandler.on(this._element, EVENT_KEYDOWN, function (event) {
XhmikosR's avatar
XhmikosR committed
1295
1296
        return _this2._keydown(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1297
1298
1299
    }

    if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1300
      EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) {
XhmikosR's avatar
XhmikosR committed
1301
1302
        return _this2.pause(event);
      });
XhmikosR's avatar
XhmikosR committed
1303
      EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) {
XhmikosR's avatar
XhmikosR committed
1304
1305
        return _this2.cycle(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1306
1307
    }

1308
    if (this._config.touch && this._touchSupported) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1309
1310
      this._addTouchEventListeners();
    }
XhmikosR's avatar
XhmikosR committed
1311
1312
1313
1314
  };

  _proto._addTouchEventListeners = function _addTouchEventListeners() {
    var _this3 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1315

XhmikosR's avatar
XhmikosR committed
1316
1317
1318
1319
1320
    var start = function start(event) {
      if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
        _this3.touchStartX = event.clientX;
      } else if (!_this3._pointerEvent) {
        _this3.touchStartX = event.touches[0].clientX;
XhmikosR's avatar
Dist.  
XhmikosR committed
1321
1322
1323
      }
    };

XhmikosR's avatar
XhmikosR committed
1324
    var move = function move(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1325
1326
      // ensure swiping with one touch and not pinching
      if (event.touches && event.touches.length > 1) {
XhmikosR's avatar
XhmikosR committed
1327
        _this3.touchDeltaX = 0;
XhmikosR's avatar
Dist.  
XhmikosR committed
1328
      } else {
XhmikosR's avatar
XhmikosR committed
1329
        _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
XhmikosR's avatar
Dist.  
XhmikosR committed
1330
1331
1332
      }
    };

XhmikosR's avatar
XhmikosR committed
1333
1334
1335
    var end = function end(event) {
      if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
        _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist.  
XhmikosR committed
1336
1337
      }

XhmikosR's avatar
XhmikosR committed
1338
      _this3._handleSwipe();
XhmikosR's avatar
Dist.  
XhmikosR committed
1339

XhmikosR's avatar
XhmikosR committed
1340
      if (_this3._config.pause === 'hover') {
XhmikosR's avatar
Dist.  
XhmikosR committed
1341
1342
1343
1344
1345
1346
1347
        // 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
XhmikosR's avatar
XhmikosR committed
1348
        _this3.pause();
XhmikosR's avatar
Dist.  
XhmikosR committed
1349

XhmikosR's avatar
XhmikosR committed
1350
1351
        if (_this3.touchTimeout) {
          clearTimeout(_this3.touchTimeout);
XhmikosR's avatar
Dist.  
XhmikosR committed
1352
1353
        }

XhmikosR's avatar
XhmikosR committed
1354
1355
1356
        _this3.touchTimeout = setTimeout(function (event) {
          return _this3.cycle(event);
        }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
XhmikosR's avatar
Dist.  
XhmikosR committed
1357
1358
1359
      }
    };

XhmikosR's avatar
XhmikosR committed
1360
1361
    SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) {
      EventHandler.on(itemImg, EVENT_DRAG_START, function (e) {
XhmikosR's avatar
XhmikosR committed
1362
1363
        return e.preventDefault();
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1364
1365
1366
    });

    if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1367
      EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) {
XhmikosR's avatar
XhmikosR committed
1368
1369
        return start(event);
      });
XhmikosR's avatar
XhmikosR committed
1370
      EventHandler.on(this._element, EVENT_POINTERUP, function (event) {
XhmikosR's avatar
XhmikosR committed
1371
1372
        return end(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1373

XhmikosR's avatar
XhmikosR committed
1374
      this._element.classList.add(CLASS_NAME_POINTER_EVENT);
XhmikosR's avatar
Dist.  
XhmikosR committed
1375
    } else {
XhmikosR's avatar
XhmikosR committed
1376
      EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) {
XhmikosR's avatar
XhmikosR committed
1377
1378
        return start(event);
      });
XhmikosR's avatar
XhmikosR committed
1379
      EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) {
XhmikosR's avatar
XhmikosR committed
1380
1381
        return move(event);
      });
XhmikosR's avatar
XhmikosR committed
1382
      EventHandler.on(this._element, EVENT_TOUCHEND, function (event) {
XhmikosR's avatar
XhmikosR committed
1383
1384
        return end(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1385
    }
XhmikosR's avatar
XhmikosR committed
1386
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1387

XhmikosR's avatar
XhmikosR committed
1388
  _proto._keydown = function _keydown(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1389
1390
1391
1392
    if (/input|textarea/i.test(event.target.tagName)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
1393
1394
    switch (event.key) {
      case ARROW_LEFT_KEY:
XhmikosR's avatar
Dist.  
XhmikosR committed
1395
1396
1397
1398
        event.preventDefault();
        this.prev();
        break;

XhmikosR's avatar
XhmikosR committed
1399
      case ARROW_RIGHT_KEY:
XhmikosR's avatar
Dist.  
XhmikosR committed
1400
1401
1402
1403
        event.preventDefault();
        this.next();
        break;
    }
XhmikosR's avatar
XhmikosR committed
1404
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1405

XhmikosR's avatar
XhmikosR committed
1406
  _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
XhmikosR committed
1407
    this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
XhmikosR's avatar
Dist.  
XhmikosR committed
1408
    return this._items.indexOf(element);
XhmikosR's avatar
XhmikosR committed
1409
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1410

XhmikosR's avatar
XhmikosR committed
1411
  _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
XhmikosR's avatar
XhmikosR committed
1412
1413
    var isNextDirection = direction === DIRECTION_NEXT;
    var isPrevDirection = direction === DIRECTION_PREV;
XhmikosR's avatar
Dist.  
XhmikosR committed
1414

XhmikosR's avatar
XhmikosR committed
1415
    var activeIndex = this._getItemIndex(activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1416

XhmikosR's avatar
XhmikosR committed
1417
1418
    var lastItemIndex = this._items.length - 1;
    var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
XhmikosR's avatar
Dist.  
XhmikosR committed
1419
1420
1421
1422
1423

    if (isGoingToWrap && !this._config.wrap) {
      return activeElement;
    }

XhmikosR's avatar
XhmikosR committed
1424
    var delta = direction === DIRECTION_PREV ? -1 : 1;
XhmikosR's avatar
XhmikosR committed
1425
    var itemIndex = (activeIndex + delta) % this._items.length;
XhmikosR's avatar
Dist.  
XhmikosR committed
1426
    return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
XhmikosR's avatar
XhmikosR committed
1427
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1428

XhmikosR's avatar
XhmikosR committed
1429
1430
  _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
    var targetIndex = this._getItemIndex(relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
1431

XhmikosR's avatar
XhmikosR committed
1432
    var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
XhmikosR's avatar
Dist.  
XhmikosR committed
1433

XhmikosR's avatar
XhmikosR committed
1434
    return EventHandler.trigger(this._element, EVENT_SLIDE, {
XhmikosR's avatar
XhmikosR committed
1435
      relatedTarget: relatedTarget,
XhmikosR's avatar
Dist.  
XhmikosR committed
1436
1437
1438
1439
      direction: eventDirectionName,
      from: fromIndex,
      to: targetIndex
    });
XhmikosR's avatar
XhmikosR committed
1440
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1441

XhmikosR's avatar
XhmikosR committed
1442
  _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1443
    if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1444
      var indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1445

XhmikosR's avatar
XhmikosR committed
1446
      for (var i = 0; i < indicators.length; i++) {
XhmikosR's avatar
XhmikosR committed
1447
        indicators[i].classList.remove(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1448
1449
      }

XhmikosR's avatar
XhmikosR committed
1450
      var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
XhmikosR's avatar
Dist.  
XhmikosR committed
1451
1452

      if (nextIndicator) {
XhmikosR's avatar
XhmikosR committed
1453
        nextIndicator.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1454
1455
      }
    }
XhmikosR's avatar
XhmikosR committed
1456
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1457

XhmikosR's avatar
XhmikosR committed
1458
1459
  _proto._slide = function _slide(direction, element) {
    var _this4 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1460

XhmikosR's avatar
XhmikosR committed
1461
    var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1462

XhmikosR's avatar
XhmikosR committed
1463
    var activeElementIndex = this._getItemIndex(activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1464

XhmikosR's avatar
XhmikosR committed
1465
    var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1466

XhmikosR's avatar
XhmikosR committed
1467
1468
1469
1470
1471
1472
    var nextElementIndex = this._getItemIndex(nextElement);

    var isCycling = Boolean(this._interval);
    var directionalClassName;
    var orderClassName;
    var eventDirectionName;
XhmikosR's avatar
Dist.  
XhmikosR committed
1473

XhmikosR's avatar
XhmikosR committed
1474
1475
1476
1477
    if (direction === DIRECTION_NEXT) {
      directionalClassName = CLASS_NAME_LEFT;
      orderClassName = CLASS_NAME_NEXT;
      eventDirectionName = DIRECTION_LEFT;
XhmikosR's avatar
Dist.  
XhmikosR committed
1478
    } else {
XhmikosR's avatar
XhmikosR committed
1479
1480
1481
      directionalClassName = CLASS_NAME_RIGHT;
      orderClassName = CLASS_NAME_PREV;
      eventDirectionName = DIRECTION_RIGHT;
XhmikosR's avatar
Dist.  
XhmikosR committed
1482
1483
    }

XhmikosR's avatar
XhmikosR committed
1484
    if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$1)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1485
1486
1487
1488
      this._isSliding = false;
      return;
    }

XhmikosR's avatar
XhmikosR committed
1489
    var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
XhmikosR's avatar
Dist.  
XhmikosR committed
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507

    if (slideEvent.defaultPrevented) {
      return;
    }

    if (!activeElement || !nextElement) {
      // Some weirdness is happening, so we bail
      return;
    }

    this._isSliding = true;

    if (isCycling) {
      this.pause();
    }

    this._setActiveIndicatorElement(nextElement);

XhmikosR's avatar
XhmikosR committed
1508
    if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1509
1510
1511
1512
      nextElement.classList.add(orderClassName);
      reflow(nextElement);
      activeElement.classList.add(directionalClassName);
      nextElement.classList.add(directionalClassName);
XhmikosR's avatar
XhmikosR committed
1513
      var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
XhmikosR's avatar
Dist.  
XhmikosR committed
1514
1515
1516
1517
1518
1519
1520
1521

      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;
      }

XhmikosR's avatar
XhmikosR committed
1522
1523
      var transitionDuration = getTransitionDurationFromElement(activeElement);
      EventHandler.one(activeElement, TRANSITION_END, function () {
XhmikosR's avatar
XhmikosR committed
1524
        nextElement.classList.remove(directionalClassName, orderClassName);
XhmikosR's avatar
XhmikosR committed
1525
        nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
XhmikosR committed
1526
        activeElement.classList.remove(CLASS_NAME_ACTIVE$1, orderClassName, directionalClassName);
XhmikosR's avatar
XhmikosR committed
1527
1528
        _this4._isSliding = false;
        setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
1529
          EventHandler.trigger(_this4._element, EVENT_SLID, {
XhmikosR's avatar
Dist.  
XhmikosR committed
1530
1531
1532
1533
1534
1535
1536
1537
1538
            relatedTarget: nextElement,
            direction: eventDirectionName,
            from: activeElementIndex,
            to: nextElementIndex
          });
        }, 0);
      });
      emulateTransitionEnd(activeElement, transitionDuration);
    } else {
XhmikosR's avatar
XhmikosR committed
1539
1540
      activeElement.classList.remove(CLASS_NAME_ACTIVE$1);
      nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1541
      this._isSliding = false;
XhmikosR's avatar
XhmikosR committed
1542
      EventHandler.trigger(this._element, EVENT_SLID, {
XhmikosR's avatar
Dist.  
XhmikosR committed
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
        relatedTarget: nextElement,
        direction: eventDirectionName,
        from: activeElementIndex,
        to: nextElementIndex
      });
    }

    if (isCycling) {
      this.cycle();
    }
  } // Static
XhmikosR's avatar
XhmikosR committed
1554
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1555

XhmikosR's avatar
XhmikosR committed
1556
  Carousel.carouselInterface = function carouselInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1557
    var data = Data.getData(element, DATA_KEY$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
1558

XhmikosR's avatar
XhmikosR committed
1559
    var _config = _extends({}, Default, Manipulator.getDataAttributes(element));
XhmikosR's avatar
Dist.  
XhmikosR committed
1560
1561

    if (typeof config === 'object') {
XhmikosR's avatar
XhmikosR committed
1562
      _config = _extends({}, _config, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1563
1564
    }

XhmikosR's avatar
XhmikosR committed
1565
    var action = typeof config === 'string' ? config : _config.slide;
XhmikosR's avatar
Dist.  
XhmikosR committed
1566
1567
1568
1569
1570
1571
1572
1573
1574

    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
XhmikosR committed
1575
        throw new TypeError("No method named \"" + action + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
1576
1577
1578
1579
1580
1581
1582
      }

      data[action]();
    } else if (_config.interval && _config.ride) {
      data.pause();
      data.cycle();
    }
XhmikosR's avatar
XhmikosR committed
1583
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1584

XhmikosR's avatar
XhmikosR committed
1585
  Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1586
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1587
      Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1588
    });
XhmikosR's avatar
XhmikosR committed
1589
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1590

XhmikosR's avatar
XhmikosR committed
1591
1592
  Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
    var target = getElementFromSelector(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
1593

XhmikosR's avatar
XhmikosR committed
1594
    if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1595
1596
1597
      return;
    }

XhmikosR's avatar
XhmikosR committed
1598
    var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
XhmikosR's avatar
Dist.  
XhmikosR committed
1599

XhmikosR's avatar
XhmikosR committed
1600
    var slideIndex = this.getAttribute('data-slide-to');
XhmikosR's avatar
Dist.  
XhmikosR committed
1601
1602
1603
1604
1605

    if (slideIndex) {
      config.interval = false;
    }

XhmikosR's avatar
XhmikosR committed
1606
    Carousel.carouselInterface(target, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1607
1608
1609
1610
1611
1612

    if (slideIndex) {
      Data.getData(target, DATA_KEY$2).to(slideIndex);
    }

    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
1613
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1614

XhmikosR's avatar
XhmikosR committed
1615
  Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1616
    return Data.getData(element, DATA_KEY$2);
XhmikosR's avatar
XhmikosR committed
1617
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1618

XhmikosR's avatar
XhmikosR committed
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
  _createClass(Carousel, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$2;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default;
    }
  }]);

  return Carousel;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
1633
1634
1635
1636
1637
1638
1639
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
1640
1641
1642
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
EventHandler.on(window, EVENT_LOAD_DATA_API, function () {
  var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1643

XhmikosR's avatar
XhmikosR committed
1644
  for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1645
    Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist.  
XhmikosR committed
1646
1647
  }
});
XhmikosR's avatar
XhmikosR committed
1648
var $$3 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
1649
1650
1651
1652
1653
1654
1655
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .carousel to jQuery only if jQuery is present
 */

1656
1657
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1658
1659
1660
1661
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
1662

XhmikosR's avatar
XhmikosR committed
1663
1664
1665
  $$3.fn[NAME$2].noConflict = function () {
    $$3.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
    return Carousel.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
1666
1667
1668
1669
1670
1671
1672
1673
1674
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
1675
var NAME$3 = 'collapse';
XhmikosR's avatar
XhmikosR committed
1676
var VERSION$3 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
1677
1678
1679
1680
var DATA_KEY$3 = 'bs.collapse';
var EVENT_KEY$3 = "." + DATA_KEY$3;
var DATA_API_KEY$3 = '.data-api';
var Default$1 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1681
1682
1683
  toggle: true,
  parent: ''
};
XhmikosR's avatar
XhmikosR committed
1684
var DefaultType$1 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1685
1686
1687
  toggle: 'boolean',
  parent: '(string|element)'
};
XhmikosR's avatar
XhmikosR committed
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
var EVENT_SHOW = "show" + EVENT_KEY$3;
var EVENT_SHOWN = "shown" + EVENT_KEY$3;
var EVENT_HIDE = "hide" + EVENT_KEY$3;
var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
var CLASS_NAME_SHOW = 'show';
var CLASS_NAME_COLLAPSE = 'collapse';
var CLASS_NAME_COLLAPSING = 'collapsing';
var CLASS_NAME_COLLAPSED = 'collapsed';
var WIDTH = 'width';
var HEIGHT = 'height';
var SELECTOR_ACTIVES = '.show, .collapsing';
var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
XhmikosR's avatar
XhmikosR committed
1701
1702
1703
1704
1705
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
1706

XhmikosR's avatar
XhmikosR committed
1707
var Collapse = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
1708
  function Collapse(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1709
1710
1711
    this._isTransitioning = false;
    this._element = element;
    this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1712
1713
    this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1 + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE$1 + "[data-target=\"#" + element.id + "\"]"));
    var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1);
XhmikosR's avatar
XhmikosR committed
1714
1715
1716
1717

    for (var i = 0, len = toggleList.length; i < len; i++) {
      var elem = toggleList[i];
      var selector = getSelectorFromElement(elem);
XhmikosR's avatar
XhmikosR committed
1718
      var filterElement = SelectorEngine.find(selector).filter(function (foundElem) {
XhmikosR's avatar
XhmikosR committed
1719
1720
        return foundElem === element;
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742

      if (selector !== null && filterElement.length) {
        this._selector = selector;

        this._triggerArray.push(elem);
      }
    }

    this._parent = this._config.parent ? this._getParent() : null;

    if (!this._config.parent) {
      this._addAriaAndCollapsedClass(this._element, this._triggerArray);
    }

    if (this._config.toggle) {
      this.toggle();
    }

    Data.setData(element, DATA_KEY$3, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
1743
  var _proto = Collapse.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
1744

XhmikosR's avatar
XhmikosR committed
1745
1746
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
1747
    if (this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1748
1749
1750
1751
      this.hide();
    } else {
      this.show();
    }
XhmikosR's avatar
XhmikosR committed
1752
1753
1754
1755
  };

  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1756

XhmikosR's avatar
XhmikosR committed
1757
    if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1758
1759
1760
      return;
    }

XhmikosR's avatar
XhmikosR committed
1761
1762
    var actives;
    var activesData;
XhmikosR's avatar
Dist.  
XhmikosR committed
1763
1764

    if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1765
      actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) {
XhmikosR's avatar
XhmikosR committed
1766
1767
        if (typeof _this._config.parent === 'string') {
          return elem.getAttribute('data-parent') === _this._config.parent;
XhmikosR's avatar
Dist.  
XhmikosR committed
1768
1769
        }

XhmikosR's avatar
XhmikosR committed
1770
        return elem.classList.contains(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1771
1772
1773
1774
1775
1776
1777
      });

      if (actives.length === 0) {
        actives = null;
      }
    }

XhmikosR's avatar
XhmikosR committed
1778
    var container = SelectorEngine.findOne(this._selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
1779
1780

    if (actives) {
XhmikosR's avatar
XhmikosR committed
1781
1782
1783
      var tempActiveData = actives.filter(function (elem) {
        return container !== elem;
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1784
1785
1786
1787
1788
1789
1790
      activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY$3) : null;

      if (activesData && activesData._isTransitioning) {
        return;
      }
    }

XhmikosR's avatar
XhmikosR committed
1791
    var startEvent = EventHandler.trigger(this._element, EVENT_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
1792
1793
1794
1795
1796
1797

    if (startEvent.defaultPrevented) {
      return;
    }

    if (actives) {
XhmikosR's avatar
XhmikosR committed
1798
      actives.forEach(function (elemActive) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1799
        if (container !== elemActive) {
XhmikosR's avatar
XhmikosR committed
1800
          Collapse.collapseInterface(elemActive, 'hide');
XhmikosR's avatar
Dist.  
XhmikosR committed
1801
1802
1803
1804
1805
1806
1807
1808
        }

        if (!activesData) {
          Data.setData(elemActive, DATA_KEY$3, null);
        }
      });
    }

XhmikosR's avatar
XhmikosR committed
1809
    var dimension = this._getDimension();
XhmikosR's avatar
Dist.  
XhmikosR committed
1810

XhmikosR's avatar
XhmikosR committed
1811
    this._element.classList.remove(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1812

XhmikosR's avatar
XhmikosR committed
1813
    this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
Dist.  
XhmikosR committed
1814
1815
1816
1817

    this._element.style[dimension] = 0;

    if (this._triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
1818
      this._triggerArray.forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
1819
        element.classList.remove(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
Dist.  
XhmikosR committed
1820
1821
1822
1823
1824
1825
        element.setAttribute('aria-expanded', true);
      });
    }

    this.setTransitioning(true);

XhmikosR's avatar
XhmikosR committed
1826
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
1827
      _this._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1828

XhmikosR's avatar
XhmikosR committed
1829
      _this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
1830

XhmikosR's avatar
XhmikosR committed
1831
      _this._element.style[dimension] = '';
XhmikosR's avatar
Dist.  
XhmikosR committed
1832

XhmikosR's avatar
XhmikosR committed
1833
      _this.setTransitioning(false);
XhmikosR's avatar
Dist.  
XhmikosR committed
1834

XhmikosR's avatar
XhmikosR committed
1835
      EventHandler.trigger(_this._element, EVENT_SHOWN);
XhmikosR's avatar
Dist.  
XhmikosR committed
1836
1837
    };

XhmikosR's avatar
XhmikosR committed
1838
1839
1840
    var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
    var scrollSize = "scroll" + capitalizedDimension;
    var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1841
1842
    EventHandler.one(this._element, TRANSITION_END, complete);
    emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
1843
1844
1845
1846
1847
    this._element.style[dimension] = this._element[scrollSize] + "px";
  };

  _proto.hide = function hide() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1848

XhmikosR's avatar
XhmikosR committed
1849
    if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1850
1851
1852
      return;
    }

XhmikosR's avatar
XhmikosR committed
1853
    var startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1854
1855
1856
1857
1858

    if (startEvent.defaultPrevented) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
1859
    var dimension = this._getDimension();
XhmikosR's avatar
Dist.  
XhmikosR committed
1860

XhmikosR's avatar
XhmikosR committed
1861
    this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
1862
1863
    reflow(this._element);

XhmikosR's avatar
XhmikosR committed
1864
    this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
Dist.  
XhmikosR committed
1865

XhmikosR's avatar
XhmikosR committed
1866
    this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
1867

XhmikosR's avatar
XhmikosR committed
1868
    var triggerArrayLength = this._triggerArray.length;
XhmikosR's avatar
Dist.  
XhmikosR committed
1869
1870

    if (triggerArrayLength > 0) {
XhmikosR's avatar
XhmikosR committed
1871
1872
      for (var i = 0; i < triggerArrayLength; i++) {
        var trigger = this._triggerArray[i];
XhmikosR's avatar
XhmikosR committed
1873
        var elem = getElementFromSelector(trigger);
XhmikosR's avatar
Dist.  
XhmikosR committed
1874

XhmikosR's avatar
XhmikosR committed
1875
1876
        if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
          trigger.classList.add(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1877
          trigger.setAttribute('aria-expanded', false);
XhmikosR's avatar
Dist.  
XhmikosR committed
1878
1879
1880
1881
1882
1883
        }
      }
    }

    this.setTransitioning(true);

XhmikosR's avatar
XhmikosR committed
1884
1885
    var complete = function complete() {
      _this2.setTransitioning(false);
XhmikosR's avatar
Dist.  
XhmikosR committed
1886

XhmikosR's avatar
XhmikosR committed
1887
      _this2._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
Dist.  
XhmikosR committed
1888

XhmikosR's avatar
XhmikosR committed
1889
      _this2._element.classList.add(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1890

XhmikosR's avatar
XhmikosR committed
1891
      EventHandler.trigger(_this2._element, EVENT_HIDDEN);
XhmikosR's avatar
Dist.  
XhmikosR committed
1892
1893
1894
    };

    this._element.style[dimension] = '';
XhmikosR's avatar
XhmikosR committed
1895
    var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1896
1897
    EventHandler.one(this._element, TRANSITION_END, complete);
    emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
1898
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1899

XhmikosR's avatar
XhmikosR committed
1900
  _proto.setTransitioning = function setTransitioning(isTransitioning) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1901
    this._isTransitioning = isTransitioning;
XhmikosR's avatar
XhmikosR committed
1902
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1903

XhmikosR's avatar
XhmikosR committed
1904
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1905
1906
1907
1908
1909
1910
1911
    Data.removeData(this._element, DATA_KEY$3);
    this._config = null;
    this._parent = null;
    this._element = null;
    this._triggerArray = null;
    this._isTransitioning = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
1912
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1913

XhmikosR's avatar
XhmikosR committed
1914
  _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
1915
    config = _extends({}, Default$1, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1916
1917
1918
1919
    config.toggle = Boolean(config.toggle); // Coerce string values

    typeCheckConfig(NAME$3, config, DefaultType$1);
    return config;
XhmikosR's avatar
XhmikosR committed
1920
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1921

XhmikosR's avatar
XhmikosR committed
1922
  _proto._getDimension = function _getDimension() {
XhmikosR's avatar
XhmikosR committed
1923
    return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
XhmikosR's avatar
XhmikosR committed
1924
1925
1926
1927
  };

  _proto._getParent = function _getParent() {
    var _this3 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1928

XhmikosR's avatar
XhmikosR committed
1929
    var parent = this._config.parent;
XhmikosR's avatar
Dist.  
XhmikosR committed
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939

    if (isElement(parent)) {
      // it's a jQuery object
      if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
        parent = parent[0];
      }
    } else {
      parent = SelectorEngine.findOne(parent);
    }

XhmikosR's avatar
XhmikosR committed
1940
1941
    var selector = SELECTOR_DATA_TOGGLE$1 + "[data-parent=\"" + parent + "\"]";
    SelectorEngine.find(selector, parent).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
1942
      var selected = getElementFromSelector(element);
1943
1944

      _this3._addAriaAndCollapsedClass(selected, [element]);
XhmikosR's avatar
Dist.  
XhmikosR committed
1945
1946
    });
    return parent;
XhmikosR's avatar
XhmikosR committed
1947
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1948

XhmikosR's avatar
XhmikosR committed
1949
  _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
XhmikosR's avatar
XhmikosR committed
1950
1951
1952
    if (!element || !triggerArray.length) {
      return;
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
1953

XhmikosR's avatar
XhmikosR committed
1954
1955
1956
1957
1958
1959
    var isOpen = element.classList.contains(CLASS_NAME_SHOW);
    triggerArray.forEach(function (elem) {
      if (isOpen) {
        elem.classList.remove(CLASS_NAME_COLLAPSED);
      } else {
        elem.classList.add(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
Dist.  
XhmikosR committed
1960
      }
XhmikosR's avatar
XhmikosR committed
1961
1962
1963

      elem.setAttribute('aria-expanded', isOpen);
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
1964
  } // Static
XhmikosR's avatar
XhmikosR committed
1965
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1966

XhmikosR's avatar
XhmikosR committed
1967
  Collapse.collapseInterface = function collapseInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1968
    var data = Data.getData(element, DATA_KEY$3);
XhmikosR's avatar
Dist.  
XhmikosR committed
1969

XhmikosR's avatar
XhmikosR committed
1970
    var _config = _extends({}, Default$1, Manipulator.getDataAttributes(element), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
1971

XhmikosR's avatar
XhmikosR committed
1972
    if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1973
1974
1975
1976
1977
1978
1979
1980
1981
      _config.toggle = false;
    }

    if (!data) {
      data = new Collapse(element, _config);
    }

    if (typeof config === 'string') {
      if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
1982
        throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
1983
1984
1985
1986
      }

      data[config]();
    }
XhmikosR's avatar
XhmikosR committed
1987
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1988

XhmikosR's avatar
XhmikosR committed
1989
  Collapse.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1990
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1991
      Collapse.collapseInterface(this, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1992
    });
XhmikosR's avatar
XhmikosR committed
1993
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1994

XhmikosR's avatar
XhmikosR committed
1995
  Collapse.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1996
    return Data.getData(element, DATA_KEY$3);
XhmikosR's avatar
XhmikosR committed
1997
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1998

XhmikosR's avatar
XhmikosR committed
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
  _createClass(Collapse, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$3;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$1;
    }
  }]);

  return Collapse;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
2013
2014
2015
2016
2017
2018
2019
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
2020
EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2021
2022
2023
2024
2025
  // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  if (event.target.tagName === 'A') {
    event.preventDefault();
  }

XhmikosR's avatar
XhmikosR committed
2026
2027
  var triggerData = Manipulator.getDataAttributes(this);
  var selector = getSelectorFromElement(this);
XhmikosR's avatar
XhmikosR committed
2028
  var selectorElements = SelectorEngine.find(selector);
XhmikosR's avatar
XhmikosR committed
2029
2030
2031
  selectorElements.forEach(function (element) {
    var data = Data.getData(element, DATA_KEY$3);
    var config;
XhmikosR's avatar
Dist.  
XhmikosR committed
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044

    if (data) {
      // update parent attribute
      if (data._parent === null && typeof triggerData.parent === 'string') {
        data._config.parent = triggerData.parent;
        data._parent = data._getParent();
      }

      config = 'toggle';
    } else {
      config = triggerData;
    }

XhmikosR's avatar
XhmikosR committed
2045
    Collapse.collapseInterface(element, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2046
2047
  });
});
XhmikosR's avatar
XhmikosR committed
2048
var $$4 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
2049
2050
2051
2052
2053
2054
2055
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .collapse to jQuery only if jQuery is present
 */

2056
2057
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2058
2059
2060
2061
if ($$4) {
  var JQUERY_NO_CONFLICT$3 = $$4.fn[NAME$3];
  $$4.fn[NAME$3] = Collapse.jQueryInterface;
  $$4.fn[NAME$3].Constructor = Collapse;
XhmikosR's avatar
Dist.  
XhmikosR committed
2062

XhmikosR's avatar
XhmikosR committed
2063
2064
2065
  $$4.fn[NAME$3].noConflict = function () {
    $$4.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
    return Collapse.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
2066
2067
2068
2069
2070
2071
2072
2073
2074
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
2075
var NAME$4 = 'dropdown';
XhmikosR's avatar
XhmikosR committed
2076
var VERSION$4 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
2077
2078
2079
var DATA_KEY$4 = 'bs.dropdown';
var EVENT_KEY$4 = "." + DATA_KEY$4;
var DATA_API_KEY$4 = '.data-api';
XhmikosR's avatar
XhmikosR committed
2080
2081
2082
2083
2084
2085
2086
2087
var ESCAPE_KEY = 'Escape';
var SPACE_KEY = 'Space';
var TAB_KEY = 'Tab';
var ARROW_UP_KEY = 'ArrowUp';
var ARROW_DOWN_KEY = 'ArrowDown';
var RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button

var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEY + "|" + ARROW_DOWN_KEY + "|" + ESCAPE_KEY);
XhmikosR's avatar
XhmikosR committed
2088
2089
2090
2091
2092
2093
2094
2095
var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
var EVENT_CLICK = "click" + EVENT_KEY$4;
var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
XhmikosR's avatar
XhmikosR committed
2096
var CLASS_NAME_DISABLED = 'disabled';
XhmikosR's avatar
XhmikosR committed
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
var CLASS_NAME_SHOW$1 = 'show';
var CLASS_NAME_DROPUP = 'dropup';
var CLASS_NAME_DROPRIGHT = 'dropright';
var CLASS_NAME_DROPLEFT = 'dropleft';
var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
var CLASS_NAME_NAVBAR = 'navbar';
var CLASS_NAME_POSITION_STATIC = 'position-static';
var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
var SELECTOR_FORM_CHILD = '.dropdown form';
var SELECTOR_MENU = '.dropdown-menu';
var SELECTOR_NAVBAR_NAV = '.navbar-nav';
var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
var PLACEMENT_TOP = 'top-start';
var PLACEMENT_TOPEND = 'top-end';
var PLACEMENT_BOTTOM = 'bottom-start';
var PLACEMENT_BOTTOMEND = 'bottom-end';
var PLACEMENT_RIGHT = 'right-start';
var PLACEMENT_LEFT = 'left-start';
XhmikosR's avatar
XhmikosR committed
2115
var Default$2 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2116
2117
2118
2119
  offset: 0,
  flip: true,
  boundary: 'scrollParent',
  reference: 'toggle',
XhmikosR's avatar
XhmikosR committed
2120
2121
  display: 'dynamic',
  popperConfig: null
XhmikosR's avatar
Dist.  
XhmikosR committed
2122
};
XhmikosR's avatar
XhmikosR committed
2123
var DefaultType$2 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2124
2125
2126
2127
  offset: '(number|string|function)',
  flip: 'boolean',
  boundary: '(string|element)',
  reference: '(string|element)',
XhmikosR's avatar
XhmikosR committed
2128
2129
  display: 'string',
  popperConfig: '(null|object)'
XhmikosR's avatar
Dist.  
XhmikosR committed
2130
};
XhmikosR's avatar
XhmikosR committed
2131
2132
2133
2134
2135
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
2136

XhmikosR's avatar
XhmikosR committed
2137
var Dropdown = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
2138
  function Dropdown(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
    this._element = element;
    this._popper = null;
    this._config = this._getConfig(config);
    this._menu = this._getMenuElement();
    this._inNavbar = this._detectNavbar();

    this._addEventListeners();

    Data.setData(element, DATA_KEY$4, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
2151
  var _proto = Dropdown.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
2152

XhmikosR's avatar
XhmikosR committed
2153
2154
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
2155
    if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2156
2157
2158
      return;
    }

XhmikosR's avatar
XhmikosR committed
2159
    var isActive = this._element.classList.contains(CLASS_NAME_SHOW$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
2160

XhmikosR's avatar
XhmikosR committed
2161
    Dropdown.clearMenus();
XhmikosR's avatar
Dist.  
XhmikosR committed
2162
2163
2164
2165
2166

    if (isActive) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2167
2168
2169
2170
    this.show();
  };

  _proto.show = function show() {
XhmikosR's avatar
XhmikosR committed
2171
    if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
XhmikosR committed
2172
2173
2174
2175
      return;
    }

    var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
XhmikosR committed
2176
    var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2177
2178
      relatedTarget: this._element
    };
XhmikosR's avatar
XhmikosR committed
2179
    var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190

    if (showEvent.defaultPrevented) {
      return;
    } // Disable totally Popper.js for Dropdown in Navbar


    if (!this._inNavbar) {
      if (typeof Popper === 'undefined') {
        throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)');
      }

XhmikosR's avatar
XhmikosR committed
2191
      var referenceElement = this._element;
XhmikosR's avatar
Dist.  
XhmikosR committed
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206

      if (this._config.reference === 'parent') {
        referenceElement = parent;
      } else if (isElement(this._config.reference)) {
        referenceElement = this._config.reference; // Check if it's jQuery element

        if (typeof this._config.reference.jquery !== 'undefined') {
          referenceElement = this._config.reference[0];
        }
      } // If boundary is not `scrollParent`, then set position to `static`
      // to allow the menu to "escape" the scroll parent's boundaries
      // https://github.com/twbs/bootstrap/issues/24251


      if (this._config.boundary !== 'scrollParent') {
XhmikosR's avatar
XhmikosR committed
2207
        parent.classList.add(CLASS_NAME_POSITION_STATIC);
XhmikosR's avatar
Dist.  
XhmikosR committed
2208
2209
2210
2211
2212
2213
2214
2215
2216
      }

      this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
    } // If this is a touch-enabled device we add extra
    // empty mouseover listeners to the body's immediate children;
    // only needed because of broken event delegation on iOS
    // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html


XhmikosR's avatar
XhmikosR committed
2217
    if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
XhmikosR's avatar
XhmikosR committed
2218
2219
2220
      var _ref;

      (_ref = []).concat.apply(_ref, document.body.children).forEach(function (elem) {
XhmikosR's avatar
XhmikosR committed
2221
2222
        return EventHandler.on(elem, 'mouseover', null, noop());
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
2223
2224
2225
2226
2227
2228
    }

    this._element.focus();

    this._element.setAttribute('aria-expanded', true);

XhmikosR's avatar
XhmikosR committed
2229
2230
2231
    Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
    Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
    EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget);
XhmikosR's avatar
XhmikosR committed
2232
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2233

XhmikosR's avatar
XhmikosR committed
2234
  _proto.hide = function hide() {
XhmikosR's avatar
XhmikosR committed
2235
    if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2236
2237
2238
      return;
    }

XhmikosR's avatar
XhmikosR committed
2239
    var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
XhmikosR committed
2240
    var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2241
2242
      relatedTarget: this._element
    };
XhmikosR's avatar
XhmikosR committed
2243
    var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2244
2245
2246
2247
2248

    if (hideEvent.defaultPrevented) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2249
2250
2251
2252
    if (this._popper) {
      this._popper.destroy();
    }

XhmikosR's avatar
XhmikosR committed
2253
2254
2255
    Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
    Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
    EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
XhmikosR's avatar
XhmikosR committed
2256
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2257

XhmikosR's avatar
XhmikosR committed
2258
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2259
2260
2261
2262
2263
    Data.removeData(this._element, DATA_KEY$4);
    EventHandler.off(this._element, EVENT_KEY$4);
    this._element = null;
    this._menu = null;

XhmikosR's avatar
XhmikosR committed
2264
    if (this._popper) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2265
2266
2267
2268
      this._popper.destroy();

      this._popper = null;
    }
XhmikosR's avatar
XhmikosR committed
2269
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2270

XhmikosR's avatar
XhmikosR committed
2271
  _proto.update = function update() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2272
2273
    this._inNavbar = this._detectNavbar();

XhmikosR's avatar
XhmikosR committed
2274
    if (this._popper) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2275
2276
2277
      this._popper.scheduleUpdate();
    }
  } // Private
XhmikosR's avatar
XhmikosR committed
2278
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2279

XhmikosR's avatar
XhmikosR committed
2280
2281
  _proto._addEventListeners = function _addEventListeners() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2282

XhmikosR's avatar
XhmikosR committed
2283
    EventHandler.on(this._element, EVENT_CLICK, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2284
2285
      event.preventDefault();
      event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
2286
2287

      _this.toggle();
XhmikosR's avatar
Dist.  
XhmikosR committed
2288
    });
XhmikosR's avatar
XhmikosR committed
2289
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2290

XhmikosR's avatar
XhmikosR committed
2291
  _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
2292
    config = _extends({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2293
2294
    typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
2295
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2296

XhmikosR's avatar
XhmikosR committed
2297
  _proto._getMenuElement = function _getMenuElement() {
XhmikosR's avatar
XhmikosR committed
2298
    return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
XhmikosR's avatar
XhmikosR committed
2299
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2300

XhmikosR's avatar
XhmikosR committed
2301
2302
  _proto._getPlacement = function _getPlacement() {
    var parentDropdown = this._element.parentNode;
XhmikosR's avatar
XhmikosR committed
2303
    var placement = PLACEMENT_BOTTOM; // Handle dropup
XhmikosR's avatar
Dist.  
XhmikosR committed
2304

XhmikosR's avatar
XhmikosR committed
2305
2306
    if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
      placement = PLACEMENT_TOP;
XhmikosR's avatar
Dist.  
XhmikosR committed
2307

XhmikosR's avatar
XhmikosR committed
2308
2309
      if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
        placement = PLACEMENT_TOPEND;
XhmikosR's avatar
Dist.  
XhmikosR committed
2310
      }
XhmikosR's avatar
XhmikosR committed
2311
2312
2313
2314
2315
2316
    } else if (parentDropdown.classList.contains(CLASS_NAME_DROPRIGHT)) {
      placement = PLACEMENT_RIGHT;
    } else if (parentDropdown.classList.contains(CLASS_NAME_DROPLEFT)) {
      placement = PLACEMENT_LEFT;
    } else if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
      placement = PLACEMENT_BOTTOMEND;
XhmikosR's avatar
Dist.  
XhmikosR committed
2317
2318
2319
    }

    return placement;
XhmikosR's avatar
XhmikosR committed
2320
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2321

XhmikosR's avatar
XhmikosR committed
2322
  _proto._detectNavbar = function _detectNavbar() {
XhmikosR's avatar
XhmikosR committed
2323
    return Boolean(this._element.closest("." + CLASS_NAME_NAVBAR));
XhmikosR's avatar
XhmikosR committed
2324
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2325

XhmikosR's avatar
XhmikosR committed
2326
2327
2328
2329
  _proto._getOffset = function _getOffset() {
    var _this2 = this;

    var offset = {};
XhmikosR's avatar
Dist.  
XhmikosR committed
2330
2331

    if (typeof this._config.offset === 'function') {
XhmikosR's avatar
XhmikosR committed
2332
      offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
2333
        data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist.  
XhmikosR committed
2334
2335
2336
2337
2338
2339
2340
        return data;
      };
    } else {
      offset.offset = this._config.offset;
    }

    return offset;
XhmikosR's avatar
XhmikosR committed
2341
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2342

XhmikosR's avatar
XhmikosR committed
2343
2344
  _proto._getPopperConfig = function _getPopperConfig() {
    var popperConfig = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2345
2346
2347
2348
2349
2350
2351
2352
2353
      placement: this._getPlacement(),
      modifiers: {
        offset: this._getOffset(),
        flip: {
          enabled: this._config.flip
        },
        preventOverflow: {
          boundariesElement: this._config.boundary
        }
XhmikosR's avatar
XhmikosR committed
2354
2355
      }
    }; // Disable Popper.js if we have a static display
XhmikosR's avatar
Dist.  
XhmikosR committed
2356
2357
2358
2359
2360
2361
2362

    if (this._config.display === 'static') {
      popperConfig.modifiers.applyStyle = {
        enabled: false
      };
    }

XhmikosR's avatar
XhmikosR committed
2363
    return _extends({}, popperConfig, this._config.popperConfig);
XhmikosR's avatar
Dist.  
XhmikosR committed
2364
  } // Static
XhmikosR's avatar
XhmikosR committed
2365
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2366

XhmikosR's avatar
XhmikosR committed
2367
  Dropdown.dropdownInterface = function dropdownInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
2368
    var data = Data.getData(element, DATA_KEY$4);
XhmikosR's avatar
Dist.  
XhmikosR committed
2369

XhmikosR's avatar
XhmikosR committed
2370
    var _config = typeof config === 'object' ? config : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
2371
2372
2373
2374
2375
2376
2377

    if (!data) {
      data = new Dropdown(element, _config);
    }

    if (typeof config === 'string') {
      if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
2378
        throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
2379
2380
2381
2382
      }

      data[config]();
    }
XhmikosR's avatar
XhmikosR committed
2383
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2384

XhmikosR's avatar
XhmikosR committed
2385
  Dropdown.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2386
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2387
      Dropdown.dropdownInterface(this, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2388
    });
XhmikosR's avatar
XhmikosR committed
2389
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2390

XhmikosR's avatar
XhmikosR committed
2391
  Dropdown.clearMenus = function clearMenus(event) {
XhmikosR's avatar
XhmikosR committed
2392
    if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2393
2394
2395
      return;
    }

XhmikosR's avatar
XhmikosR committed
2396
    var toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
2397

XhmikosR's avatar
XhmikosR committed
2398
    for (var i = 0, len = toggles.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
2399
      var parent = Dropdown.getParentFromElement(toggles[i]);
XhmikosR's avatar
XhmikosR committed
2400
2401
      var context = Data.getData(toggles[i], DATA_KEY$4);
      var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
        relatedTarget: toggles[i]
      };

      if (event && event.type === 'click') {
        relatedTarget.clickEvent = event;
      }

      if (!context) {
        continue;
      }

XhmikosR's avatar
XhmikosR committed
2413
      var dropdownMenu = context._menu;
XhmikosR's avatar
Dist.  
XhmikosR committed
2414

XhmikosR's avatar
XhmikosR committed
2415
      if (!toggles[i].classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2416
2417
2418
        continue;
      }

XhmikosR's avatar
XhmikosR committed
2419
      if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.key === TAB_KEY) && dropdownMenu.contains(event.target)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2420
2421
2422
        continue;
      }

XhmikosR's avatar
XhmikosR committed
2423
      var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2424
2425
2426
2427
2428
2429
2430
2431

      if (hideEvent.defaultPrevented) {
        continue;
      } // If this is a touch-enabled device we remove the extra
      // empty mouseover listeners we added for iOS support


      if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
2432
2433
2434
        var _ref2;

        (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) {
XhmikosR's avatar
XhmikosR committed
2435
2436
          return EventHandler.off(elem, 'mouseover', null, noop());
        });
XhmikosR's avatar
Dist.  
XhmikosR committed
2437
2438
2439
      }

      toggles[i].setAttribute('aria-expanded', 'false');
XhmikosR's avatar
XhmikosR committed
2440
2441
2442
2443
2444

      if (context._popper) {
        context._popper.destroy();
      }

XhmikosR's avatar
XhmikosR committed
2445
2446
2447
      dropdownMenu.classList.remove(CLASS_NAME_SHOW$1);
      toggles[i].classList.remove(CLASS_NAME_SHOW$1);
      EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2448
    }
XhmikosR's avatar
XhmikosR committed
2449
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2450

XhmikosR's avatar
XhmikosR committed
2451
2452
  Dropdown.getParentFromElement = function getParentFromElement(element) {
    return getElementFromSelector(element) || element.parentNode;
XhmikosR's avatar
XhmikosR committed
2453
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2454

XhmikosR's avatar
XhmikosR committed
2455
  Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2456
2457
2458
2459
2460
2461
2462
    // If not input/textarea:
    //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
    // If input/textarea:
    //  - If space key => not a dropdown command
    //  - If key is other than escape
    //    - If key is not up or down => not a dropdown command
    //    - If trigger inside the menu => not a dropdown command
XhmikosR's avatar
XhmikosR committed
2463
    if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2464
2465
2466
2467
2468
2469
      return;
    }

    event.preventDefault();
    event.stopPropagation();

XhmikosR's avatar
XhmikosR committed
2470
    if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2471
2472
2473
      return;
    }

XhmikosR's avatar
XhmikosR committed
2474
    var parent = Dropdown.getParentFromElement(this);
XhmikosR's avatar
XhmikosR committed
2475
    var isActive = this.classList.contains(CLASS_NAME_SHOW$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
2476

XhmikosR's avatar
XhmikosR committed
2477
    if (event.key === ESCAPE_KEY) {
XhmikosR's avatar
XhmikosR committed
2478
2479
2480
2481
2482
      var button = this.matches(SELECTOR_DATA_TOGGLE$2) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$2)[0];
      button.focus();
      Dropdown.clearMenus();
      return;
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
2483

XhmikosR's avatar
XhmikosR committed
2484
    if (!isActive || event.key === SPACE_KEY) {
XhmikosR's avatar
XhmikosR committed
2485
      Dropdown.clearMenus();
XhmikosR's avatar
Dist.  
XhmikosR committed
2486
2487
2488
      return;
    }

XhmikosR's avatar
XhmikosR committed
2489
    var items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
XhmikosR's avatar
Dist.  
XhmikosR committed
2490
2491
2492
2493
2494

    if (!items.length) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2495
    var index = items.indexOf(event.target);
XhmikosR's avatar
Dist.  
XhmikosR committed
2496

XhmikosR's avatar
XhmikosR committed
2497
    if (event.key === ARROW_UP_KEY && index > 0) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2498
2499
2500
2501
      // Up
      index--;
    }

XhmikosR's avatar
XhmikosR committed
2502
    if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2503
2504
      // Down
      index++;
XhmikosR's avatar
XhmikosR committed
2505
2506
    } // index is -1 if the first keydown is an ArrowUp

XhmikosR's avatar
Dist.  
XhmikosR committed
2507

XhmikosR's avatar
XhmikosR committed
2508
    index = index === -1 ? 0 : index;
XhmikosR's avatar
Dist.  
XhmikosR committed
2509
    items[index].focus();
XhmikosR's avatar
XhmikosR committed
2510
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2511

XhmikosR's avatar
XhmikosR committed
2512
  Dropdown.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2513
    return Data.getData(element, DATA_KEY$4);
XhmikosR's avatar
XhmikosR committed
2514
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2515

XhmikosR's avatar
XhmikosR committed
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
  _createClass(Dropdown, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$4;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$2;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$2;
    }
  }]);

  return Dropdown;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
2535
2536
2537
2538
2539
2540
2541
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
2542
2543
2544
2545
2546
EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown.dataApiKeydownHandler);
EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
EventHandler.on(document, EVENT_CLICK_DATA_API$4, Dropdown.clearMenus);
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2547
2548
  event.preventDefault();
  event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
2549
  Dropdown.dropdownInterface(this, 'toggle');
XhmikosR's avatar
Dist.  
XhmikosR committed
2550
});
XhmikosR's avatar
XhmikosR committed
2551
EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
XhmikosR's avatar
XhmikosR committed
2552
2553
  return e.stopPropagation();
});
XhmikosR's avatar
XhmikosR committed
2554
var $$5 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
2555
2556
2557
2558
2559
2560
2561
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .dropdown to jQuery only if jQuery is present
 */

2562
2563
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2564
2565
2566
2567
if ($$5) {
  var JQUERY_NO_CONFLICT$4 = $$5.fn[NAME$4];
  $$5.fn[NAME$4] = Dropdown.jQueryInterface;
  $$5.fn[NAME$4].Constructor = Dropdown;
XhmikosR's avatar
Dist.  
XhmikosR committed
2568

XhmikosR's avatar
XhmikosR committed
2569
2570
2571
  $$5.fn[NAME$4].noConflict = function () {
    $$5.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
    return Dropdown.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
2572
2573
2574
2575
2576
2577
2578
2579
2580
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
2581
var NAME$5 = 'modal';
XhmikosR's avatar
XhmikosR committed
2582
var VERSION$5 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
2583
2584
2585
var DATA_KEY$5 = 'bs.modal';
var EVENT_KEY$5 = "." + DATA_KEY$5;
var DATA_API_KEY$5 = '.data-api';
XhmikosR's avatar
XhmikosR committed
2586
var ESCAPE_KEY$1 = 'Escape';
XhmikosR's avatar
XhmikosR committed
2587
var Default$3 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2588
2589
2590
2591
2592
  backdrop: true,
  keyboard: true,
  focus: true,
  show: true
};
XhmikosR's avatar
XhmikosR committed
2593
var DefaultType$3 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2594
2595
2596
2597
2598
  backdrop: '(boolean|string)',
  keyboard: 'boolean',
  focus: 'boolean',
  show: 'boolean'
};
XhmikosR's avatar
XhmikosR committed
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
var EVENT_RESIZE = "resize" + EVENT_KEY$5;
var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
var CLASS_NAME_BACKDROP = 'modal-backdrop';
var CLASS_NAME_OPEN = 'modal-open';
var CLASS_NAME_FADE = 'fade';
var CLASS_NAME_SHOW$2 = 'show';
var CLASS_NAME_STATIC = 'modal-static';
var SELECTOR_DIALOG = '.modal-dialog';
var SELECTOR_MODAL_BODY = '.modal-body';
var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
var SELECTOR_STICKY_CONTENT = '.sticky-top';
XhmikosR's avatar
XhmikosR committed
2623
2624
2625
2626
2627
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
2628

XhmikosR's avatar
XhmikosR committed
2629
var Modal = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
2630
  function Modal(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2631
2632
    this._config = this._getConfig(config);
    this._element = element;
XhmikosR's avatar
XhmikosR committed
2633
    this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
    this._backdrop = null;
    this._isShown = false;
    this._isBodyOverflowing = false;
    this._ignoreBackdropClick = false;
    this._isTransitioning = false;
    this._scrollbarWidth = 0;
    Data.setData(element, DATA_KEY$5, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
2644
  var _proto = Modal.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
2645

XhmikosR's avatar
XhmikosR committed
2646
2647
  // Public
  _proto.toggle = function toggle(relatedTarget) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2648
    return this._isShown ? this.hide() : this.show(relatedTarget);
XhmikosR's avatar
XhmikosR committed
2649
2650
2651
2652
  };

  _proto.show = function show(relatedTarget) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2653
2654
2655
2656
2657

    if (this._isShown || this._isTransitioning) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2658
    if (this._element.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2659
2660
2661
      this._isTransitioning = true;
    }

XhmikosR's avatar
XhmikosR committed
2662
    var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
XhmikosR's avatar
XhmikosR committed
2663
      relatedTarget: relatedTarget
XhmikosR's avatar
Dist.  
XhmikosR committed
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
    });

    if (this._isShown || showEvent.defaultPrevented) {
      return;
    }

    this._isShown = true;

    this._checkScrollbar();

    this._setScrollbar();

    this._adjustDialog();

    this._setEscapeEvent();

    this._setResizeEvent();

XhmikosR's avatar
XhmikosR committed
2682
    EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
2683
2684
      return _this.hide(event);
    });
XhmikosR's avatar
XhmikosR committed
2685
2686
    EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
      EventHandler.one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
2687
2688
        if (event.target === _this._element) {
          _this._ignoreBackdropClick = true;
XhmikosR's avatar
Dist.  
XhmikosR committed
2689
2690
2691
2692
        }
      });
    });

XhmikosR's avatar
XhmikosR committed
2693
2694
2695
2696
2697
2698
2699
    this._showBackdrop(function () {
      return _this._showElement(relatedTarget);
    });
  };

  _proto.hide = function hide(event) {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2700
2701
2702
2703
2704
2705
2706
2707
2708

    if (event) {
      event.preventDefault();
    }

    if (!this._isShown || this._isTransitioning) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2709
    var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
2710

2711
    if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2712
2713
2714
2715
2716
      return;
    }

    this._isShown = false;

XhmikosR's avatar
XhmikosR committed
2717
    var transition = this._element.classList.contains(CLASS_NAME_FADE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2718
2719
2720
2721
2722
2723
2724
2725
2726

    if (transition) {
      this._isTransitioning = true;
    }

    this._setEscapeEvent();

    this._setResizeEvent();

XhmikosR's avatar
XhmikosR committed
2727
    EventHandler.off(document, EVENT_FOCUSIN);
XhmikosR's avatar
Dist.  
XhmikosR committed
2728

XhmikosR's avatar
XhmikosR committed
2729
    this._element.classList.remove(CLASS_NAME_SHOW$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
2730

XhmikosR's avatar
XhmikosR committed
2731
2732
    EventHandler.off(this._element, EVENT_CLICK_DISMISS);
    EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
XhmikosR's avatar
Dist.  
XhmikosR committed
2733
2734

    if (transition) {
XhmikosR's avatar
XhmikosR committed
2735
2736
2737
2738
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, function (event) {
        return _this2._hideModal(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
2739
2740
2741
2742
      emulateTransitionEnd(this._element, transitionDuration);
    } else {
      this._hideModal();
    }
XhmikosR's avatar
XhmikosR committed
2743
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2744

XhmikosR's avatar
XhmikosR committed
2745
2746
2747
2748
  _proto.dispose = function dispose() {
    [window, this._element, this._dialog].forEach(function (htmlElement) {
      return EventHandler.off(htmlElement, EVENT_KEY$5);
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
2749
    /**
XhmikosR's avatar
XhmikosR committed
2750
     * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
XhmikosR's avatar
Dist.  
XhmikosR committed
2751
     * Do not move `document` in `htmlElements` array
XhmikosR's avatar
XhmikosR committed
2752
     * It will remove `EVENT_CLICK_DATA_API` event that should remain
XhmikosR's avatar
Dist.  
XhmikosR committed
2753
2754
     */

XhmikosR's avatar
XhmikosR committed
2755
    EventHandler.off(document, EVENT_FOCUSIN);
XhmikosR's avatar
Dist.  
XhmikosR committed
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
    Data.removeData(this._element, DATA_KEY$5);
    this._config = null;
    this._element = null;
    this._dialog = null;
    this._backdrop = null;
    this._isShown = null;
    this._isBodyOverflowing = null;
    this._ignoreBackdropClick = null;
    this._isTransitioning = null;
    this._scrollbarWidth = null;
XhmikosR's avatar
XhmikosR committed
2766
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2767

XhmikosR's avatar
XhmikosR committed
2768
  _proto.handleUpdate = function handleUpdate() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2769
2770
    this._adjustDialog();
  } // Private
XhmikosR's avatar
XhmikosR committed
2771
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2772

XhmikosR's avatar
XhmikosR committed
2773
  _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
2774
    config = _extends({}, Default$3, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2775
2776
    typeCheckConfig(NAME$5, config, DefaultType$3);
    return config;
XhmikosR's avatar
XhmikosR committed
2777
2778
2779
2780
  };

  _proto._showElement = function _showElement(relatedTarget) {
    var _this3 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2781

XhmikosR's avatar
XhmikosR committed
2782
    var transition = this._element.classList.contains(CLASS_NAME_FADE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2783

XhmikosR's avatar
XhmikosR committed
2784
    var modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
XhmikosR's avatar
XhmikosR committed
2785

XhmikosR's avatar
Dist.  
XhmikosR committed
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
    if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
      // Don't move modal's DOM position
      document.body.appendChild(this._element);
    }

    this._element.style.display = 'block';

    this._element.removeAttribute('aria-hidden');

    this._element.setAttribute('aria-modal', true);

Mark Otto's avatar
Mark Otto committed
2797
2798
    this._element.setAttribute('role', 'dialog');

XhmikosR's avatar
XhmikosR committed
2799
2800
2801
    this._element.scrollTop = 0;

    if (modalBody) {
XhmikosR's avatar
XhmikosR committed
2802
      modalBody.scrollTop = 0;
XhmikosR's avatar
Dist.  
XhmikosR committed
2803
2804
2805
2806
2807
2808
    }

    if (transition) {
      reflow(this._element);
    }

XhmikosR's avatar
XhmikosR committed
2809
    this._element.classList.add(CLASS_NAME_SHOW$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
2810
2811
2812
2813
2814

    if (this._config.focus) {
      this._enforceFocus();
    }

XhmikosR's avatar
XhmikosR committed
2815
2816
2817
    var transitionComplete = function transitionComplete() {
      if (_this3._config.focus) {
        _this3._element.focus();
XhmikosR's avatar
Dist.  
XhmikosR committed
2818
2819
      }

XhmikosR's avatar
XhmikosR committed
2820
      _this3._isTransitioning = false;
XhmikosR's avatar
XhmikosR committed
2821
      EventHandler.trigger(_this3._element, EVENT_SHOWN$2, {
XhmikosR's avatar
XhmikosR committed
2822
        relatedTarget: relatedTarget
XhmikosR's avatar
Dist.  
XhmikosR committed
2823
2824
2825
2826
      });
    };

    if (transition) {
XhmikosR's avatar
XhmikosR committed
2827
      var transitionDuration = getTransitionDurationFromElement(this._dialog);
XhmikosR's avatar
Dist.  
XhmikosR committed
2828
2829
2830
2831
2832
      EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
      emulateTransitionEnd(this._dialog, transitionDuration);
    } else {
      transitionComplete();
    }
XhmikosR's avatar
XhmikosR committed
2833
2834
2835
2836
  };

  _proto._enforceFocus = function _enforceFocus() {
    var _this4 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2837

XhmikosR's avatar
XhmikosR committed
2838
    EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
XhmikosR's avatar
Dist.  
XhmikosR committed
2839

XhmikosR's avatar
XhmikosR committed
2840
    EventHandler.on(document, EVENT_FOCUSIN, function (event) {
XhmikosR's avatar
XhmikosR committed
2841
2842
      if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
        _this4._element.focus();
XhmikosR's avatar
Dist.  
XhmikosR committed
2843
2844
      }
    });
XhmikosR's avatar
XhmikosR committed
2845
2846
2847
2848
  };

  _proto._setEscapeEvent = function _setEscapeEvent() {
    var _this5 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2849

XhmikosR's avatar
XhmikosR committed
2850
2851
    if (this._isShown) {
      EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
2852
        if (_this5._config.keyboard && event.key === ESCAPE_KEY$1) {
XhmikosR's avatar
XhmikosR committed
2853
2854
2855
          event.preventDefault();

          _this5.hide();
XhmikosR's avatar
XhmikosR committed
2856
        } else if (!_this5._config.keyboard && event.key === ESCAPE_KEY$1) {
XhmikosR's avatar
XhmikosR committed
2857
          _this5._triggerBackdropTransition();
XhmikosR's avatar
Dist.  
XhmikosR committed
2858
2859
        }
      });
2860
    } else {
XhmikosR's avatar
XhmikosR committed
2861
      EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
XhmikosR's avatar
Dist.  
XhmikosR committed
2862
    }
XhmikosR's avatar
XhmikosR committed
2863
2864
2865
2866
  };

  _proto._setResizeEvent = function _setResizeEvent() {
    var _this6 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2867
2868

    if (this._isShown) {
XhmikosR's avatar
XhmikosR committed
2869
      EventHandler.on(window, EVENT_RESIZE, function () {
2870
        return _this6._adjustDialog();
XhmikosR's avatar
XhmikosR committed
2871
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
2872
    } else {
XhmikosR's avatar
XhmikosR committed
2873
      EventHandler.off(window, EVENT_RESIZE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2874
    }
XhmikosR's avatar
XhmikosR committed
2875
2876
2877
2878
  };

  _proto._hideModal = function _hideModal() {
    var _this7 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2879
2880
2881
2882
2883
2884
2885

    this._element.style.display = 'none';

    this._element.setAttribute('aria-hidden', true);

    this._element.removeAttribute('aria-modal');

Mark Otto's avatar
Mark Otto committed
2886
2887
    this._element.removeAttribute('role');

XhmikosR's avatar
Dist.  
XhmikosR committed
2888
2889
    this._isTransitioning = false;

XhmikosR's avatar
XhmikosR committed
2890
    this._showBackdrop(function () {
XhmikosR's avatar
XhmikosR committed
2891
      document.body.classList.remove(CLASS_NAME_OPEN);
XhmikosR's avatar
Dist.  
XhmikosR committed
2892

XhmikosR's avatar
XhmikosR committed
2893
      _this7._resetAdjustments();
XhmikosR's avatar
Dist.  
XhmikosR committed
2894

XhmikosR's avatar
XhmikosR committed
2895
      _this7._resetScrollbar();
XhmikosR's avatar
Dist.  
XhmikosR committed
2896

XhmikosR's avatar
XhmikosR committed
2897
      EventHandler.trigger(_this7._element, EVENT_HIDDEN$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
2898
    });
XhmikosR's avatar
XhmikosR committed
2899
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2900

XhmikosR's avatar
XhmikosR committed
2901
  _proto._removeBackdrop = function _removeBackdrop() {
2902
    this._backdrop.parentNode.removeChild(this._backdrop);
XhmikosR's avatar
Dist.  
XhmikosR committed
2903

2904
    this._backdrop = null;
XhmikosR's avatar
XhmikosR committed
2905
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2906

XhmikosR's avatar
XhmikosR committed
2907
2908
2909
  _proto._showBackdrop = function _showBackdrop(callback) {
    var _this8 = this;

XhmikosR's avatar
XhmikosR committed
2910
    var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
XhmikosR's avatar
Dist.  
XhmikosR committed
2911
2912
2913

    if (this._isShown && this._config.backdrop) {
      this._backdrop = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
2914
      this._backdrop.className = CLASS_NAME_BACKDROP;
XhmikosR's avatar
Dist.  
XhmikosR committed
2915
2916
2917
2918
2919
2920

      if (animate) {
        this._backdrop.classList.add(animate);
      }

      document.body.appendChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
2921
      EventHandler.on(this._element, EVENT_CLICK_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
2922
2923
        if (_this8._ignoreBackdropClick) {
          _this8._ignoreBackdropClick = false;
XhmikosR's avatar
Dist.  
XhmikosR committed
2924
2925
2926
2927
2928
2929
2930
          return;
        }

        if (event.target !== event.currentTarget) {
          return;
        }

XhmikosR's avatar
XhmikosR committed
2931
        _this8._triggerBackdropTransition();
XhmikosR's avatar
Dist.  
XhmikosR committed
2932
2933
2934
2935
2936
2937
      });

      if (animate) {
        reflow(this._backdrop);
      }

XhmikosR's avatar
XhmikosR committed
2938
      this._backdrop.classList.add(CLASS_NAME_SHOW$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
2939
2940
2941
2942
2943
2944

      if (!animate) {
        callback();
        return;
      }

XhmikosR's avatar
XhmikosR committed
2945
      var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
XhmikosR's avatar
Dist.  
XhmikosR committed
2946
2947
2948
      EventHandler.one(this._backdrop, TRANSITION_END, callback);
      emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
    } else if (!this._isShown && this._backdrop) {
XhmikosR's avatar
XhmikosR committed
2949
      this._backdrop.classList.remove(CLASS_NAME_SHOW$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
2950

XhmikosR's avatar
XhmikosR committed
2951
2952
      var callbackRemove = function callbackRemove() {
        _this8._removeBackdrop();
XhmikosR's avatar
Dist.  
XhmikosR committed
2953

2954
        callback();
XhmikosR's avatar
Dist.  
XhmikosR committed
2955
2956
      };

XhmikosR's avatar
XhmikosR committed
2957
      if (this._element.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
XhmikosR committed
2958
2959
        var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);

XhmikosR's avatar
Dist.  
XhmikosR committed
2960
        EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
XhmikosR's avatar
XhmikosR committed
2961
        emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
XhmikosR's avatar
Dist.  
XhmikosR committed
2962
2963
2964
      } else {
        callbackRemove();
      }
2965
    } else {
XhmikosR's avatar
Dist.  
XhmikosR committed
2966
2967
      callback();
    }
XhmikosR's avatar
XhmikosR committed
2968
2969
2970
2971
2972
2973
  };

  _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
    var _this9 = this;

    if (this._config.backdrop === 'static') {
XhmikosR's avatar
XhmikosR committed
2974
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
XhmikosR's avatar
XhmikosR committed
2975
2976
2977
2978
2979

      if (hideEvent.defaultPrevented) {
        return;
      }

XhmikosR's avatar
XhmikosR committed
2980
2981
2982
2983
2984
2985
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;

      if (!isModalOverflowing) {
        this._element.style.overflowY = 'hidden';
      }

XhmikosR's avatar
XhmikosR committed
2986
      this._element.classList.add(CLASS_NAME_STATIC);
XhmikosR's avatar
XhmikosR committed
2987

XhmikosR's avatar
XhmikosR committed
2988
2989
      var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
      EventHandler.off(this._element, TRANSITION_END);
XhmikosR's avatar
XhmikosR committed
2990
      EventHandler.one(this._element, TRANSITION_END, function () {
XhmikosR's avatar
XhmikosR committed
2991
        _this9._element.classList.remove(CLASS_NAME_STATIC);
XhmikosR's avatar
XhmikosR committed
2992
2993
2994
2995
2996
2997
2998

        if (!isModalOverflowing) {
          EventHandler.one(_this9._element, TRANSITION_END, function () {
            _this9._element.style.overflowY = '';
          });
          emulateTransitionEnd(_this9._element, modalTransitionDuration);
        }
XhmikosR's avatar
XhmikosR committed
2999
3000
3001
3002
3003
3004
3005
      });
      emulateTransitionEnd(this._element, modalTransitionDuration);

      this._element.focus();
    } else {
      this.hide();
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
3006
3007
3008
  } // ----------------------------------------------------------------------
  // the following methods are used to handle overflowing modals
  // ----------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
3009
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
3010

XhmikosR's avatar
XhmikosR committed
3011
3012
  _proto._adjustDialog = function _adjustDialog() {
    var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
XhmikosR's avatar
Dist.  
XhmikosR committed
3013
3014

    if (!this._isBodyOverflowing && isModalOverflowing) {
XhmikosR's avatar
XhmikosR committed
3015
      this._element.style.paddingLeft = this._scrollbarWidth + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
3016
3017
3018
    }

    if (this._isBodyOverflowing && !isModalOverflowing) {
XhmikosR's avatar
XhmikosR committed
3019
      this._element.style.paddingRight = this._scrollbarWidth + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
3020
    }
XhmikosR's avatar
XhmikosR committed
3021
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3022

XhmikosR's avatar
XhmikosR committed
3023
  _proto._resetAdjustments = function _resetAdjustments() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3024
3025
    this._element.style.paddingLeft = '';
    this._element.style.paddingRight = '';
XhmikosR's avatar
XhmikosR committed
3026
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3027

XhmikosR's avatar
XhmikosR committed
3028
3029
  _proto._checkScrollbar = function _checkScrollbar() {
    var rect = document.body.getBoundingClientRect();
XhmikosR's avatar
XhmikosR committed
3030
    this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
XhmikosR's avatar
Dist.  
XhmikosR committed
3031
    this._scrollbarWidth = this._getScrollbarWidth();
XhmikosR's avatar
XhmikosR committed
3032
3033
3034
  };

  _proto._setScrollbar = function _setScrollbar() {
XhmikosR's avatar
XhmikosR committed
3035
    var _this10 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
3036
3037
3038
3039
3040

    if (this._isBodyOverflowing) {
      // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
      //   while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
      // Adjust fixed content padding
XhmikosR's avatar
XhmikosR committed
3041
      SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3042
3043
        var actualPadding = element.style.paddingRight;
        var calculatedPadding = window.getComputedStyle(element)['padding-right'];
XhmikosR's avatar
Dist.  
XhmikosR committed
3044
        Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
XhmikosR's avatar
XhmikosR committed
3045
        element.style.paddingRight = parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
3046
3047
      }); // Adjust sticky content margin

XhmikosR's avatar
XhmikosR committed
3048
      SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3049
3050
        var actualMargin = element.style.marginRight;
        var calculatedMargin = window.getComputedStyle(element)['margin-right'];
XhmikosR's avatar
Dist.  
XhmikosR committed
3051
        Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
XhmikosR's avatar
XhmikosR committed
3052
        element.style.marginRight = parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
3053
3054
      }); // Adjust body padding

XhmikosR's avatar
XhmikosR committed
3055
3056
      var actualPadding = document.body.style.paddingRight;
      var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
XhmikosR's avatar
Dist.  
XhmikosR committed
3057
      Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
XhmikosR's avatar
XhmikosR committed
3058
      document.body.style.paddingRight = parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
3059
3060
    }

XhmikosR's avatar
XhmikosR committed
3061
    document.body.classList.add(CLASS_NAME_OPEN);
XhmikosR's avatar
XhmikosR committed
3062
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3063

XhmikosR's avatar
XhmikosR committed
3064
  _proto._resetScrollbar = function _resetScrollbar() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3065
    // Restore fixed content padding
XhmikosR's avatar
XhmikosR committed
3066
    SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3067
      var padding = Manipulator.getDataAttribute(element, 'padding-right');
XhmikosR's avatar
Dist.  
XhmikosR committed
3068
3069
3070
3071
3072
3073
3074

      if (typeof padding !== 'undefined') {
        Manipulator.removeDataAttribute(element, 'padding-right');
        element.style.paddingRight = padding;
      }
    }); // Restore sticky content and navbar-toggler margin

XhmikosR's avatar
XhmikosR committed
3075
    SelectorEngine.find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3076
      var margin = Manipulator.getDataAttribute(element, 'margin-right');
XhmikosR's avatar
Dist.  
XhmikosR committed
3077
3078
3079
3080
3081
3082
3083

      if (typeof margin !== 'undefined') {
        Manipulator.removeDataAttribute(element, 'margin-right');
        element.style.marginRight = margin;
      }
    }); // Restore body padding

XhmikosR's avatar
XhmikosR committed
3084
    var padding = Manipulator.getDataAttribute(document.body, 'padding-right');
XhmikosR's avatar
Dist.  
XhmikosR committed
3085
3086
3087
3088
3089
3090
3091

    if (typeof padding === 'undefined') {
      document.body.style.paddingRight = '';
    } else {
      Manipulator.removeDataAttribute(document.body, 'padding-right');
      document.body.style.paddingRight = padding;
    }
XhmikosR's avatar
XhmikosR committed
3092
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3093

XhmikosR's avatar
XhmikosR committed
3094
  _proto._getScrollbarWidth = function _getScrollbarWidth() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3095
    // thx d.walsh
XhmikosR's avatar
XhmikosR committed
3096
    var scrollDiv = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
3097
    scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
XhmikosR's avatar
Dist.  
XhmikosR committed
3098
    document.body.appendChild(scrollDiv);
XhmikosR's avatar
XhmikosR committed
3099
    var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
XhmikosR's avatar
Dist.  
XhmikosR committed
3100
3101
3102
    document.body.removeChild(scrollDiv);
    return scrollbarWidth;
  } // Static
XhmikosR's avatar
XhmikosR committed
3103
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
3104

XhmikosR's avatar
XhmikosR committed
3105
  Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3106
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
3107
      var data = Data.getData(this, DATA_KEY$5);
XhmikosR's avatar
Dist.  
XhmikosR committed
3108

XhmikosR's avatar
XhmikosR committed
3109
      var _config = _extends({}, Default$3, Manipulator.getDataAttributes(this), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
3110
3111
3112
3113
3114
3115
3116

      if (!data) {
        data = new Modal(this, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
3117
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
3118
3119
3120
3121
3122
3123
3124
        }

        data[config](relatedTarget);
      } else if (_config.show) {
        data.show(relatedTarget);
      }
    });
XhmikosR's avatar
XhmikosR committed
3125
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3126

XhmikosR's avatar
XhmikosR committed
3127
  Modal.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3128
    return Data.getData(element, DATA_KEY$5);
XhmikosR's avatar
XhmikosR committed
3129
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3130

XhmikosR's avatar
XhmikosR committed
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
  _createClass(Modal, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$5;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$3;
    }
  }]);

  return Modal;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
3145
3146
3147
3148
3149
3150
3151
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
3152
EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
XhmikosR's avatar
XhmikosR committed
3153
  var _this11 = this;
XhmikosR's avatar
XhmikosR committed
3154

XhmikosR's avatar
XhmikosR committed
3155
  var target = getElementFromSelector(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
3156
3157
3158
3159
3160

  if (this.tagName === 'A' || this.tagName === 'AREA') {
    event.preventDefault();
  }

XhmikosR's avatar
XhmikosR committed
3161
  EventHandler.one(target, EVENT_SHOW$2, function (showEvent) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3162
3163
3164
3165
3166
    if (showEvent.defaultPrevented) {
      // only register focus restorer if modal will actually get shown
      return;
    }

XhmikosR's avatar
XhmikosR committed
3167
    EventHandler.one(target, EVENT_HIDDEN$2, function () {
XhmikosR's avatar
XhmikosR committed
3168
3169
      if (isVisible(_this11)) {
        _this11.focus();
XhmikosR's avatar
Dist.  
XhmikosR committed
3170
3171
3172
      }
    });
  });
XhmikosR's avatar
XhmikosR committed
3173
  var data = Data.getData(target, DATA_KEY$5);
XhmikosR's avatar
Dist.  
XhmikosR committed
3174
3175

  if (!data) {
XhmikosR's avatar
XhmikosR committed
3176
    var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
3177

XhmikosR's avatar
Dist.  
XhmikosR committed
3178
3179
3180
3181
3182
    data = new Modal(target, config);
  }

  data.show(this);
});
XhmikosR's avatar
XhmikosR committed
3183
var $$6 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
3184
3185
3186
3187
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
3188
 * add .modal to jQuery only if jQuery is present
XhmikosR's avatar
Dist.  
XhmikosR committed
3189
3190
 */

3191
3192
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
3193
3194
3195
3196
if ($$6) {
  var JQUERY_NO_CONFLICT$5 = $$6.fn[NAME$5];
  $$6.fn[NAME$5] = Modal.jQueryInterface;
  $$6.fn[NAME$5].Constructor = Modal;
XhmikosR's avatar
Dist.  
XhmikosR committed
3197

XhmikosR's avatar
XhmikosR committed
3198
3199
3200
  $$6.fn[NAME$5].noConflict = function () {
    $$6.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
    return Modal.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
3201
3202
3203
3204
3205
  };
}

/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
3206
 * Bootstrap (v5.0.0-alpha2): util/sanitizer.js
XhmikosR's avatar
XhmikosR committed
3207
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
3208
3209
 * --------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
3210
3211
var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
XhmikosR's avatar
Dist.  
XhmikosR committed
3212
3213
3214
3215
3216
3217
/**
 * A pattern that recognizes a commonly useful subset of URLs that are safe.
 *
 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
 */

XhmikosR's avatar
XhmikosR committed
3218
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
XhmikosR's avatar
Dist.  
XhmikosR committed
3219
3220
3221
3222
3223
3224
/**
 * A pattern that matches safe data URLs. Only matches image, video and audio types.
 *
 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
 */

XhmikosR's avatar
XhmikosR committed
3225
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
XhmikosR's avatar
Dist.  
XhmikosR committed
3226

XhmikosR's avatar
XhmikosR committed
3227
3228
var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
  var attrName = attr.nodeName.toLowerCase();
XhmikosR's avatar
Dist.  
XhmikosR committed
3229
3230
3231

  if (allowedAttributeList.indexOf(attrName) !== -1) {
    if (uriAttrs.indexOf(attrName) !== -1) {
Mark Otto's avatar
Mark Otto committed
3232
      return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
XhmikosR's avatar
Dist.  
XhmikosR committed
3233
3234
3235
3236
3237
    }

    return true;
  }

XhmikosR's avatar
XhmikosR committed
3238
3239
3240
  var regExp = allowedAttributeList.filter(function (attrRegex) {
    return attrRegex instanceof RegExp;
  }); // Check if a regular expression validates the attribute.
XhmikosR's avatar
Dist.  
XhmikosR committed
3241

XhmikosR's avatar
XhmikosR committed
3242
  for (var i = 0, len = regExp.length; i < len; i++) {
Mark Otto's avatar
Mark Otto committed
3243
    if (attrName.match(regExp[i])) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3244
3245
3246
3247
3248
3249
3250
      return true;
    }
  }

  return false;
};

XhmikosR's avatar
XhmikosR committed
3251
var DefaultAllowlist = {
XhmikosR's avatar
Dist.  
XhmikosR committed
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
  // Global attributes allowed on any supplied element below.
  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  a: ['target', 'href', 'title', 'rel'],
  area: [],
  b: [],
  br: [],
  col: [],
  code: [],
  div: [],
  em: [],
  hr: [],
  h1: [],
  h2: [],
  h3: [],
  h4: [],
  h5: [],
  h6: [],
  i: [],
XhmikosR's avatar
XhmikosR committed
3270
  img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
XhmikosR's avatar
Dist.  
XhmikosR committed
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
  li: [],
  ol: [],
  p: [],
  pre: [],
  s: [],
  small: [],
  span: [],
  sub: [],
  sup: [],
  strong: [],
  u: [],
  ul: []
};
XhmikosR's avatar
XhmikosR committed
3284
function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
XhmikosR's avatar
XhmikosR committed
3285
3286
  var _ref;

XhmikosR's avatar
Dist.  
XhmikosR committed
3287
3288
3289
3290
3291
3292
3293
3294
  if (!unsafeHtml.length) {
    return unsafeHtml;
  }

  if (sanitizeFn && typeof sanitizeFn === 'function') {
    return sanitizeFn(unsafeHtml);
  }

XhmikosR's avatar
XhmikosR committed
3295
3296
  var domParser = new window.DOMParser();
  var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
XhmikosR's avatar
XhmikosR committed
3297
  var allowlistKeys = Object.keys(allowList);
XhmikosR's avatar
XhmikosR committed
3298
3299

  var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
XhmikosR's avatar
Dist.  
XhmikosR committed
3300

XhmikosR's avatar
XhmikosR committed
3301
  var _loop = function _loop(i, len) {
XhmikosR's avatar
XhmikosR committed
3302
3303
    var _ref2;

XhmikosR's avatar
XhmikosR committed
3304
3305
    var el = elements[i];
    var elName = el.nodeName.toLowerCase();
XhmikosR's avatar
Dist.  
XhmikosR committed
3306

XhmikosR's avatar
XhmikosR committed
3307
    if (allowlistKeys.indexOf(elName) === -1) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3308
      el.parentNode.removeChild(el);
XhmikosR's avatar
XhmikosR committed
3309
      return "continue";
XhmikosR's avatar
Dist.  
XhmikosR committed
3310
3311
    }

XhmikosR's avatar
XhmikosR committed
3312
3313
    var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);

XhmikosR's avatar
XhmikosR committed
3314
    var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
XhmikosR's avatar
XhmikosR committed
3315
    attributeList.forEach(function (attr) {
XhmikosR's avatar
XhmikosR committed
3316
      if (!allowedAttribute(attr, allowedAttributes)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3317
3318
3319
        el.removeAttribute(attr.nodeName);
      }
    });
XhmikosR's avatar
XhmikosR committed
3320
3321
3322
  };

  for (var i = 0, len = elements.length; i < len; i++) {
3323
    var _ret = _loop(i);
XhmikosR's avatar
XhmikosR committed
3324
3325

    if (_ret === "continue") continue;
XhmikosR's avatar
Dist.  
XhmikosR committed
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
  }

  return createdDocument.body.innerHTML;
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
3337
var NAME$6 = 'tooltip';
XhmikosR's avatar
XhmikosR committed
3338
var VERSION$6 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
3339
3340
3341
3342
var DATA_KEY$6 = 'bs.tooltip';
var EVENT_KEY$6 = "." + DATA_KEY$6;
var CLASS_PREFIX = 'bs-tooltip';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
XhmikosR's avatar
XhmikosR committed
3343
var DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn'];
XhmikosR's avatar
XhmikosR committed
3344
var DefaultType$4 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
  animation: 'boolean',
  template: 'string',
  title: '(string|element|function)',
  trigger: 'string',
  delay: '(number|object)',
  html: 'boolean',
  selector: '(string|boolean)',
  placement: '(string|function)',
  offset: '(number|string|function)',
  container: '(string|element|boolean)',
  fallbackPlacement: '(string|array)',
  boundary: '(string|element)',
  sanitize: 'boolean',
  sanitizeFn: '(null|function)',
XhmikosR's avatar
XhmikosR committed
3359
  allowList: 'object',
XhmikosR's avatar
XhmikosR committed
3360
  popperConfig: '(null|object)'
XhmikosR's avatar
Dist.  
XhmikosR committed
3361
};
XhmikosR's avatar
XhmikosR committed
3362
var AttachmentMap = {
XhmikosR's avatar
Dist.  
XhmikosR committed
3363
3364
3365
3366
3367
3368
  AUTO: 'auto',
  TOP: 'top',
  RIGHT: 'right',
  BOTTOM: 'bottom',
  LEFT: 'left'
};
XhmikosR's avatar
XhmikosR committed
3369
var Default$4 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
  animation: true,
  template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  trigger: 'hover focus',
  title: '',
  delay: 0,
  html: false,
  selector: false,
  placement: 'top',
  offset: 0,
  container: false,
  fallbackPlacement: 'flip',
  boundary: 'scrollParent',
  sanitize: true,
  sanitizeFn: null,
XhmikosR's avatar
XhmikosR committed
3384
  allowList: DefaultAllowlist,
XhmikosR's avatar
XhmikosR committed
3385
  popperConfig: null
XhmikosR's avatar
Dist.  
XhmikosR committed
3386
};
XhmikosR's avatar
XhmikosR committed
3387
var Event$1 = {
XhmikosR's avatar
XhmikosR committed
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
  HIDE: "hide" + EVENT_KEY$6,
  HIDDEN: "hidden" + EVENT_KEY$6,
  SHOW: "show" + EVENT_KEY$6,
  SHOWN: "shown" + EVENT_KEY$6,
  INSERTED: "inserted" + EVENT_KEY$6,
  CLICK: "click" + EVENT_KEY$6,
  FOCUSIN: "focusin" + EVENT_KEY$6,
  FOCUSOUT: "focusout" + EVENT_KEY$6,
  MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  MOUSELEAVE: "mouseleave" + EVENT_KEY$6
XhmikosR's avatar
Dist.  
XhmikosR committed
3398
};
XhmikosR's avatar
XhmikosR committed
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
var CLASS_NAME_FADE$1 = 'fade';
var CLASS_NAME_MODAL = 'modal';
var CLASS_NAME_SHOW$3 = 'show';
var HOVER_STATE_SHOW = 'show';
var HOVER_STATE_OUT = 'out';
var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
var TRIGGER_HOVER = 'hover';
var TRIGGER_FOCUS = 'focus';
var TRIGGER_CLICK = 'click';
var TRIGGER_MANUAL = 'manual';
XhmikosR's avatar
XhmikosR committed
3409
3410
3411
3412
3413
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
3414

XhmikosR's avatar
XhmikosR committed
3415
var Tooltip = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
3416
  function Tooltip(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
    if (typeof Popper === 'undefined') {
      throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
    } // private


    this._isEnabled = true;
    this._timeout = 0;
    this._hoverState = '';
    this._activeTrigger = {};
    this._popper = null; // Protected

    this.element = element;
    this.config = this._getConfig(config);
    this.tip = null;

    this._setListeners();

    Data.setData(element, this.constructor.DATA_KEY, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
3438
  var _proto = Tooltip.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
3439

XhmikosR's avatar
XhmikosR committed
3440
3441
  // Public
  _proto.enable = function enable() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3442
    this._isEnabled = true;
XhmikosR's avatar
XhmikosR committed
3443
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3444

XhmikosR's avatar
XhmikosR committed
3445
  _proto.disable = function disable() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3446
    this._isEnabled = false;
XhmikosR's avatar
XhmikosR committed
3447
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3448

XhmikosR's avatar
XhmikosR committed
3449
  _proto.toggleEnabled = function toggleEnabled() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3450
    this._isEnabled = !this._isEnabled;
XhmikosR's avatar
XhmikosR committed
3451
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3452

XhmikosR's avatar
XhmikosR committed
3453
  _proto.toggle = function toggle(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3454
3455
3456
3457
3458
    if (!this._isEnabled) {
      return;
    }

    if (event) {
XhmikosR's avatar
XhmikosR committed
3459
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3460
      var context = Data.getData(event.delegateTarget, dataKey);
XhmikosR's avatar
Dist.  
XhmikosR committed
3461
3462

      if (!context) {
XhmikosR's avatar
XhmikosR committed
3463
3464
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist.  
XhmikosR committed
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
      }

      context._activeTrigger.click = !context._activeTrigger.click;

      if (context._isWithActiveTrigger()) {
        context._enter(null, context);
      } else {
        context._leave(null, context);
      }
    } else {
XhmikosR's avatar
XhmikosR committed
3475
      if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3476
3477
3478
3479
3480
3481
3482
        this._leave(null, this);

        return;
      }

      this._enter(null, this);
    }
XhmikosR's avatar
XhmikosR committed
3483
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3484

XhmikosR's avatar
XhmikosR committed
3485
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3486
3487
3488
    clearTimeout(this._timeout);
    Data.removeData(this.element, this.constructor.DATA_KEY);
    EventHandler.off(this.element, this.constructor.EVENT_KEY);
XhmikosR's avatar
XhmikosR committed
3489
    EventHandler.off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
XhmikosR's avatar
Dist.  
XhmikosR committed
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499

    if (this.tip) {
      this.tip.parentNode.removeChild(this.tip);
    }

    this._isEnabled = null;
    this._timeout = null;
    this._hoverState = null;
    this._activeTrigger = null;

XhmikosR's avatar
XhmikosR committed
3500
    if (this._popper) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3501
3502
3503
3504
3505
3506
3507
      this._popper.destroy();
    }

    this._popper = null;
    this.element = null;
    this.config = null;
    this.tip = null;
XhmikosR's avatar
XhmikosR committed
3508
3509
3510
3511
  };

  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
3512
3513
3514
3515
3516
3517

    if (this.element.style.display === 'none') {
      throw new Error('Please use show on visible elements');
    }

    if (this.isWithContent() && this._isEnabled) {
XhmikosR's avatar
XhmikosR committed
3518
3519
3520
      var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
      var shadowRoot = findShadowRoot(this.element);
      var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
XhmikosR's avatar
Dist.  
XhmikosR committed
3521
3522
3523
3524
3525

      if (showEvent.defaultPrevented || !isInTheDom) {
        return;
      }

XhmikosR's avatar
XhmikosR committed
3526
3527
      var tip = this.getTipElement();
      var tipId = getUID(this.constructor.NAME);
XhmikosR's avatar
Dist.  
XhmikosR committed
3528
3529
3530
3531
3532
      tip.setAttribute('id', tipId);
      this.element.setAttribute('aria-describedby', tipId);
      this.setContent();

      if (this.config.animation) {
XhmikosR's avatar
XhmikosR committed
3533
        tip.classList.add(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
3534
3535
      }

XhmikosR's avatar
XhmikosR committed
3536
      var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
XhmikosR's avatar
Dist.  
XhmikosR committed
3537

XhmikosR's avatar
XhmikosR committed
3538
      var attachment = this._getAttachment(placement);
XhmikosR's avatar
Dist.  
XhmikosR committed
3539

3540
      this._addAttachmentClass(attachment);
XhmikosR's avatar
Dist.  
XhmikosR committed
3541

XhmikosR's avatar
XhmikosR committed
3542
      var container = this._getContainer();
XhmikosR's avatar
Dist.  
XhmikosR committed
3543
3544
3545
3546
3547
3548
3549
3550

      Data.setData(tip, this.constructor.DATA_KEY, this);

      if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
        container.appendChild(tip);
      }

      EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
XhmikosR's avatar
XhmikosR committed
3551
      this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
XhmikosR's avatar
XhmikosR committed
3552
      tip.classList.add(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we add extra
XhmikosR's avatar
Dist.  
XhmikosR committed
3553
3554
3555
3556
3557
      // empty mouseover listeners to the body's immediate children;
      // only needed because of broken event delegation on iOS
      // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html

      if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
3558
3559
3560
        var _ref;

        (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3561
3562
3563
3564
          EventHandler.on(element, 'mouseover', noop());
        });
      }

XhmikosR's avatar
XhmikosR committed
3565
3566
3567
      var complete = function complete() {
        if (_this.config.animation) {
          _this._fixTransition();
XhmikosR's avatar
Dist.  
XhmikosR committed
3568
3569
        }

XhmikosR's avatar
XhmikosR committed
3570
3571
3572
        var prevHoverState = _this._hoverState;
        _this._hoverState = null;
        EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
XhmikosR's avatar
Dist.  
XhmikosR committed
3573

XhmikosR's avatar
XhmikosR committed
3574
        if (prevHoverState === HOVER_STATE_OUT) {
XhmikosR's avatar
XhmikosR committed
3575
          _this._leave(null, _this);
XhmikosR's avatar
Dist.  
XhmikosR committed
3576
3577
3578
        }
      };

XhmikosR's avatar
XhmikosR committed
3579
      if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
XhmikosR's avatar
XhmikosR committed
3580
        var transitionDuration = getTransitionDurationFromElement(this.tip);
XhmikosR's avatar
Dist.  
XhmikosR committed
3581
3582
3583
3584
3585
3586
        EventHandler.one(this.tip, TRANSITION_END, complete);
        emulateTransitionEnd(this.tip, transitionDuration);
      } else {
        complete();
      }
    }
XhmikosR's avatar
XhmikosR committed
3587
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3588

3589
  _proto.hide = function hide() {
XhmikosR's avatar
XhmikosR committed
3590
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
3591

XhmikosR's avatar
XhmikosR committed
3592
3593
3594
3595
    if (!this._popper) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
3596
3597
3598
    var tip = this.getTipElement();

    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
3599
      if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3600
3601
3602
        tip.parentNode.removeChild(tip);
      }

XhmikosR's avatar
XhmikosR committed
3603
3604
3605
      _this2._cleanTipClass();

      _this2.element.removeAttribute('aria-describedby');
XhmikosR's avatar
Dist.  
XhmikosR committed
3606

XhmikosR's avatar
XhmikosR committed
3607
      EventHandler.trigger(_this2.element, _this2.constructor.Event.HIDDEN);
XhmikosR's avatar
Dist.  
XhmikosR committed
3608

3609
      _this2._popper.destroy();
XhmikosR's avatar
Dist.  
XhmikosR committed
3610
3611
    };

XhmikosR's avatar
XhmikosR committed
3612
    var hideEvent = EventHandler.trigger(this.element, this.constructor.Event.HIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
3613
3614
3615
3616
3617

    if (hideEvent.defaultPrevented) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
3618
    tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
XhmikosR's avatar
Dist.  
XhmikosR committed
3619
3620
3621
    // empty mouseover listeners we added for iOS support

    if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
3622
3623
3624
      var _ref2;

      (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3625
3626
        return EventHandler.off(element, 'mouseover', noop);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
3627
3628
    }

XhmikosR's avatar
XhmikosR committed
3629
3630
3631
    this._activeTrigger[TRIGGER_CLICK] = false;
    this._activeTrigger[TRIGGER_FOCUS] = false;
    this._activeTrigger[TRIGGER_HOVER] = false;
XhmikosR's avatar
Dist.  
XhmikosR committed
3632

XhmikosR's avatar
XhmikosR committed
3633
    if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
XhmikosR's avatar
XhmikosR committed
3634
      var transitionDuration = getTransitionDurationFromElement(tip);
XhmikosR's avatar
Dist.  
XhmikosR committed
3635
3636
3637
3638
3639
3640
3641
      EventHandler.one(tip, TRANSITION_END, complete);
      emulateTransitionEnd(tip, transitionDuration);
    } else {
      complete();
    }

    this._hoverState = '';
XhmikosR's avatar
XhmikosR committed
3642
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3643

XhmikosR's avatar
XhmikosR committed
3644
  _proto.update = function update() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3645
3646
3647
3648
    if (this._popper !== null) {
      this._popper.scheduleUpdate();
    }
  } // Protected
XhmikosR's avatar
XhmikosR committed
3649
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
3650

XhmikosR's avatar
XhmikosR committed
3651
  _proto.isWithContent = function isWithContent() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3652
    return Boolean(this.getTitle());
XhmikosR's avatar
XhmikosR committed
3653
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3654

XhmikosR's avatar
XhmikosR committed
3655
  _proto.getTipElement = function getTipElement() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3656
3657
3658
3659
    if (this.tip) {
      return this.tip;
    }

XhmikosR's avatar
XhmikosR committed
3660
    var element = document.createElement('div');
XhmikosR's avatar
Dist.  
XhmikosR committed
3661
3662
3663
    element.innerHTML = this.config.template;
    this.tip = element.children[0];
    return this.tip;
XhmikosR's avatar
XhmikosR committed
3664
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3665

XhmikosR's avatar
XhmikosR committed
3666
3667
  _proto.setContent = function setContent() {
    var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
3668
    this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
XhmikosR's avatar
XhmikosR committed
3669
    tip.classList.remove(CLASS_NAME_FADE$1, CLASS_NAME_SHOW$3);
XhmikosR's avatar
XhmikosR committed
3670
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3671

XhmikosR's avatar
XhmikosR committed
3672
  _proto.setElementContent = function setElementContent(element, content) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3673
3674
3675
3676
    if (element === null) {
      return;
    }

3677
    if (typeof content === 'object' && isElement(content)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
      if (content.jquery) {
        content = content[0];
      } // content is a DOM node or a jQuery


      if (this.config.html) {
        if (content.parentNode !== element) {
          element.innerHTML = '';
          element.appendChild(content);
        }
      } else {
XhmikosR's avatar
XhmikosR committed
3689
        element.textContent = content.textContent;
XhmikosR's avatar
Dist.  
XhmikosR committed
3690
3691
3692
3693
3694
3695
3696
      }

      return;
    }

    if (this.config.html) {
      if (this.config.sanitize) {
XhmikosR's avatar
XhmikosR committed
3697
        content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
XhmikosR's avatar
Dist.  
XhmikosR committed
3698
3699
3700
3701
      }

      element.innerHTML = content;
    } else {
XhmikosR's avatar
XhmikosR committed
3702
      element.textContent = content;
XhmikosR's avatar
Dist.  
XhmikosR committed
3703
    }
XhmikosR's avatar
XhmikosR committed
3704
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3705

XhmikosR's avatar
XhmikosR committed
3706
3707
  _proto.getTitle = function getTitle() {
    var title = this.element.getAttribute('data-original-title');
XhmikosR's avatar
Dist.  
XhmikosR committed
3708
3709
3710
3711
3712
3713
3714

    if (!title) {
      title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
    }

    return title;
  } // Private
XhmikosR's avatar
XhmikosR committed
3715
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
3716

XhmikosR's avatar
XhmikosR committed
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
  _proto._getPopperConfig = function _getPopperConfig(attachment) {
    var _this3 = this;

    var defaultBsConfig = {
      placement: attachment,
      modifiers: {
        offset: this._getOffset(),
        flip: {
          behavior: this.config.fallbackPlacement
        },
        arrow: {
          element: "." + this.constructor.NAME + "-arrow"
        },
        preventOverflow: {
          boundariesElement: this.config.boundary
        }
      },
      onCreate: function onCreate(data) {
        if (data.originalPlacement !== data.placement) {
          _this3._handlePopperPlacementChange(data);
        }
      },
      onUpdate: function onUpdate(data) {
        return _this3._handlePopperPlacementChange(data);
      }
    };
XhmikosR's avatar
XhmikosR committed
3743
    return _extends({}, defaultBsConfig, this.config.popperConfig);
XhmikosR's avatar
XhmikosR committed
3744
3745
  };

3746
3747
3748
3749
  _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
    this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
  };

XhmikosR's avatar
XhmikosR committed
3750
  _proto._getOffset = function _getOffset() {
XhmikosR's avatar
XhmikosR committed
3751
    var _this4 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
3752

XhmikosR's avatar
XhmikosR committed
3753
    var offset = {};
XhmikosR's avatar
Dist.  
XhmikosR committed
3754
3755

    if (typeof this.config.offset === 'function') {
XhmikosR's avatar
XhmikosR committed
3756
      offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
3757
        data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
XhmikosR's avatar
Dist.  
XhmikosR committed
3758
3759
3760
3761
3762
3763
3764
        return data;
      };
    } else {
      offset.offset = this.config.offset;
    }

    return offset;
XhmikosR's avatar
XhmikosR committed
3765
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3766

XhmikosR's avatar
XhmikosR committed
3767
  _proto._getContainer = function _getContainer() {
XhmikosR's avatar
Dist.  
XhmikosR committed
3768
3769
3770
3771
3772
3773
3774
3775
3776
    if (this.config.container === false) {
      return document.body;
    }

    if (isElement(this.config.container)) {
      return this.config.container;
    }

    return SelectorEngine.findOne(this.config.container);
XhmikosR's avatar
XhmikosR committed
3777
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3778

XhmikosR's avatar
XhmikosR committed
3779
  _proto._getAttachment = function _getAttachment(placement) {
XhmikosR's avatar
XhmikosR committed
3780
    return AttachmentMap[placement.toUpperCase()];
XhmikosR's avatar
XhmikosR committed
3781
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3782

XhmikosR's avatar
XhmikosR committed
3783
  _proto._setListeners = function _setListeners() {
XhmikosR's avatar
XhmikosR committed
3784
    var _this5 = this;
XhmikosR's avatar
XhmikosR committed
3785
3786
3787

    var triggers = this.config.trigger.split(' ');
    triggers.forEach(function (trigger) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3788
      if (trigger === 'click') {
XhmikosR's avatar
XhmikosR committed
3789
3790
        EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
          return _this5.toggle(event);
XhmikosR's avatar
XhmikosR committed
3791
        });
XhmikosR's avatar
XhmikosR committed
3792
3793
3794
      } else if (trigger !== TRIGGER_MANUAL) {
        var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
        var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
XhmikosR's avatar
XhmikosR committed
3795
3796
        EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
          return _this5._enter(event);
XhmikosR's avatar
XhmikosR committed
3797
        });
XhmikosR's avatar
XhmikosR committed
3798
3799
        EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
          return _this5._leave(event);
XhmikosR's avatar
XhmikosR committed
3800
        });
XhmikosR's avatar
Dist.  
XhmikosR committed
3801
3802
      }
    });
Mark Otto's avatar
dist v5    
Mark Otto committed
3803
3804

    this._hideModalHandler = function () {
XhmikosR's avatar
XhmikosR committed
3805
3806
      if (_this5.element) {
        _this5.hide();
XhmikosR's avatar
Dist.  
XhmikosR committed
3807
      }
Mark Otto's avatar
dist v5    
Mark Otto committed
3808
3809
    };

XhmikosR's avatar
XhmikosR committed
3810
    EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
XhmikosR's avatar
Dist.  
XhmikosR committed
3811
3812

    if (this.config.selector) {
XhmikosR's avatar
XhmikosR committed
3813
      this.config = _extends({}, this.config, {
XhmikosR's avatar
Dist.  
XhmikosR committed
3814
3815
3816
3817
3818
3819
        trigger: 'manual',
        selector: ''
      });
    } else {
      this._fixTitle();
    }
XhmikosR's avatar
XhmikosR committed
3820
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3821

XhmikosR's avatar
XhmikosR committed
3822
3823
  _proto._fixTitle = function _fixTitle() {
    var titleType = typeof this.element.getAttribute('data-original-title');
XhmikosR's avatar
Dist.  
XhmikosR committed
3824
3825
3826
3827
3828

    if (this.element.getAttribute('title') || titleType !== 'string') {
      this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
      this.element.setAttribute('title', '');
    }
XhmikosR's avatar
XhmikosR committed
3829
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3830

XhmikosR's avatar
XhmikosR committed
3831
3832
  _proto._enter = function _enter(event, context) {
    var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3833
    context = context || Data.getData(event.delegateTarget, dataKey);
XhmikosR's avatar
Dist.  
XhmikosR committed
3834
3835

    if (!context) {
XhmikosR's avatar
XhmikosR committed
3836
3837
      context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
      Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist.  
XhmikosR committed
3838
3839
3840
    }

    if (event) {
XhmikosR's avatar
XhmikosR committed
3841
      context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
XhmikosR's avatar
Dist.  
XhmikosR committed
3842
3843
    }

XhmikosR's avatar
XhmikosR committed
3844
3845
    if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
      context._hoverState = HOVER_STATE_SHOW;
XhmikosR's avatar
Dist.  
XhmikosR committed
3846
3847
3848
3849
      return;
    }

    clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
3850
    context._hoverState = HOVER_STATE_SHOW;
XhmikosR's avatar
Dist.  
XhmikosR committed
3851
3852
3853
3854
3855
3856

    if (!context.config.delay || !context.config.delay.show) {
      context.show();
      return;
    }

XhmikosR's avatar
XhmikosR committed
3857
    context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
3858
      if (context._hoverState === HOVER_STATE_SHOW) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3859
3860
3861
        context.show();
      }
    }, context.config.delay.show);
XhmikosR's avatar
XhmikosR committed
3862
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3863

XhmikosR's avatar
XhmikosR committed
3864
3865
  _proto._leave = function _leave(event, context) {
    var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3866
    context = context || Data.getData(event.delegateTarget, dataKey);
XhmikosR's avatar
Dist.  
XhmikosR committed
3867
3868

    if (!context) {
XhmikosR's avatar
XhmikosR committed
3869
3870
      context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
      Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist.  
XhmikosR committed
3871
3872
3873
    }

    if (event) {
XhmikosR's avatar
XhmikosR committed
3874
      context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
XhmikosR's avatar
Dist.  
XhmikosR committed
3875
3876
3877
3878
3879
3880
3881
    }

    if (context._isWithActiveTrigger()) {
      return;
    }

    clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
3882
    context._hoverState = HOVER_STATE_OUT;
XhmikosR's avatar
Dist.  
XhmikosR committed
3883
3884
3885
3886
3887
3888

    if (!context.config.delay || !context.config.delay.hide) {
      context.hide();
      return;
    }

XhmikosR's avatar
XhmikosR committed
3889
    context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
3890
      if (context._hoverState === HOVER_STATE_OUT) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3891
3892
3893
        context.hide();
      }
    }, context.config.delay.hide);
XhmikosR's avatar
XhmikosR committed
3894
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3895

XhmikosR's avatar
XhmikosR committed
3896
3897
  _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
    for (var trigger in this._activeTrigger) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3898
3899
3900
3901
3902
3903
      if (this._activeTrigger[trigger]) {
        return true;
      }
    }

    return false;
XhmikosR's avatar
XhmikosR committed
3904
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3905

XhmikosR's avatar
XhmikosR committed
3906
3907
3908
  _proto._getConfig = function _getConfig(config) {
    var dataAttributes = Manipulator.getDataAttributes(this.element);
    Object.keys(dataAttributes).forEach(function (dataAttr) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3909
3910
3911
3912
3913
3914
3915
3916
3917
      if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
        delete dataAttributes[dataAttr];
      }
    });

    if (config && typeof config.container === 'object' && config.container.jquery) {
      config.container = config.container[0];
    }

XhmikosR's avatar
XhmikosR committed
3918
    config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937

    if (typeof config.delay === 'number') {
      config.delay = {
        show: config.delay,
        hide: config.delay
      };
    }

    if (typeof config.title === 'number') {
      config.title = config.title.toString();
    }

    if (typeof config.content === 'number') {
      config.content = config.content.toString();
    }

    typeCheckConfig(NAME$6, config, this.constructor.DefaultType);

    if (config.sanitize) {
XhmikosR's avatar
XhmikosR committed
3938
      config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
XhmikosR's avatar
Dist.  
XhmikosR committed
3939
3940
3941
    }

    return config;
XhmikosR's avatar
XhmikosR committed
3942
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3943

XhmikosR's avatar
XhmikosR committed
3944
3945
  _proto._getDelegateConfig = function _getDelegateConfig() {
    var config = {};
XhmikosR's avatar
Dist.  
XhmikosR committed
3946
3947

    if (this.config) {
XhmikosR's avatar
XhmikosR committed
3948
      for (var key in this.config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3949
3950
3951
3952
3953
3954
3955
        if (this.constructor.Default[key] !== this.config[key]) {
          config[key] = this.config[key];
        }
      }
    }

    return config;
XhmikosR's avatar
XhmikosR committed
3956
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3957

XhmikosR's avatar
XhmikosR committed
3958
3959
3960
  _proto._cleanTipClass = function _cleanTipClass() {
    var tip = this.getTipElement();
    var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
XhmikosR's avatar
Dist.  
XhmikosR committed
3961

XhmikosR's avatar
XhmikosR committed
3962
    if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
3963
3964
3965
3966
3967
      tabClass.map(function (token) {
        return token.trim();
      }).forEach(function (tClass) {
        return tip.classList.remove(tClass);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
3968
    }
XhmikosR's avatar
XhmikosR committed
3969
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3970

XhmikosR's avatar
XhmikosR committed
3971
  _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
XhmikosR's avatar
XhmikosR committed
3972
    this.tip = popperData.instance.popper;
XhmikosR's avatar
Dist.  
XhmikosR committed
3973
3974
3975

    this._cleanTipClass();

3976
    this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
XhmikosR committed
3977
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
3978

XhmikosR's avatar
XhmikosR committed
3979
3980
3981
  _proto._fixTransition = function _fixTransition() {
    var tip = this.getTipElement();
    var initConfigAnimation = this.config.animation;
XhmikosR's avatar
Dist.  
XhmikosR committed
3982
3983
3984
3985
3986

    if (tip.getAttribute('x-placement') !== null) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
3987
    tip.classList.remove(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
3988
3989
3990
3991
3992
    this.config.animation = false;
    this.hide();
    this.show();
    this.config.animation = initConfigAnimation;
  } // Static
XhmikosR's avatar
XhmikosR committed
3993
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
3994

XhmikosR's avatar
XhmikosR committed
3995
  Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
3996
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
3997
      var data = Data.getData(this, DATA_KEY$6);
XhmikosR's avatar
Dist.  
XhmikosR committed
3998

XhmikosR's avatar
XhmikosR committed
3999
      var _config = typeof config === 'object' && config;
XhmikosR's avatar
Dist.  
XhmikosR committed
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010

      if (!data && /dispose|hide/.test(config)) {
        return;
      }

      if (!data) {
        data = new Tooltip(this, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4011
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4012
4013
4014
4015
4016
        }

        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
4017
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4018

XhmikosR's avatar
XhmikosR committed
4019
  Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4020
    return Data.getData(element, DATA_KEY$6);
XhmikosR's avatar
XhmikosR committed
4021
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4022

XhmikosR's avatar
XhmikosR committed
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
  _createClass(Tooltip, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$6;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$4;
    }
  }, {
    key: "NAME",
    get: function get() {
      return NAME$6;
    }
  }, {
    key: "DATA_KEY",
    get: function get() {
      return DATA_KEY$6;
    }
  }, {
    key: "Event",
    get: function get() {
XhmikosR's avatar
XhmikosR committed
4046
      return Event$1;
XhmikosR's avatar
XhmikosR committed
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
    }
  }, {
    key: "EVENT_KEY",
    get: function get() {
      return EVENT_KEY$6;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$4;
    }
  }]);

  return Tooltip;
}();
XhmikosR's avatar
XhmikosR committed
4062
4063

var $$7 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
4064
4065
4066
4067
4068
4069
4070
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .tooltip to jQuery only if jQuery is present
 */

4071
4072
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4073
4074
4075
4076
if ($$7) {
  var JQUERY_NO_CONFLICT$6 = $$7.fn[NAME$6];
  $$7.fn[NAME$6] = Tooltip.jQueryInterface;
  $$7.fn[NAME$6].Constructor = Tooltip;
XhmikosR's avatar
Dist.  
XhmikosR committed
4077

XhmikosR's avatar
XhmikosR committed
4078
4079
4080
  $$7.fn[NAME$6].noConflict = function () {
    $$7.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
    return Tooltip.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
4081
4082
4083
4084
4085
4086
4087
4088
4089
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
4090
var NAME$7 = 'popover';
XhmikosR's avatar
XhmikosR committed
4091
var VERSION$7 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
4092
4093
4094
4095
var DATA_KEY$7 = 'bs.popover';
var EVENT_KEY$7 = "." + DATA_KEY$7;
var CLASS_PREFIX$1 = 'bs-popover';
var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
XhmikosR's avatar
Dist.  
XhmikosR committed
4096

XhmikosR's avatar
XhmikosR committed
4097
var Default$5 = _extends({}, Tooltip.Default, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4098
4099
4100
4101
4102
4103
  placement: 'right',
  trigger: 'click',
  content: '',
  template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
});

XhmikosR's avatar
XhmikosR committed
4104
var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4105
4106
4107
  content: '(string|element|function)'
});

XhmikosR's avatar
XhmikosR committed
4108
var Event$2 = {
XhmikosR's avatar
XhmikosR committed
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
  HIDE: "hide" + EVENT_KEY$7,
  HIDDEN: "hidden" + EVENT_KEY$7,
  SHOW: "show" + EVENT_KEY$7,
  SHOWN: "shown" + EVENT_KEY$7,
  INSERTED: "inserted" + EVENT_KEY$7,
  CLICK: "click" + EVENT_KEY$7,
  FOCUSIN: "focusin" + EVENT_KEY$7,
  FOCUSOUT: "focusout" + EVENT_KEY$7,
  MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  MOUSELEAVE: "mouseleave" + EVENT_KEY$7
XhmikosR's avatar
Dist.  
XhmikosR committed
4119
};
XhmikosR's avatar
XhmikosR committed
4120
4121
4122
4123
var CLASS_NAME_FADE$2 = 'fade';
var CLASS_NAME_SHOW$4 = 'show';
var SELECTOR_TITLE = '.popover-header';
var SELECTOR_CONTENT = '.popover-body';
XhmikosR's avatar
XhmikosR committed
4124
4125
4126
4127
4128
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
4129

XhmikosR's avatar
XhmikosR committed
4130
var Popover = /*#__PURE__*/function (_Tooltip) {
XhmikosR's avatar
XhmikosR committed
4131
  _inheritsLoose(Popover, _Tooltip);
XhmikosR's avatar
Dist.  
XhmikosR committed
4132

XhmikosR's avatar
XhmikosR committed
4133
4134
  function Popover() {
    return _Tooltip.apply(this, arguments) || this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4135
4136
  }

XhmikosR's avatar
XhmikosR committed
4137
  var _proto = Popover.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
4138

XhmikosR's avatar
XhmikosR committed
4139
4140
  // Overrides
  _proto.isWithContent = function isWithContent() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4141
    return this.getTitle() || this._getContent();
XhmikosR's avatar
XhmikosR committed
4142
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4143

XhmikosR's avatar
XhmikosR committed
4144
4145
  _proto.setContent = function setContent() {
    var tip = this.getTipElement(); // we use append for html objects to maintain js events
XhmikosR's avatar
Dist.  
XhmikosR committed
4146

XhmikosR's avatar
XhmikosR committed
4147
    this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
XhmikosR's avatar
Dist.  
XhmikosR committed
4148

XhmikosR's avatar
XhmikosR committed
4149
    var content = this._getContent();
XhmikosR's avatar
Dist.  
XhmikosR committed
4150
4151
4152
4153
4154

    if (typeof content === 'function') {
      content = content.call(this.element);
    }

XhmikosR's avatar
XhmikosR committed
4155
    this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
XhmikosR's avatar
XhmikosR committed
4156
    tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4);
XhmikosR's avatar
XhmikosR committed
4157
4158
  } // Private
  ;
XhmikosR's avatar
XhmikosR committed
4159
4160
4161

  _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
    this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment);
XhmikosR's avatar
XhmikosR committed
4162
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4163

XhmikosR's avatar
XhmikosR committed
4164
  _proto._getContent = function _getContent() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4165
    return this.element.getAttribute('data-content') || this.config.content;
XhmikosR's avatar
XhmikosR committed
4166
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4167

XhmikosR's avatar
XhmikosR committed
4168
4169
4170
  _proto._cleanTipClass = function _cleanTipClass() {
    var tip = this.getTipElement();
    var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
4171
4172

    if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
4173
4174
4175
4176
4177
      tabClass.map(function (token) {
        return token.trim();
      }).forEach(function (tClass) {
        return tip.classList.remove(tClass);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
4178
4179
    }
  } // Static
XhmikosR's avatar
XhmikosR committed
4180
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4181

XhmikosR's avatar
XhmikosR committed
4182
  Popover.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4183
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4184
      var data = Data.getData(this, DATA_KEY$7);
XhmikosR's avatar
Dist.  
XhmikosR committed
4185

XhmikosR's avatar
XhmikosR committed
4186
      var _config = typeof config === 'object' ? config : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198

      if (!data && /dispose|hide/.test(config)) {
        return;
      }

      if (!data) {
        data = new Popover(this, _config);
        Data.setData(this, DATA_KEY$7, data);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4199
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4200
4201
4202
4203
4204
        }

        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
4205
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4206

XhmikosR's avatar
XhmikosR committed
4207
  Popover.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4208
    return Data.getData(element, DATA_KEY$7);
XhmikosR's avatar
XhmikosR committed
4209
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4210

XhmikosR's avatar
XhmikosR committed
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
  _createClass(Popover, null, [{
    key: "VERSION",
    // Getters
    get: function get() {
      return VERSION$7;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$5;
    }
  }, {
    key: "NAME",
    get: function get() {
      return NAME$7;
    }
  }, {
    key: "DATA_KEY",
    get: function get() {
      return DATA_KEY$7;
    }
  }, {
    key: "Event",
    get: function get() {
XhmikosR's avatar
XhmikosR committed
4235
      return Event$2;
XhmikosR's avatar
XhmikosR committed
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
    }
  }, {
    key: "EVENT_KEY",
    get: function get() {
      return EVENT_KEY$7;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$5;
    }
  }]);

  return Popover;
}(Tooltip);
XhmikosR's avatar
XhmikosR committed
4251
4252

var $$8 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
4253
4254
4255
4256
4257
4258
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 */

4259
4260
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4261
4262
4263
4264
if ($$8) {
  var JQUERY_NO_CONFLICT$7 = $$8.fn[NAME$7];
  $$8.fn[NAME$7] = Popover.jQueryInterface;
  $$8.fn[NAME$7].Constructor = Popover;
XhmikosR's avatar
Dist.  
XhmikosR committed
4265

XhmikosR's avatar
XhmikosR committed
4266
4267
4268
  $$8.fn[NAME$7].noConflict = function () {
    $$8.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
    return Popover.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
4269
4270
4271
4272
4273
4274
4275
4276
4277
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
4278
var NAME$8 = 'scrollspy';
XhmikosR's avatar
XhmikosR committed
4279
var VERSION$8 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
4280
4281
4282
4283
var DATA_KEY$8 = 'bs.scrollspy';
var EVENT_KEY$8 = "." + DATA_KEY$8;
var DATA_API_KEY$6 = '.data-api';
var Default$6 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
4284
4285
4286
4287
  offset: 10,
  method: 'auto',
  target: ''
};
XhmikosR's avatar
XhmikosR committed
4288
var DefaultType$6 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
4289
4290
4291
4292
  offset: 'number',
  method: 'string',
  target: '(string|element)'
};
XhmikosR's avatar
XhmikosR committed
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
var CLASS_NAME_ACTIVE$2 = 'active';
var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
var SELECTOR_NAV_LINKS = '.nav-link';
var SELECTOR_NAV_ITEMS = '.nav-item';
var SELECTOR_LIST_ITEMS = '.list-group-item';
var SELECTOR_DROPDOWN = '.dropdown';
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
var METHOD_OFFSET = 'offset';
var METHOD_POSITION = 'position';
XhmikosR's avatar
XhmikosR committed
4307
4308
4309
4310
4311
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
4312

XhmikosR's avatar
XhmikosR committed
4313
var ScrollSpy = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
4314
4315
4316
  function ScrollSpy(element, config) {
    var _this = this;

XhmikosR's avatar
Dist.  
XhmikosR committed
4317
4318
4319
    this._element = element;
    this._scrollElement = element.tagName === 'BODY' ? window : element;
    this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
4320
    this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + ", " + this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM;
XhmikosR's avatar
Dist.  
XhmikosR committed
4321
4322
4323
4324
    this._offsets = [];
    this._targets = [];
    this._activeTarget = null;
    this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
4325
    EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) {
XhmikosR's avatar
XhmikosR committed
4326
4327
      return _this._process(event);
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
4328
4329
4330
4331
4332
4333
4334
4335
    this.refresh();

    this._process();

    Data.setData(element, DATA_KEY$8, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
4336
  var _proto = ScrollSpy.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
4337

XhmikosR's avatar
XhmikosR committed
4338
4339
4340
  // Public
  _proto.refresh = function refresh() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4341

XhmikosR's avatar
XhmikosR committed
4342
    var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
XhmikosR's avatar
XhmikosR committed
4343
    var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
XhmikosR's avatar
XhmikosR committed
4344
    var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
XhmikosR's avatar
Dist.  
XhmikosR committed
4345
4346
4347
    this._offsets = [];
    this._targets = [];
    this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
4348
    var targets = SelectorEngine.find(this._selector);
XhmikosR's avatar
XhmikosR committed
4349
4350
    targets.map(function (element) {
      var targetSelector = getSelectorFromElement(element);
XhmikosR's avatar
XhmikosR committed
4351
      var target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
4352
4353

      if (target) {
XhmikosR's avatar
XhmikosR committed
4354
        var targetBCR = target.getBoundingClientRect();
XhmikosR's avatar
Dist.  
XhmikosR committed
4355
4356
4357
4358
4359
4360
4361

        if (targetBCR.width || targetBCR.height) {
          return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
        }
      }

      return null;
XhmikosR's avatar
XhmikosR committed
4362
4363
4364
4365
4366
4367
4368
4369
    }).filter(function (item) {
      return item;
    }).sort(function (a, b) {
      return a[0] - b[0];
    }).forEach(function (item) {
      _this2._offsets.push(item[0]);

      _this2._targets.push(item[1]);
XhmikosR's avatar
Dist.  
XhmikosR committed
4370
    });
XhmikosR's avatar
XhmikosR committed
4371
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4372

XhmikosR's avatar
XhmikosR committed
4373
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
    Data.removeData(this._element, DATA_KEY$8);
    EventHandler.off(this._scrollElement, EVENT_KEY$8);
    this._element = null;
    this._scrollElement = null;
    this._config = null;
    this._selector = null;
    this._offsets = null;
    this._targets = null;
    this._activeTarget = null;
    this._scrollHeight = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
4385
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4386

XhmikosR's avatar
XhmikosR committed
4387
  _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4388
    config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
4389

XhmikosR's avatar
XhmikosR committed
4390
    if (typeof config.target !== 'string' && isElement(config.target)) {
XhmikosR's avatar
XhmikosR committed
4391
      var id = config.target.id;
XhmikosR's avatar
Dist.  
XhmikosR committed
4392
4393
4394
4395
4396
4397

      if (!id) {
        id = getUID(NAME$8);
        config.target.id = id;
      }

XhmikosR's avatar
XhmikosR committed
4398
      config.target = "#" + id;
XhmikosR's avatar
Dist.  
XhmikosR committed
4399
4400
4401
4402
    }

    typeCheckConfig(NAME$8, config, DefaultType$6);
    return config;
XhmikosR's avatar
XhmikosR committed
4403
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4404

XhmikosR's avatar
XhmikosR committed
4405
  _proto._getScrollTop = function _getScrollTop() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4406
    return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
XhmikosR's avatar
XhmikosR committed
4407
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4408

XhmikosR's avatar
XhmikosR committed
4409
  _proto._getScrollHeight = function _getScrollHeight() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4410
    return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
XhmikosR's avatar
XhmikosR committed
4411
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4412

XhmikosR's avatar
XhmikosR committed
4413
  _proto._getOffsetHeight = function _getOffsetHeight() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4414
    return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
XhmikosR's avatar
XhmikosR committed
4415
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4416

XhmikosR's avatar
XhmikosR committed
4417
4418
  _proto._process = function _process() {
    var scrollTop = this._getScrollTop() + this._config.offset;
XhmikosR's avatar
Dist.  
XhmikosR committed
4419

XhmikosR's avatar
XhmikosR committed
4420
    var scrollHeight = this._getScrollHeight();
XhmikosR's avatar
Dist.  
XhmikosR committed
4421

XhmikosR's avatar
XhmikosR committed
4422
    var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
XhmikosR's avatar
Dist.  
XhmikosR committed
4423
4424
4425
4426
4427
4428

    if (this._scrollHeight !== scrollHeight) {
      this.refresh();
    }

    if (scrollTop >= maxScroll) {
XhmikosR's avatar
XhmikosR committed
4429
      var target = this._targets[this._targets.length - 1];
XhmikosR's avatar
Dist.  
XhmikosR committed
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445

      if (this._activeTarget !== target) {
        this._activate(target);
      }

      return;
    }

    if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
      this._activeTarget = null;

      this._clear();

      return;
    }

XhmikosR's avatar
XhmikosR committed
4446
    for (var i = this._offsets.length; i--;) {
XhmikosR's avatar
XhmikosR committed
4447
      var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
XhmikosR's avatar
Dist.  
XhmikosR committed
4448
4449
4450
4451
4452

      if (isActiveTarget) {
        this._activate(this._targets[i]);
      }
    }
XhmikosR's avatar
XhmikosR committed
4453
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4454

XhmikosR's avatar
XhmikosR committed
4455
  _proto._activate = function _activate(target) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4456
4457
4458
4459
    this._activeTarget = target;

    this._clear();

XhmikosR's avatar
XhmikosR committed
4460
4461
4462
    var queries = this._selector.split(',').map(function (selector) {
      return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
4463

XhmikosR's avatar
XhmikosR committed
4464
    var link = SelectorEngine.findOne(queries.join(','));
XhmikosR's avatar
Dist.  
XhmikosR committed
4465

XhmikosR's avatar
XhmikosR committed
4466
    if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
XhmikosR's avatar
XhmikosR committed
4467
      SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4468
      link.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
4469
4470
    } else {
      // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
4471
4472
      link.classList.add(CLASS_NAME_ACTIVE$2);
      SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach(function (listGroup) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4473
4474
        // Set triggered links parents as active
        // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
XhmikosR's avatar
XhmikosR committed
4475
4476
        SelectorEngine.prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) {
          return item.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4477
        }); // Handle special case when .nav-link is inside .nav-item
XhmikosR's avatar
Dist.  
XhmikosR committed
4478

XhmikosR's avatar
XhmikosR committed
4479
4480
4481
        SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) {
          SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) {
            return item.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4482
          });
XhmikosR's avatar
Dist.  
XhmikosR committed
4483
4484
4485
4486
        });
      });
    }

XhmikosR's avatar
XhmikosR committed
4487
    EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4488
4489
      relatedTarget: target
    });
XhmikosR's avatar
XhmikosR committed
4490
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4491

XhmikosR's avatar
XhmikosR committed
4492
  _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
4493
4494
    SelectorEngine.find(this._selector).filter(function (node) {
      return node.classList.contains(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4495
    }).forEach(function (node) {
XhmikosR's avatar
XhmikosR committed
4496
      return node.classList.remove(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4497
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
4498
  } // Static
XhmikosR's avatar
XhmikosR committed
4499
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4500

XhmikosR's avatar
XhmikosR committed
4501
  ScrollSpy.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4502
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4503
      var data = Data.getData(this, DATA_KEY$8);
XhmikosR's avatar
Dist.  
XhmikosR committed
4504

XhmikosR's avatar
XhmikosR committed
4505
      var _config = typeof config === 'object' && config;
XhmikosR's avatar
Dist.  
XhmikosR committed
4506
4507
4508
4509
4510
4511
4512

      if (!data) {
        data = new ScrollSpy(this, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4513
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4514
4515
4516
4517
4518
        }

        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
4519
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4520

XhmikosR's avatar
XhmikosR committed
4521
  ScrollSpy.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4522
    return Data.getData(element, DATA_KEY$8);
XhmikosR's avatar
XhmikosR committed
4523
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4524

XhmikosR's avatar
XhmikosR committed
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
  _createClass(ScrollSpy, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$8;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$6;
    }
  }]);

  return ScrollSpy;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
4539
4540
4541
4542
4543
4544
4545
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
4546
4547
EventHandler.on(window, EVENT_LOAD_DATA_API$1, function () {
  SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) {
XhmikosR's avatar
XhmikosR committed
4548
4549
    return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
  });
XhmikosR's avatar
Dist.  
XhmikosR committed
4550
});
XhmikosR's avatar
XhmikosR committed
4551
var $$9 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
4552
4553
4554
4555
4556
4557
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 */

4558
4559
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4560
4561
4562
4563
if ($$9) {
  var JQUERY_NO_CONFLICT$8 = $$9.fn[NAME$8];
  $$9.fn[NAME$8] = ScrollSpy.jQueryInterface;
  $$9.fn[NAME$8].Constructor = ScrollSpy;
XhmikosR's avatar
Dist.  
XhmikosR committed
4564

XhmikosR's avatar
XhmikosR committed
4565
4566
4567
  $$9.fn[NAME$8].noConflict = function () {
    $$9.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
    return ScrollSpy.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
4568
4569
4570
4571
4572
4573
4574
4575
4576
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
4577
var NAME$9 = 'tab';
XhmikosR's avatar
XhmikosR committed
4578
var VERSION$9 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
4579
4580
4581
var DATA_KEY$9 = 'bs.tab';
var EVENT_KEY$9 = "." + DATA_KEY$9;
var DATA_API_KEY$7 = '.data-api';
XhmikosR's avatar
XhmikosR committed
4582
4583
4584
4585
4586
4587
4588
var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
var CLASS_NAME_ACTIVE$3 = 'active';
XhmikosR's avatar
XhmikosR committed
4589
var CLASS_NAME_DISABLED$1 = 'disabled';
XhmikosR's avatar
XhmikosR committed
4590
4591
4592
4593
var CLASS_NAME_FADE$3 = 'fade';
var CLASS_NAME_SHOW$5 = 'show';
var SELECTOR_DROPDOWN$1 = '.dropdown';
var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
XhmikosR's avatar
XhmikosR committed
4594
var SELECTOR_ACTIVE$1 = '.active';
XhmikosR's avatar
XhmikosR committed
4595
4596
4597
4598
var SELECTOR_ACTIVE_UL = ':scope > li > .active';
var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
XhmikosR's avatar
XhmikosR committed
4599
4600
4601
4602
4603
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
4604

XhmikosR's avatar
XhmikosR committed
4605
var Tab = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
4606
  function Tab(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4607
4608
4609
4610
4611
    this._element = element;
    Data.setData(this._element, DATA_KEY$9, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
4612
  var _proto = Tab.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
4613

XhmikosR's avatar
XhmikosR committed
4614
4615
4616
  // Public
  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4617

XhmikosR's avatar
XhmikosR committed
4618
    if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE$3) || this._element.classList.contains(CLASS_NAME_DISABLED$1)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4619
4620
4621
      return;
    }

XhmikosR's avatar
XhmikosR committed
4622
    var previous;
XhmikosR's avatar
XhmikosR committed
4623
    var target = getElementFromSelector(this._element);
XhmikosR's avatar
XhmikosR committed
4624
4625

    var listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
4626
4627

    if (listElement) {
XhmikosR's avatar
XhmikosR committed
4628
      var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$1;
XhmikosR's avatar
XhmikosR committed
4629
      previous = SelectorEngine.find(itemSelector, listElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
4630
4631
4632
      previous = previous[previous.length - 1];
    }

XhmikosR's avatar
XhmikosR committed
4633
    var hideEvent = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
4634
4635

    if (previous) {
XhmikosR's avatar
XhmikosR committed
4636
      hideEvent = EventHandler.trigger(previous, EVENT_HIDE$3, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4637
4638
4639
4640
        relatedTarget: this._element
      });
    }

XhmikosR's avatar
XhmikosR committed
4641
    var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4642
4643
4644
4645
4646
4647
4648
4649
4650
      relatedTarget: previous
    });

    if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
      return;
    }

    this._activate(this._element, listElement);

XhmikosR's avatar
XhmikosR committed
4651
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4652
      EventHandler.trigger(previous, EVENT_HIDDEN$3, {
XhmikosR's avatar
XhmikosR committed
4653
        relatedTarget: _this._element
XhmikosR's avatar
Dist.  
XhmikosR committed
4654
      });
XhmikosR's avatar
XhmikosR committed
4655
      EventHandler.trigger(_this._element, EVENT_SHOWN$3, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4656
4657
4658
4659
4660
4661
4662
4663
4664
        relatedTarget: previous
      });
    };

    if (target) {
      this._activate(target, target.parentNode, complete);
    } else {
      complete();
    }
XhmikosR's avatar
XhmikosR committed
4665
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4666

XhmikosR's avatar
XhmikosR committed
4667
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4668
4669
4670
    Data.removeData(this._element, DATA_KEY$9);
    this._element = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
4671
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4672

XhmikosR's avatar
XhmikosR committed
4673
4674
  _proto._activate = function _activate(element, container, callback) {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4675

XhmikosR's avatar
XhmikosR committed
4676
    var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE$1);
XhmikosR's avatar
XhmikosR committed
4677
    var active = activeElements[0];
XhmikosR's avatar
XhmikosR committed
4678
    var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$3);
XhmikosR's avatar
Dist.  
XhmikosR committed
4679

XhmikosR's avatar
XhmikosR committed
4680
4681
4682
    var complete = function complete() {
      return _this2._transitionComplete(element, active, callback);
    };
XhmikosR's avatar
Dist.  
XhmikosR committed
4683
4684

    if (active && isTransitioning) {
XhmikosR's avatar
XhmikosR committed
4685
      var transitionDuration = getTransitionDurationFromElement(active);
XhmikosR's avatar
XhmikosR committed
4686
      active.classList.remove(CLASS_NAME_SHOW$5);
XhmikosR's avatar
Dist.  
XhmikosR committed
4687
4688
4689
4690
4691
      EventHandler.one(active, TRANSITION_END, complete);
      emulateTransitionEnd(active, transitionDuration);
    } else {
      complete();
    }
XhmikosR's avatar
XhmikosR committed
4692
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4693

XhmikosR's avatar
XhmikosR committed
4694
  _proto._transitionComplete = function _transitionComplete(element, active, callback) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4695
    if (active) {
XhmikosR's avatar
XhmikosR committed
4696
4697
      active.classList.remove(CLASS_NAME_ACTIVE$3);
      var dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
XhmikosR's avatar
Dist.  
XhmikosR committed
4698
4699

      if (dropdownChild) {
XhmikosR's avatar
XhmikosR committed
4700
        dropdownChild.classList.remove(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
Dist.  
XhmikosR committed
4701
4702
4703
4704
4705
4706
4707
      }

      if (active.getAttribute('role') === 'tab') {
        active.setAttribute('aria-selected', false);
      }
    }

XhmikosR's avatar
XhmikosR committed
4708
    element.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
Dist.  
XhmikosR committed
4709
4710
4711
4712
4713
4714
4715

    if (element.getAttribute('role') === 'tab') {
      element.setAttribute('aria-selected', true);
    }

    reflow(element);

XhmikosR's avatar
XhmikosR committed
4716
4717
    if (element.classList.contains(CLASS_NAME_FADE$3)) {
      element.classList.add(CLASS_NAME_SHOW$5);
XhmikosR's avatar
Dist.  
XhmikosR committed
4718
4719
    }

XhmikosR's avatar
XhmikosR committed
4720
    if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
XhmikosR's avatar
XhmikosR committed
4721
      var dropdownElement = element.closest(SELECTOR_DROPDOWN$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
4722
4723

      if (dropdownElement) {
XhmikosR's avatar
XhmikosR committed
4724
4725
        SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE$1).forEach(function (dropdown) {
          return dropdown.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
XhmikosR committed
4726
        });
XhmikosR's avatar
Dist.  
XhmikosR committed
4727
4728
4729
4730
4731
4732
4733
4734
4735
      }

      element.setAttribute('aria-expanded', true);
    }

    if (callback) {
      callback();
    }
  } // Static
XhmikosR's avatar
XhmikosR committed
4736
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4737

XhmikosR's avatar
XhmikosR committed
4738
  Tab.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4739
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4740
      var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
4741
4742
4743

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4744
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4745
4746
4747
4748
4749
        }

        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
4750
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4751

XhmikosR's avatar
XhmikosR committed
4752
  Tab.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4753
    return Data.getData(element, DATA_KEY$9);
XhmikosR's avatar
XhmikosR committed
4754
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4755

XhmikosR's avatar
XhmikosR committed
4756
4757
4758
4759
4760
4761
4762
4763
4764
  _createClass(Tab, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$9;
    }
  }]);

  return Tab;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
4765
4766
4767
4768
4769
4770
4771
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
4772
EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4773
  event.preventDefault();
XhmikosR's avatar
XhmikosR committed
4774
  var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
4775
4776
  data.show();
});
XhmikosR's avatar
XhmikosR committed
4777
var $$a = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
4778
4779
4780
4781
4782
4783
4784
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .tab to jQuery only if jQuery is present
 */

4785
4786
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4787
4788
4789
4790
if ($$a) {
  var JQUERY_NO_CONFLICT$9 = $$a.fn[NAME$9];
  $$a.fn[NAME$9] = Tab.jQueryInterface;
  $$a.fn[NAME$9].Constructor = Tab;
XhmikosR's avatar
Dist.  
XhmikosR committed
4791

XhmikosR's avatar
XhmikosR committed
4792
4793
4794
  $$a.fn[NAME$9].noConflict = function () {
    $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
    return Tab.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
4795
4796
4797
4798
4799
4800
4801
4802
4803
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
4804
var NAME$a = 'toast';
XhmikosR's avatar
XhmikosR committed
4805
var VERSION$a = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
4806
4807
var DATA_KEY$a = 'bs.toast';
var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
4808
4809
4810
4811
4812
4813
4814
4815
4816
var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
var CLASS_NAME_FADE$4 = 'fade';
var CLASS_NAME_HIDE = 'hide';
var CLASS_NAME_SHOW$6 = 'show';
var CLASS_NAME_SHOWING = 'showing';
XhmikosR's avatar
XhmikosR committed
4817
var DefaultType$7 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
4818
4819
4820
4821
  animation: 'boolean',
  autohide: 'boolean',
  delay: 'number'
};
XhmikosR's avatar
XhmikosR committed
4822
var Default$7 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
4823
4824
  animation: true,
  autohide: true,
XhmikosR's avatar
XhmikosR committed
4825
  delay: 5000
XhmikosR's avatar
Dist.  
XhmikosR committed
4826
};
XhmikosR's avatar
XhmikosR committed
4827
var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
XhmikosR's avatar
XhmikosR committed
4828
4829
4830
4831
4832
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
4833

XhmikosR's avatar
XhmikosR committed
4834
var Toast = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
4835
  function Toast(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
    this._element = element;
    this._config = this._getConfig(config);
    this._timeout = null;

    this._setListeners();

    Data.setData(element, DATA_KEY$a, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
4846
  var _proto = Toast.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
4847

XhmikosR's avatar
XhmikosR committed
4848
4849
4850
  // Public
  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4851

XhmikosR's avatar
XhmikosR committed
4852
    var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
4853
4854
4855
4856

    if (showEvent.defaultPrevented) {
      return;
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
4857

XhmikosR's avatar
XhmikosR committed
4858
4859
    this._clearTimeout();

XhmikosR's avatar
Dist.  
XhmikosR committed
4860
    if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
4861
      this._element.classList.add(CLASS_NAME_FADE$4);
XhmikosR's avatar
Dist.  
XhmikosR committed
4862
4863
    }

XhmikosR's avatar
XhmikosR committed
4864
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4865
      _this._element.classList.remove(CLASS_NAME_SHOWING);
XhmikosR's avatar
Dist.  
XhmikosR committed
4866

XhmikosR's avatar
XhmikosR committed
4867
      _this._element.classList.add(CLASS_NAME_SHOW$6);
XhmikosR's avatar
Dist.  
XhmikosR committed
4868

XhmikosR's avatar
XhmikosR committed
4869
      EventHandler.trigger(_this._element, EVENT_SHOWN$4);
XhmikosR's avatar
Dist.  
XhmikosR committed
4870

XhmikosR's avatar
XhmikosR committed
4871
4872
4873
4874
      if (_this._config.autohide) {
        _this._timeout = setTimeout(function () {
          _this.hide();
        }, _this._config.delay);
XhmikosR's avatar
Dist.  
XhmikosR committed
4875
4876
4877
      }
    };

XhmikosR's avatar
XhmikosR committed
4878
    this._element.classList.remove(CLASS_NAME_HIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
4879

4880
4881
    reflow(this._element);

XhmikosR's avatar
XhmikosR committed
4882
    this._element.classList.add(CLASS_NAME_SHOWING);
XhmikosR's avatar
Dist.  
XhmikosR committed
4883
4884

    if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
4885
      var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
4886
4887
4888
4889
4890
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
    } else {
      complete();
    }
XhmikosR's avatar
XhmikosR committed
4891
4892
4893
4894
  };

  _proto.hide = function hide() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4895

XhmikosR's avatar
XhmikosR committed
4896
    if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4897
4898
4899
      return;
    }

XhmikosR's avatar
XhmikosR committed
4900
    var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
4901
4902
4903
4904

    if (hideEvent.defaultPrevented) {
      return;
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
4905

XhmikosR's avatar
XhmikosR committed
4906
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4907
      _this2._element.classList.add(CLASS_NAME_HIDE);
XhmikosR's avatar
XhmikosR committed
4908

XhmikosR's avatar
XhmikosR committed
4909
      EventHandler.trigger(_this2._element, EVENT_HIDDEN$4);
XhmikosR's avatar
XhmikosR committed
4910
4911
    };

XhmikosR's avatar
XhmikosR committed
4912
    this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
XhmikosR committed
4913
4914
4915
4916
4917

    if (this._config.animation) {
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist.  
XhmikosR committed
4918
    } else {
XhmikosR's avatar
XhmikosR committed
4919
      complete();
XhmikosR's avatar
Dist.  
XhmikosR committed
4920
    }
XhmikosR's avatar
XhmikosR committed
4921
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4922

XhmikosR's avatar
XhmikosR committed
4923
  _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4924
    this._clearTimeout();
XhmikosR's avatar
Dist.  
XhmikosR committed
4925

XhmikosR's avatar
XhmikosR committed
4926
4927
    if (this._element.classList.contains(CLASS_NAME_SHOW$6)) {
      this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
Dist.  
XhmikosR committed
4928
4929
    }

XhmikosR's avatar
XhmikosR committed
4930
    EventHandler.off(this._element, EVENT_CLICK_DISMISS$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
4931
4932
4933
4934
    Data.removeData(this._element, DATA_KEY$a);
    this._element = null;
    this._config = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
4935
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4936

XhmikosR's avatar
XhmikosR committed
4937
  _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4938
    config = _extends({}, Default$7, Manipulator.getDataAttributes(this._element), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
4939
4940
    typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
4941
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4942

XhmikosR's avatar
XhmikosR committed
4943
4944
  _proto._setListeners = function _setListeners() {
    var _this3 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4945

XhmikosR's avatar
XhmikosR committed
4946
    EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
XhmikosR's avatar
XhmikosR committed
4947
4948
      return _this3.hide();
    });
XhmikosR's avatar
XhmikosR committed
4949
4950
4951
4952
4953
  };

  _proto._clearTimeout = function _clearTimeout() {
    clearTimeout(this._timeout);
    this._timeout = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
4954
  } // Static
XhmikosR's avatar
XhmikosR committed
4955
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4956

XhmikosR's avatar
XhmikosR committed
4957
  Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4958
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4959
      var data = Data.getData(this, DATA_KEY$a);
XhmikosR's avatar
Dist.  
XhmikosR committed
4960

XhmikosR's avatar
XhmikosR committed
4961
      var _config = typeof config === 'object' && config;
XhmikosR's avatar
Dist.  
XhmikosR committed
4962
4963
4964
4965
4966
4967
4968

      if (!data) {
        data = new Toast(this, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4969
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4970
4971
4972
4973
4974
        }

        data[config](this);
      }
    });
XhmikosR's avatar
XhmikosR committed
4975
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4976

XhmikosR's avatar
XhmikosR committed
4977
  Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4978
    return Data.getData(element, DATA_KEY$a);
XhmikosR's avatar
XhmikosR committed
4979
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4980

XhmikosR's avatar
XhmikosR committed
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
  _createClass(Toast, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$a;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$7;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$7;
    }
  }]);

  return Toast;
}();
XhmikosR's avatar
XhmikosR committed
5000
5001

var $$b = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
5002
5003
5004
5005
5006
5007
5008
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 *  add .toast to jQuery only if jQuery is present
 */

5009
5010
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5011
5012
5013
5014
if ($$b) {
  var JQUERY_NO_CONFLICT$a = $$b.fn[NAME$a];
  $$b.fn[NAME$a] = Toast.jQueryInterface;
  $$b.fn[NAME$a].Constructor = Toast;
XhmikosR's avatar
Dist.  
XhmikosR committed
5015

XhmikosR's avatar
XhmikosR committed
5016
5017
5018
  $$b.fn[NAME$a].noConflict = function () {
    $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
    return Toast.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
5019
5020
5021
5022
5023
  };
}

export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Popover, ScrollSpy, Tab, Toast, Tooltip };
//# sourceMappingURL=bootstrap.esm.js.map