bootstrap.esm.js 145 KB
Newer Older
XhmikosR's avatar
XhmikosR committed
2001
2002
2003
      var tempActiveData = actives.filter(function (elem) {
        return container !== elem;
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
2004
2005
2006
2007
2008
2009
2010
      activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY$3) : null;

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

XhmikosR's avatar
XhmikosR committed
2011
    var startEvent = EventHandler.trigger(this._element, Event$4.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
2012
2013
2014
2015
2016
2017

    if (startEvent.defaultPrevented) {
      return;
    }

    if (actives) {
XhmikosR's avatar
XhmikosR committed
2018
      actives.forEach(function (elemActive) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
        if (container !== elemActive) {
          Collapse._collapseInterface(elemActive, 'hide');
        }

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

XhmikosR's avatar
XhmikosR committed
2029
    var dimension = this._getDimension();
XhmikosR's avatar
Dist.  
XhmikosR committed
2030
2031
2032
2033
2034
2035
2036
2037

    this._element.classList.remove(ClassName$3.COLLAPSE);

    this._element.classList.add(ClassName$3.COLLAPSING);

    this._element.style[dimension] = 0;

    if (this._triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
2038
      this._triggerArray.forEach(function (element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2039
2040
2041
2042
2043
2044
2045
        element.classList.remove(ClassName$3.COLLAPSED);
        element.setAttribute('aria-expanded', true);
      });
    }

    this.setTransitioning(true);

XhmikosR's avatar
XhmikosR committed
2046
2047
2048
2049
2050
2051
    var complete = function complete() {
      _this._element.classList.remove(ClassName$3.COLLAPSING);

      _this._element.classList.add(ClassName$3.COLLAPSE);

      _this._element.classList.add(ClassName$3.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
2052

XhmikosR's avatar
XhmikosR committed
2053
      _this._element.style[dimension] = '';
XhmikosR's avatar
Dist.  
XhmikosR committed
2054

XhmikosR's avatar
XhmikosR committed
2055
      _this.setTransitioning(false);
XhmikosR's avatar
Dist.  
XhmikosR committed
2056

XhmikosR's avatar
XhmikosR committed
2057
      EventHandler.trigger(_this._element, Event$4.SHOWN);
XhmikosR's avatar
Dist.  
XhmikosR committed
2058
2059
    };

XhmikosR's avatar
XhmikosR committed
2060
2061
2062
    var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
    var scrollSize = "scroll" + capitalizedDimension;
    var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2063
2064
    EventHandler.one(this._element, TRANSITION_END, complete);
    emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
2065
2066
2067
2068
2069
    this._element.style[dimension] = this._element[scrollSize] + "px";
  };

  _proto.hide = function hide() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2070
2071
2072
2073
2074

    if (this._isTransitioning || !this._element.classList.contains(ClassName$3.SHOW)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2075
    var startEvent = EventHandler.trigger(this._element, Event$4.HIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2076
2077
2078
2079
2080

    if (startEvent.defaultPrevented) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2081
    var dimension = this._getDimension();
XhmikosR's avatar
Dist.  
XhmikosR committed
2082

XhmikosR's avatar
XhmikosR committed
2083
    this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
2084
2085
2086
2087
2088
2089
2090
2091
    reflow(this._element);

    this._element.classList.add(ClassName$3.COLLAPSING);

    this._element.classList.remove(ClassName$3.COLLAPSE);

    this._element.classList.remove(ClassName$3.SHOW);

XhmikosR's avatar
XhmikosR committed
2092
    var triggerArrayLength = this._triggerArray.length;
XhmikosR's avatar
Dist.  
XhmikosR committed
2093
2094

    if (triggerArrayLength > 0) {
XhmikosR's avatar
XhmikosR committed
2095
2096
2097
      for (var i = 0; i < triggerArrayLength; i++) {
        var trigger = this._triggerArray[i];
        var selector = getSelectorFromElement(trigger);
XhmikosR's avatar
Dist.  
XhmikosR committed
2098
2099

        if (selector !== null) {
XhmikosR's avatar
XhmikosR committed
2100
          var elem = SelectorEngine.findOne(selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111

          if (!elem.classList.contains(ClassName$3.SHOW)) {
            trigger.classList.add(ClassName$3.COLLAPSED);
            trigger.setAttribute('aria-expanded', false);
          }
        }
      }
    }

    this.setTransitioning(true);

XhmikosR's avatar
XhmikosR committed
2112
2113
    var complete = function complete() {
      _this2.setTransitioning(false);
XhmikosR's avatar
Dist.  
XhmikosR committed
2114

XhmikosR's avatar
XhmikosR committed
2115
      _this2._element.classList.remove(ClassName$3.COLLAPSING);
XhmikosR's avatar
Dist.  
XhmikosR committed
2116

XhmikosR's avatar
XhmikosR committed
2117
      _this2._element.classList.add(ClassName$3.COLLAPSE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2118

XhmikosR's avatar
XhmikosR committed
2119
      EventHandler.trigger(_this2._element, Event$4.HIDDEN);
XhmikosR's avatar
Dist.  
XhmikosR committed
2120
2121
2122
    };

    this._element.style[dimension] = '';
XhmikosR's avatar
XhmikosR committed
2123
    var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2124
2125
    EventHandler.one(this._element, TRANSITION_END, complete);
    emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
2126
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2127

XhmikosR's avatar
XhmikosR committed
2128
  _proto.setTransitioning = function setTransitioning(isTransitioning) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2129
    this._isTransitioning = isTransitioning;
XhmikosR's avatar
XhmikosR committed
2130
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2131

XhmikosR's avatar
XhmikosR committed
2132
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2133
2134
2135
2136
2137
2138
2139
    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
2140
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2141

XhmikosR's avatar
XhmikosR committed
2142
2143
  _proto._getConfig = function _getConfig(config) {
    config = _objectSpread({}, Default$1, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2144
2145
2146
2147
    config.toggle = Boolean(config.toggle); // Coerce string values

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

XhmikosR's avatar
XhmikosR committed
2150
2151
  _proto._getDimension = function _getDimension() {
    var hasWidth = this._element.classList.contains(Dimension.WIDTH);
XhmikosR's avatar
Dist.  
XhmikosR committed
2152
2153

    return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
XhmikosR's avatar
XhmikosR committed
2154
2155
2156
2157
  };

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

XhmikosR's avatar
XhmikosR committed
2159
    var parent = this._config.parent;
XhmikosR's avatar
Dist.  
XhmikosR committed
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169

    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
2170
2171
2172
    var selector = "[data-toggle=\"collapse\"][data-parent=\"" + parent + "\"]";
    makeArray(SelectorEngine.find(selector, parent)).forEach(function (element) {
      _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
XhmikosR's avatar
Dist.  
XhmikosR committed
2173
2174
    });
    return parent;
XhmikosR's avatar
XhmikosR committed
2175
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2176

XhmikosR's avatar
XhmikosR committed
2177
  _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2178
    if (element) {
XhmikosR's avatar
XhmikosR committed
2179
      var isOpen = element.classList.contains(ClassName$3.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
2180
2181

      if (triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
2182
        triggerArray.forEach(function (elem) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
          if (isOpen) {
            elem.classList.remove(ClassName$3.COLLAPSED);
          } else {
            elem.classList.add(ClassName$3.COLLAPSED);
          }

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

XhmikosR's avatar
XhmikosR committed
2196
2197
  Collapse._getTargetFromElement = function _getTargetFromElement(element) {
    var selector = getSelectorFromElement(element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2198
    return selector ? SelectorEngine.findOne(selector) : null;
XhmikosR's avatar
XhmikosR committed
2199
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2200

XhmikosR's avatar
XhmikosR committed
2201
2202
  Collapse._collapseInterface = function _collapseInterface(element, config) {
    var data = Data.getData(element, DATA_KEY$3);
XhmikosR's avatar
Dist.  
XhmikosR committed
2203

XhmikosR's avatar
XhmikosR committed
2204
    var _config = _objectSpread({}, Default$1, Manipulator.getDataAttributes(element), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215

    if (!data && _config.toggle && /show|hide/.test(config)) {
      _config.toggle = false;
    }

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

    if (typeof config === 'string') {
      if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
2216
        throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
2217
2218
2219
2220
      }

      data[config]();
    }
XhmikosR's avatar
XhmikosR committed
2221
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2222

XhmikosR's avatar
XhmikosR committed
2223
  Collapse._jQueryInterface = function _jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2224
2225
2226
    return this.each(function () {
      Collapse._collapseInterface(this, config);
    });
XhmikosR's avatar
XhmikosR committed
2227
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2228

XhmikosR's avatar
XhmikosR committed
2229
  Collapse._getInstance = function _getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2230
    return Data.getData(element, DATA_KEY$3);
XhmikosR's avatar
XhmikosR committed
2231
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2232

XhmikosR's avatar
XhmikosR committed
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
  _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
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


EventHandler.on(document, Event$4.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  // 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
2260
2261
2262
2263
2264
2265
  var triggerData = Manipulator.getDataAttributes(this);
  var selector = getSelectorFromElement(this);
  var selectorElements = makeArray(SelectorEngine.find(selector));
  selectorElements.forEach(function (element) {
    var data = Data.getData(element, DATA_KEY$3);
    var config;
XhmikosR's avatar
Dist.  
XhmikosR committed
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289

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

    Collapse._collapseInterface(element, config);
  });
});
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .collapse to jQuery only if jQuery is present
 */

if (typeof jQuery !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
2290
  var JQUERY_NO_CONFLICT$3 = jQuery.fn[NAME$3];
XhmikosR's avatar
Dist.  
XhmikosR committed
2291
2292
2293
  jQuery.fn[NAME$3] = Collapse._jQueryInterface;
  jQuery.fn[NAME$3].Constructor = Collapse;

XhmikosR's avatar
XhmikosR committed
2294
2295
  jQuery.fn[NAME$3].noConflict = function () {
    jQuery.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
XhmikosR's avatar
Dist.  
XhmikosR committed
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
    return Collapse._jQueryInterface;
  };
}

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

XhmikosR's avatar
XhmikosR committed
2306
2307
2308
2309
2310
2311
var NAME$4 = 'dropdown';
var VERSION$4 = '4.3.1';
var DATA_KEY$4 = 'bs.dropdown';
var EVENT_KEY$4 = "." + DATA_KEY$4;
var DATA_API_KEY$4 = '.data-api';
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
XhmikosR's avatar
Dist.  
XhmikosR committed
2312

XhmikosR's avatar
XhmikosR committed
2313
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
XhmikosR's avatar
Dist.  
XhmikosR committed
2314

XhmikosR's avatar
XhmikosR committed
2315
var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
XhmikosR's avatar
Dist.  
XhmikosR committed
2316

XhmikosR's avatar
XhmikosR committed
2317
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
XhmikosR's avatar
Dist.  
XhmikosR committed
2318

XhmikosR's avatar
XhmikosR committed
2319
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
XhmikosR's avatar
Dist.  
XhmikosR committed
2320

XhmikosR's avatar
XhmikosR committed
2321
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
XhmikosR's avatar
Dist.  
XhmikosR committed
2322

XhmikosR's avatar
XhmikosR committed
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
var Event$5 = {
  HIDE: "hide" + EVENT_KEY$4,
  HIDDEN: "hidden" + EVENT_KEY$4,
  SHOW: "show" + EVENT_KEY$4,
  SHOWN: "shown" + EVENT_KEY$4,
  CLICK: "click" + EVENT_KEY$4,
  CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
XhmikosR's avatar
Dist.  
XhmikosR committed
2333
};
XhmikosR's avatar
XhmikosR committed
2334
var ClassName$4 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2335
2336
2337
2338
2339
2340
2341
2342
  DISABLED: 'disabled',
  SHOW: 'show',
  DROPUP: 'dropup',
  DROPRIGHT: 'dropright',
  DROPLEFT: 'dropleft',
  MENURIGHT: 'dropdown-menu-right',
  POSITION_STATIC: 'position-static'
};
XhmikosR's avatar
XhmikosR committed
2343
var Selector$4 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2344
2345
2346
2347
2348
2349
  DATA_TOGGLE: '[data-toggle="dropdown"]',
  FORM_CHILD: '.dropdown form',
  MENU: '.dropdown-menu',
  NAVBAR_NAV: '.navbar-nav',
  VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
};
XhmikosR's avatar
XhmikosR committed
2350
var AttachmentMap = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2351
2352
2353
2354
2355
2356
2357
2358
2359
  TOP: 'top-start',
  TOPEND: 'top-end',
  BOTTOM: 'bottom-start',
  BOTTOMEND: 'bottom-end',
  RIGHT: 'right-start',
  RIGHTEND: 'right-end',
  LEFT: 'left-start',
  LEFTEND: 'left-end'
};
XhmikosR's avatar
XhmikosR committed
2360
var Default$2 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2361
2362
2363
2364
2365
2366
  offset: 0,
  flip: true,
  boundary: 'scrollParent',
  reference: 'toggle',
  display: 'dynamic'
};
XhmikosR's avatar
XhmikosR committed
2367
var DefaultType$2 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
  offset: '(number|string|function)',
  flip: 'boolean',
  boundary: '(string|element)',
  reference: '(string|element)',
  display: 'string'
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

};

XhmikosR's avatar
XhmikosR committed
2381
2382
2383
2384
var Dropdown =
/*#__PURE__*/
function () {
  function Dropdown(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
    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
2397
  var _proto = Dropdown.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
2398

XhmikosR's avatar
XhmikosR committed
2399
2400
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2401
2402
2403
2404
    if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2405
    var parent = Dropdown._getParentFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2406

XhmikosR's avatar
XhmikosR committed
2407
    var isActive = this._menu.classList.contains(ClassName$4.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
2408
2409
2410
2411
2412
2413
2414

    Dropdown._clearMenus();

    if (isActive) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2415
    var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2416
2417
      relatedTarget: this._element
    };
XhmikosR's avatar
XhmikosR committed
2418
    var showEvent = EventHandler.trigger(parent, Event$5.SHOW, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433

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


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

XhmikosR's avatar
XhmikosR committed
2434
      var referenceElement = this._element;
XhmikosR's avatar
Dist.  
XhmikosR committed
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460

      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') {
        parent.classList.add(ClassName$4.POSITION_STATIC);
      }

      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


    if ('ontouchstart' in document.documentElement && !makeArray(SelectorEngine.closest(parent, Selector$4.NAVBAR_NAV)).length) {
XhmikosR's avatar
XhmikosR committed
2461
2462
2463
      makeArray(document.body.children).forEach(function (elem) {
        return EventHandler.on(elem, 'mouseover', null, noop());
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
2464
2465
2466
2467
2468
2469
2470
2471
2472
    }

    this._element.focus();

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

    Manipulator.toggleClass(this._menu, ClassName$4.SHOW);
    Manipulator.toggleClass(parent, ClassName$4.SHOW);
    EventHandler.trigger(parent, Event$5.SHOWN, relatedTarget);
XhmikosR's avatar
XhmikosR committed
2473
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2474

XhmikosR's avatar
XhmikosR committed
2475
  _proto.show = function show() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2476
2477
2478
2479
    if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || this._menu.classList.contains(ClassName$4.SHOW)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2480
    var parent = Dropdown._getParentFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2481

XhmikosR's avatar
XhmikosR committed
2482
    var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2483
2484
      relatedTarget: this._element
    };
XhmikosR's avatar
XhmikosR committed
2485
    var showEvent = EventHandler.trigger(parent, Event$5.SHOW, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2486
2487
2488
2489
2490
2491
2492
2493

    if (showEvent.defaultPrevented) {
      return;
    }

    Manipulator.toggleClass(this._menu, ClassName$4.SHOW);
    Manipulator.toggleClass(parent, ClassName$4.SHOW);
    EventHandler.trigger(parent, Event$5.SHOWN, relatedTarget);
XhmikosR's avatar
XhmikosR committed
2494
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2495

XhmikosR's avatar
XhmikosR committed
2496
  _proto.hide = function hide() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2497
2498
2499
2500
    if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || !this._menu.classList.contains(ClassName$4.SHOW)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2501
    var parent = Dropdown._getParentFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2502

XhmikosR's avatar
XhmikosR committed
2503
    var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2504
2505
      relatedTarget: this._element
    };
XhmikosR's avatar
XhmikosR committed
2506
    var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2507
2508
2509
2510
2511
2512
2513
2514

    if (hideEvent.defaultPrevented) {
      return;
    }

    Manipulator.toggleClass(this._menu, ClassName$4.SHOW);
    Manipulator.toggleClass(parent, ClassName$4.SHOW);
    EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget);
XhmikosR's avatar
XhmikosR committed
2515
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2516

XhmikosR's avatar
XhmikosR committed
2517
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
    Data.removeData(this._element, DATA_KEY$4);
    EventHandler.off(this._element, EVENT_KEY$4);
    this._element = null;
    this._menu = null;

    if (this._popper !== null) {
      this._popper.destroy();

      this._popper = null;
    }
XhmikosR's avatar
XhmikosR committed
2528
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2529

XhmikosR's avatar
XhmikosR committed
2530
  _proto.update = function update() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2531
2532
2533
2534
2535
2536
    this._inNavbar = this._detectNavbar();

    if (this._popper !== null) {
      this._popper.scheduleUpdate();
    }
  } // Private
XhmikosR's avatar
XhmikosR committed
2537
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2538

XhmikosR's avatar
XhmikosR committed
2539
2540
  _proto._addEventListeners = function _addEventListeners() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2541

XhmikosR's avatar
XhmikosR committed
2542
    EventHandler.on(this._element, Event$5.CLICK, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2543
2544
      event.preventDefault();
      event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
2545
2546

      _this.toggle();
XhmikosR's avatar
Dist.  
XhmikosR committed
2547
    });
XhmikosR's avatar
XhmikosR committed
2548
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2549

XhmikosR's avatar
XhmikosR committed
2550
2551
  _proto._getConfig = function _getConfig(config) {
    config = _objectSpread({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2552
2553
    typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
2554
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2555

XhmikosR's avatar
XhmikosR committed
2556
  _proto._getMenuElement = function _getMenuElement() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2557
    if (!this._menu) {
XhmikosR's avatar
XhmikosR committed
2558
      var parent = Dropdown._getParentFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2559
2560
2561
2562
2563
2564
2565

      if (parent) {
        this._menu = SelectorEngine.findOne(Selector$4.MENU, parent);
      }
    }

    return this._menu;
XhmikosR's avatar
XhmikosR committed
2566
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2567

XhmikosR's avatar
XhmikosR committed
2568
2569
2570
  _proto._getPlacement = function _getPlacement() {
    var parentDropdown = this._element.parentNode;
    var placement = AttachmentMap.BOTTOM; // Handle dropup
XhmikosR's avatar
Dist.  
XhmikosR committed
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586

    if (parentDropdown.classList.contains(ClassName$4.DROPUP)) {
      placement = AttachmentMap.TOP;

      if (this._menu.classList.contains(ClassName$4.MENURIGHT)) {
        placement = AttachmentMap.TOPEND;
      }
    } else if (parentDropdown.classList.contains(ClassName$4.DROPRIGHT)) {
      placement = AttachmentMap.RIGHT;
    } else if (parentDropdown.classList.contains(ClassName$4.DROPLEFT)) {
      placement = AttachmentMap.LEFT;
    } else if (this._menu.classList.contains(ClassName$4.MENURIGHT)) {
      placement = AttachmentMap.BOTTOMEND;
    }

    return placement;
XhmikosR's avatar
XhmikosR committed
2587
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2588

XhmikosR's avatar
XhmikosR committed
2589
  _proto._detectNavbar = function _detectNavbar() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2590
    return Boolean(SelectorEngine.closest(this._element, '.navbar'));
XhmikosR's avatar
XhmikosR committed
2591
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2592

XhmikosR's avatar
XhmikosR committed
2593
2594
2595
2596
  _proto._getOffset = function _getOffset() {
    var _this2 = this;

    var offset = {};
XhmikosR's avatar
Dist.  
XhmikosR committed
2597
2598

    if (typeof this._config.offset === 'function') {
XhmikosR's avatar
XhmikosR committed
2599
2600
      offset.fn = function (data) {
        data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist.  
XhmikosR committed
2601
2602
2603
2604
2605
2606
2607
        return data;
      };
    } else {
      offset.offset = this._config.offset;
    }

    return offset;
XhmikosR's avatar
XhmikosR committed
2608
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2609

XhmikosR's avatar
XhmikosR committed
2610
2611
  _proto._getPopperConfig = function _getPopperConfig() {
    var popperConfig = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
      placement: this._getPlacement(),
      modifiers: {
        offset: this._getOffset(),
        flip: {
          enabled: this._config.flip
        },
        preventOverflow: {
          boundariesElement: this._config.boundary
        }
      } // Disable Popper.js if we have a static display

    };

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

    return popperConfig;
  } // Static
XhmikosR's avatar
XhmikosR committed
2633
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2634

XhmikosR's avatar
XhmikosR committed
2635
2636
  Dropdown._dropdownInterface = function _dropdownInterface(element, config) {
    var data = Data.getData(element, DATA_KEY$4);
XhmikosR's avatar
Dist.  
XhmikosR committed
2637

XhmikosR's avatar
XhmikosR committed
2638
    var _config = typeof config === 'object' ? config : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
2639
2640
2641
2642
2643
2644
2645

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

    if (typeof config === 'string') {
      if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
2646
        throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
2647
2648
2649
2650
      }

      data[config]();
    }
XhmikosR's avatar
XhmikosR committed
2651
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2652

XhmikosR's avatar
XhmikosR committed
2653
  Dropdown._jQueryInterface = function _jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2654
2655
2656
    return this.each(function () {
      Dropdown._dropdownInterface(this, config);
    });
XhmikosR's avatar
XhmikosR committed
2657
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2658

XhmikosR's avatar
XhmikosR committed
2659
  Dropdown._clearMenus = function _clearMenus(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2660
2661
2662
2663
    if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2664
    var toggles = makeArray(SelectorEngine.find(Selector$4.DATA_TOGGLE));
XhmikosR's avatar
Dist.  
XhmikosR committed
2665

XhmikosR's avatar
XhmikosR committed
2666
2667
    for (var i = 0, len = toggles.length; i < len; i++) {
      var parent = Dropdown._getParentFromElement(toggles[i]);
XhmikosR's avatar
Dist.  
XhmikosR committed
2668

XhmikosR's avatar
XhmikosR committed
2669
2670
      var context = Data.getData(toggles[i], DATA_KEY$4);
      var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
        relatedTarget: toggles[i]
      };

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

      if (!context) {
        continue;
      }

XhmikosR's avatar
XhmikosR committed
2682
      var dropdownMenu = context._menu;
XhmikosR's avatar
Dist.  
XhmikosR committed
2683
2684
2685
2686
2687
2688
2689
2690
2691

      if (!parent.classList.contains(ClassName$4.SHOW)) {
        continue;
      }

      if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && parent.contains(event.target)) {
        continue;
      }

XhmikosR's avatar
XhmikosR committed
2692
      var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2693
2694
2695
2696
2697
2698
2699
2700

      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
2701
2702
2703
        makeArray(document.body.children).forEach(function (elem) {
          return EventHandler.off(elem, 'mouseover', null, noop());
        });
XhmikosR's avatar
Dist.  
XhmikosR committed
2704
2705
2706
2707
2708
2709
2710
      }

      toggles[i].setAttribute('aria-expanded', 'false');
      dropdownMenu.classList.remove(ClassName$4.SHOW);
      parent.classList.remove(ClassName$4.SHOW);
      EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget);
    }
XhmikosR's avatar
XhmikosR committed
2711
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2712

XhmikosR's avatar
XhmikosR committed
2713
2714
2715
  Dropdown._getParentFromElement = function _getParentFromElement(element) {
    var parent;
    var selector = getSelectorFromElement(element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2716
2717
2718
2719
2720
2721

    if (selector) {
      parent = SelectorEngine.findOne(selector);
    }

    return parent || element.parentNode;
XhmikosR's avatar
XhmikosR committed
2722
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2723

XhmikosR's avatar
XhmikosR committed
2724
  Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
    // 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
    if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || SelectorEngine.closest(event.target, Selector$4.MENU)) : !REGEXP_KEYDOWN.test(event.which)) {
      return;
    }

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

    if (this.disabled || this.classList.contains(ClassName$4.DISABLED)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2743
    var parent = Dropdown._getParentFromElement(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
2744

XhmikosR's avatar
XhmikosR committed
2745
    var isActive = parent.classList.contains(ClassName$4.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756

    if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
      if (event.which === ESCAPE_KEYCODE) {
        EventHandler.trigger(SelectorEngine.findOne(Selector$4.DATA_TOGGLE, parent), 'focus');
      }

      Dropdown._clearMenus();

      return;
    }

XhmikosR's avatar
XhmikosR committed
2757
    var items = makeArray(SelectorEngine.find(Selector$4.VISIBLE_ITEMS, parent));
XhmikosR's avatar
Dist.  
XhmikosR committed
2758
2759
2760
2761
2762

    if (!items.length) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2763
    var index = items.indexOf(event.target);
XhmikosR's avatar
Dist.  
XhmikosR committed
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779

    if (event.which === ARROW_UP_KEYCODE && index > 0) {
      // Up
      index--;
    }

    if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
      // Down
      index++;
    }

    if (index < 0) {
      index = 0;
    }

    items[index].focus();
XhmikosR's avatar
XhmikosR committed
2780
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2781

XhmikosR's avatar
XhmikosR committed
2782
  Dropdown._getInstance = function _getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2783
    return Data.getData(element, DATA_KEY$4);
XhmikosR's avatar
XhmikosR committed
2784
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2785

XhmikosR's avatar
XhmikosR committed
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
  _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
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler);
EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler);
EventHandler.on(document, Event$5.CLICK_DATA_API, Dropdown._clearMenus);
EventHandler.on(document, Event$5.KEYUP_DATA_API, Dropdown._clearMenus);
EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  event.preventDefault();
  event.stopPropagation();

  Dropdown._dropdownInterface(this, 'toggle');
});
XhmikosR's avatar
XhmikosR committed
2822
2823
2824
EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  return e.stopPropagation();
});
XhmikosR's avatar
Dist.  
XhmikosR committed
2825
2826
2827
2828
2829
2830
2831
2832
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .dropdown to jQuery only if jQuery is present
 */

if (typeof jQuery !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
2833
  var JQUERY_NO_CONFLICT$4 = jQuery.fn[NAME$4];
XhmikosR's avatar
Dist.  
XhmikosR committed
2834
2835
2836
  jQuery.fn[NAME$4] = Dropdown._jQueryInterface;
  jQuery.fn[NAME$4].Constructor = Dropdown;

XhmikosR's avatar
XhmikosR committed
2837
2838
  jQuery.fn[NAME$4].noConflict = function () {
    jQuery.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
XhmikosR's avatar
Dist.  
XhmikosR committed
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
    return Dropdown._jQueryInterface;
  };
}

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

XhmikosR's avatar
XhmikosR committed
2849
2850
2851
2852
2853
2854
var NAME$5 = 'modal';
var VERSION$5 = '4.3.1';
var DATA_KEY$5 = 'bs.modal';
var EVENT_KEY$5 = "." + DATA_KEY$5;
var DATA_API_KEY$5 = '.data-api';
var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
XhmikosR's avatar
Dist.  
XhmikosR committed
2855

XhmikosR's avatar
XhmikosR committed
2856
var Default$3 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2857
2858
2859
2860
2861
  backdrop: true,
  keyboard: true,
  focus: true,
  show: true
};
XhmikosR's avatar
XhmikosR committed
2862
var DefaultType$3 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2863
2864
2865
2866
2867
  backdrop: '(boolean|string)',
  keyboard: 'boolean',
  focus: 'boolean',
  show: 'boolean'
};
XhmikosR's avatar
XhmikosR committed
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
var Event$6 = {
  HIDE: "hide" + EVENT_KEY$5,
  HIDDEN: "hidden" + EVENT_KEY$5,
  SHOW: "show" + EVENT_KEY$5,
  SHOWN: "shown" + EVENT_KEY$5,
  FOCUSIN: "focusin" + EVENT_KEY$5,
  RESIZE: "resize" + EVENT_KEY$5,
  CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
XhmikosR's avatar
Dist.  
XhmikosR committed
2880
};
XhmikosR's avatar
XhmikosR committed
2881
var ClassName$5 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2882
2883
2884
2885
2886
2887
2888
  SCROLLABLE: 'modal-dialog-scrollable',
  SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  BACKDROP: 'modal-backdrop',
  OPEN: 'modal-open',
  FADE: 'fade',
  SHOW: 'show'
};
XhmikosR's avatar
XhmikosR committed
2889
var Selector$5 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
  DIALOG: '.modal-dialog',
  MODAL_BODY: '.modal-body',
  DATA_TOGGLE: '[data-toggle="modal"]',
  DATA_DISMISS: '[data-dismiss="modal"]',
  FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  STICKY_CONTENT: '.sticky-top'
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

};

XhmikosR's avatar
XhmikosR committed
2904
2905
2906
2907
var Modal =
/*#__PURE__*/
function () {
  function Modal(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
    this._config = this._getConfig(config);
    this._element = element;
    this._dialog = SelectorEngine.findOne(Selector$5.DIALOG, element);
    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
2921
  var _proto = Modal.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
2922

XhmikosR's avatar
XhmikosR committed
2923
2924
  // Public
  _proto.toggle = function toggle(relatedTarget) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2925
    return this._isShown ? this.hide() : this.show(relatedTarget);
XhmikosR's avatar
XhmikosR committed
2926
2927
2928
2929
  };

  _proto.show = function show(relatedTarget) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2930
2931
2932
2933
2934
2935
2936
2937
2938

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

    if (this._element.classList.contains(ClassName$5.FADE)) {
      this._isTransitioning = true;
    }

XhmikosR's avatar
XhmikosR committed
2939
2940
    var showEvent = EventHandler.trigger(this._element, Event$6.SHOW, {
      relatedTarget: relatedTarget
XhmikosR's avatar
Dist.  
XhmikosR committed
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
    });

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

    this._isShown = true;

    this._checkScrollbar();

    this._setScrollbar();

    this._adjustDialog();

    this._setEscapeEvent();

    this._setResizeEvent();

XhmikosR's avatar
XhmikosR committed
2959
2960
2961
2962
2963
2964
2965
    EventHandler.on(this._element, Event$6.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
      return _this.hide(event);
    });
    EventHandler.on(this._dialog, Event$6.MOUSEDOWN_DISMISS, function () {
      EventHandler.one(_this._element, Event$6.MOUSEUP_DISMISS, function (event) {
        if (event.target === _this._element) {
          _this._ignoreBackdropClick = true;
XhmikosR's avatar
Dist.  
XhmikosR committed
2966
2967
2968
2969
        }
      });
    });

XhmikosR's avatar
XhmikosR committed
2970
2971
2972
2973
2974
2975
2976
    this._showBackdrop(function () {
      return _this._showElement(relatedTarget);
    });
  };

  _proto.hide = function hide(event) {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2977
2978
2979
2980
2981
2982
2983
2984
2985

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

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

XhmikosR's avatar
XhmikosR committed
2986
    var hideEvent = EventHandler.trigger(this._element, Event$6.HIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2987
2988
2989
2990
2991
2992
2993

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

    this._isShown = false;

XhmikosR's avatar
XhmikosR committed
2994
    var transition = this._element.classList.contains(ClassName$5.FADE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2995
2996
2997
2998
2999
3000

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

    this._setEscapeEvent();
For faster browsing, not all history is shown. View entire blame