bootstrap.esm.js 144 KB
Newer Older
XhmikosR's avatar
XhmikosR committed
2001
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
2002
2003
2004
2005
2006
2007
2008
      activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY$3) : null;

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

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

    if (startEvent.defaultPrevented) {
      return;
    }

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

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

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

    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
2036
      this._triggerArray.forEach(function (element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2037
2038
2039
2040
2041
2042
2043
        element.classList.remove(ClassName$3.COLLAPSED);
        element.setAttribute('aria-expanded', true);
      });
    }

    this.setTransitioning(true);

XhmikosR's avatar
XhmikosR committed
2044
2045
2046
2047
2048
2049
    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
2050

XhmikosR's avatar
XhmikosR committed
2051
      _this._element.style[dimension] = '';
XhmikosR's avatar
Dist.  
XhmikosR committed
2052

XhmikosR's avatar
XhmikosR committed
2053
      _this.setTransitioning(false);
XhmikosR's avatar
Dist.  
XhmikosR committed
2054

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

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

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

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

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

    if (startEvent.defaultPrevented) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2079
    var dimension = this._getDimension();
XhmikosR's avatar
Dist.  
XhmikosR committed
2080

XhmikosR's avatar
XhmikosR committed
2081
    this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
2082
2083
2084
2085
2086
2087
2088
2089
    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
2090
    var triggerArrayLength = this._triggerArray.length;
XhmikosR's avatar
Dist.  
XhmikosR committed
2091
2092

    if (triggerArrayLength > 0) {
XhmikosR's avatar
XhmikosR committed
2093
2094
      for (var i = 0; i < triggerArrayLength; i++) {
        var trigger = this._triggerArray[i];
XhmikosR's avatar
XhmikosR committed
2095
        var elem = getElementFromSelector(trigger);
XhmikosR's avatar
Dist.  
XhmikosR committed
2096

XhmikosR's avatar
XhmikosR committed
2097
2098
2099
        if (elem && !elem.classList.contains(ClassName$3.SHOW)) {
          trigger.classList.add(ClassName$3.COLLAPSED);
          trigger.setAttribute('aria-expanded', false);
XhmikosR's avatar
Dist.  
XhmikosR committed
2100
2101
2102
2103
2104
2105
        }
      }
    }

    this.setTransitioning(true);

XhmikosR's avatar
XhmikosR committed
2106
2107
    var complete = function complete() {
      _this2.setTransitioning(false);
XhmikosR's avatar
Dist.  
XhmikosR committed
2108

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

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

XhmikosR's avatar
XhmikosR committed
2113
      EventHandler.trigger(_this2._element, Event$4.HIDDEN);
XhmikosR's avatar
Dist.  
XhmikosR committed
2114
2115
2116
    };

    this._element.style[dimension] = '';
XhmikosR's avatar
XhmikosR committed
2117
    var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
2118
2119
    EventHandler.one(this._element, TRANSITION_END, complete);
    emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
2120
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2121

XhmikosR's avatar
XhmikosR committed
2122
  _proto.setTransitioning = function setTransitioning(isTransitioning) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2123
    this._isTransitioning = isTransitioning;
XhmikosR's avatar
XhmikosR committed
2124
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2125

XhmikosR's avatar
XhmikosR committed
2126
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2127
2128
2129
2130
2131
2132
2133
    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
2134
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2135

XhmikosR's avatar
XhmikosR committed
2136
  _proto._getConfig = function _getConfig(config) {
2137
    config = _objectSpread2({}, Default$1, {}, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2138
2139
2140
2141
    config.toggle = Boolean(config.toggle); // Coerce string values

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

XhmikosR's avatar
XhmikosR committed
2144
2145
  _proto._getDimension = function _getDimension() {
    var hasWidth = this._element.classList.contains(Dimension.WIDTH);
XhmikosR's avatar
Dist.  
XhmikosR committed
2146
2147

    return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
XhmikosR's avatar
XhmikosR committed
2148
2149
2150
2151
  };

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

XhmikosR's avatar
XhmikosR committed
2153
    var parent = this._config.parent;
XhmikosR's avatar
Dist.  
XhmikosR committed
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163

    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
2164
2165
    var selector = "[data-toggle=\"collapse\"][data-parent=\"" + parent + "\"]";
    makeArray(SelectorEngine.find(selector, parent)).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
2166
      var selected = getElementFromSelector(element);
2167
2168

      _this3._addAriaAndCollapsedClass(selected, [element]);
XhmikosR's avatar
Dist.  
XhmikosR committed
2169
2170
    });
    return parent;
XhmikosR's avatar
XhmikosR committed
2171
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2172

XhmikosR's avatar
XhmikosR committed
2173
  _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2174
    if (element) {
XhmikosR's avatar
XhmikosR committed
2175
      var isOpen = element.classList.contains(ClassName$3.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
2176
2177

      if (triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
2178
        triggerArray.forEach(function (elem) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
          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
2190
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2191

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

2195
    var _config = _objectSpread2({}, Default$1, {}, Manipulator.getDataAttributes(element), {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206

    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
2207
        throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
2208
2209
2210
2211
      }

      data[config]();
    }
XhmikosR's avatar
XhmikosR committed
2212
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2213

XhmikosR's avatar
XhmikosR committed
2214
  Collapse.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2215
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2216
      Collapse.collapseInterface(this, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2217
    });
XhmikosR's avatar
XhmikosR committed
2218
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2219

XhmikosR's avatar
XhmikosR committed
2220
  Collapse.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2221
    return Data.getData(element, DATA_KEY$3);
XhmikosR's avatar
XhmikosR committed
2222
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2223

XhmikosR's avatar
XhmikosR committed
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
  _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
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
/**
 * ------------------------------------------------------------------------
 * 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
2251
2252
2253
2254
2255
2256
  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
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269

    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
2270
    Collapse.collapseInterface(element, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2271
2272
  });
});
XhmikosR's avatar
XhmikosR committed
2273
var $$4 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
2274
2275
2276
2277
2278
2279
2280
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .collapse to jQuery only if jQuery is present
 */

2281
2282
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2283
2284
2285
2286
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
2287

XhmikosR's avatar
XhmikosR committed
2288
2289
2290
  $$4.fn[NAME$3].noConflict = function () {
    $$4.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
    return Collapse.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
2291
2292
2293
2294
2295
2296
2297
2298
2299
  };
}

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

XhmikosR's avatar
XhmikosR committed
2300
2301
2302
2303
2304
2305
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
2306

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

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

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

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

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

XhmikosR's avatar
XhmikosR committed
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
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
2327
};
XhmikosR's avatar
XhmikosR committed
2328
var ClassName$4 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2329
2330
2331
2332
2333
2334
2335
2336
  DISABLED: 'disabled',
  SHOW: 'show',
  DROPUP: 'dropup',
  DROPRIGHT: 'dropright',
  DROPLEFT: 'dropleft',
  MENURIGHT: 'dropdown-menu-right',
  POSITION_STATIC: 'position-static'
};
XhmikosR's avatar
XhmikosR committed
2337
var Selector$4 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2338
2339
2340
2341
2342
2343
  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
2344
var AttachmentMap = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2345
2346
2347
2348
2349
2350
2351
2352
2353
  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
2354
var Default$2 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2355
2356
2357
2358
  offset: 0,
  flip: true,
  boundary: 'scrollParent',
  reference: 'toggle',
XhmikosR's avatar
XhmikosR committed
2359
2360
  display: 'dynamic',
  popperConfig: null
XhmikosR's avatar
Dist.  
XhmikosR committed
2361
};
XhmikosR's avatar
XhmikosR committed
2362
var DefaultType$2 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2363
2364
2365
2366
  offset: '(number|string|function)',
  flip: 'boolean',
  boundary: '(string|element)',
  reference: '(string|element)',
XhmikosR's avatar
XhmikosR committed
2367
2368
  display: 'string',
  popperConfig: '(null|object)'
XhmikosR's avatar
Dist.  
XhmikosR committed
2369
};
XhmikosR's avatar
XhmikosR committed
2370
2371
2372
2373
2374
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
2375

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

XhmikosR's avatar
XhmikosR committed
2394
2395
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2396
2397
2398
2399
    if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2400
    var isActive = this._menu.classList.contains(ClassName$4.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
2401

XhmikosR's avatar
XhmikosR committed
2402
    Dropdown.clearMenus();
XhmikosR's avatar
Dist.  
XhmikosR committed
2403
2404
2405
2406
2407

    if (isActive) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2408
2409
2410
2411
2412
2413
2414
2415
2416
    this.show();
  };

  _proto.show = function show() {
    if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || this._menu.classList.contains(ClassName$4.SHOW)) {
      return;
    }

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

    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
2432
      var referenceElement = this._element;
XhmikosR's avatar
Dist.  
XhmikosR committed
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458

      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
2459
2460
2461
      makeArray(document.body.children).forEach(function (elem) {
        return EventHandler.on(elem, 'mouseover', null, noop());
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
2462
2463
2464
2465
2466
2467
2468
2469
2470
    }

    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
2471
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2472

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

XhmikosR's avatar
XhmikosR committed
2478
    var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
XhmikosR committed
2479
    var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2480
2481
      relatedTarget: this._element
    };
XhmikosR's avatar
XhmikosR committed
2482
    var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2483
2484
2485
2486
2487

    if (hideEvent.defaultPrevented) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2488
2489
2490
2491
    if (this._popper) {
      this._popper.destroy();
    }

XhmikosR's avatar
Dist.  
XhmikosR committed
2492
2493
2494
    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
2495
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2496

XhmikosR's avatar
XhmikosR committed
2497
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2498
2499
2500
2501
2502
    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
2503
    if (this._popper) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2504
2505
2506
2507
      this._popper.destroy();

      this._popper = null;
    }
XhmikosR's avatar
XhmikosR committed
2508
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2509

XhmikosR's avatar
XhmikosR committed
2510
  _proto.update = function update() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2511
2512
    this._inNavbar = this._detectNavbar();

XhmikosR's avatar
XhmikosR committed
2513
    if (this._popper) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2514
2515
2516
      this._popper.scheduleUpdate();
    }
  } // Private
XhmikosR's avatar
XhmikosR committed
2517
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2518

XhmikosR's avatar
XhmikosR committed
2519
2520
  _proto._addEventListeners = function _addEventListeners() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2521

XhmikosR's avatar
XhmikosR committed
2522
    EventHandler.on(this._element, Event$5.CLICK, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2523
2524
      event.preventDefault();
      event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
2525
2526

      _this.toggle();
XhmikosR's avatar
Dist.  
XhmikosR committed
2527
    });
XhmikosR's avatar
XhmikosR committed
2528
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2529

XhmikosR's avatar
XhmikosR committed
2530
  _proto._getConfig = function _getConfig(config) {
2531
    config = _objectSpread2({}, this.constructor.Default, {}, Manipulator.getDataAttributes(this._element), {}, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2532
2533
    typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
2534
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2535

XhmikosR's avatar
XhmikosR committed
2536
  _proto._getMenuElement = function _getMenuElement() {
XhmikosR's avatar
XhmikosR committed
2537
    var parent = Dropdown.getParentFromElement(this._element);
2538
    return SelectorEngine.findOne(Selector$4.MENU, parent);
XhmikosR's avatar
XhmikosR committed
2539
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2540

XhmikosR's avatar
XhmikosR committed
2541
2542
2543
  _proto._getPlacement = function _getPlacement() {
    var parentDropdown = this._element.parentNode;
    var placement = AttachmentMap.BOTTOM; // Handle dropup
XhmikosR's avatar
Dist.  
XhmikosR committed
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559

    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
2560
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2561

XhmikosR's avatar
XhmikosR committed
2562
  _proto._detectNavbar = function _detectNavbar() {
XhmikosR's avatar
Dist.  
XhmikosR committed
2563
    return Boolean(SelectorEngine.closest(this._element, '.navbar'));
XhmikosR's avatar
XhmikosR committed
2564
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2565

XhmikosR's avatar
XhmikosR committed
2566
2567
2568
2569
  _proto._getOffset = function _getOffset() {
    var _this2 = this;

    var offset = {};
XhmikosR's avatar
Dist.  
XhmikosR committed
2570
2571

    if (typeof this._config.offset === 'function') {
XhmikosR's avatar
XhmikosR committed
2572
      offset.fn = function (data) {
2573
        data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist.  
XhmikosR committed
2574
2575
2576
2577
2578
2579
2580
        return data;
      };
    } else {
      offset.offset = this._config.offset;
    }

    return offset;
XhmikosR's avatar
XhmikosR committed
2581
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2582

XhmikosR's avatar
XhmikosR committed
2583
2584
  _proto._getPopperConfig = function _getPopperConfig() {
    var popperConfig = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2585
2586
2587
2588
2589
2590
2591
2592
2593
      placement: this._getPlacement(),
      modifiers: {
        offset: this._getOffset(),
        flip: {
          enabled: this._config.flip
        },
        preventOverflow: {
          boundariesElement: this._config.boundary
        }
XhmikosR's avatar
XhmikosR committed
2594
2595
      }
    }; // Disable Popper.js if we have a static display
XhmikosR's avatar
Dist.  
XhmikosR committed
2596
2597
2598
2599
2600
2601
2602

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

XhmikosR's avatar
XhmikosR committed
2603
    return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
XhmikosR's avatar
Dist.  
XhmikosR committed
2604
  } // Static
XhmikosR's avatar
XhmikosR committed
2605
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
2606

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

XhmikosR's avatar
XhmikosR committed
2610
    var _config = typeof config === 'object' ? config : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
2611
2612
2613
2614
2615
2616
2617

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

    if (typeof config === 'string') {
      if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
2618
        throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
2619
2620
2621
2622
      }

      data[config]();
    }
XhmikosR's avatar
XhmikosR committed
2623
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2624

XhmikosR's avatar
XhmikosR committed
2625
  Dropdown.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2626
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2627
      Dropdown.dropdownInterface(this, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
2628
    });
XhmikosR's avatar
XhmikosR committed
2629
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2630

XhmikosR's avatar
XhmikosR committed
2631
  Dropdown.clearMenus = function clearMenus(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2632
2633
2634
2635
    if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
      return;
    }

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

XhmikosR's avatar
XhmikosR committed
2638
    for (var i = 0, len = toggles.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
2639
      var parent = Dropdown.getParentFromElement(toggles[i]);
XhmikosR's avatar
XhmikosR committed
2640
2641
      var context = Data.getData(toggles[i], DATA_KEY$4);
      var relatedTarget = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
        relatedTarget: toggles[i]
      };

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

      if (!context) {
        continue;
      }

XhmikosR's avatar
XhmikosR committed
2653
      var dropdownMenu = context._menu;
XhmikosR's avatar
Dist.  
XhmikosR committed
2654
2655
2656
2657
2658
2659
2660
2661
2662

      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
2663
      var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
2664
2665
2666
2667
2668
2669
2670
2671

      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
2672
2673
2674
        makeArray(document.body.children).forEach(function (elem) {
          return EventHandler.off(elem, 'mouseover', null, noop());
        });
XhmikosR's avatar
Dist.  
XhmikosR committed
2675
2676
2677
      }

      toggles[i].setAttribute('aria-expanded', 'false');
XhmikosR's avatar
XhmikosR committed
2678
2679
2680
2681
2682

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

XhmikosR's avatar
Dist.  
XhmikosR committed
2683
2684
2685
2686
      dropdownMenu.classList.remove(ClassName$4.SHOW);
      parent.classList.remove(ClassName$4.SHOW);
      EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget);
    }
XhmikosR's avatar
XhmikosR committed
2687
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2688

XhmikosR's avatar
XhmikosR committed
2689
2690
  Dropdown.getParentFromElement = function getParentFromElement(element) {
    return getElementFromSelector(element) || element.parentNode;
XhmikosR's avatar
XhmikosR committed
2691
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2692

XhmikosR's avatar
XhmikosR committed
2693
  Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
    // 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
2712
    var parent = Dropdown.getParentFromElement(this);
XhmikosR's avatar
XhmikosR committed
2713
    var isActive = parent.classList.contains(ClassName$4.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
2714
2715
2716

    if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
      if (event.which === ESCAPE_KEYCODE) {
Mark Otto's avatar
dist v5    
Mark Otto committed
2717
        SelectorEngine.findOne(Selector$4.DATA_TOGGLE, parent).focus();
XhmikosR's avatar
Dist.  
XhmikosR committed
2718
2719
      }

XhmikosR's avatar
XhmikosR committed
2720
      Dropdown.clearMenus();
XhmikosR's avatar
Dist.  
XhmikosR committed
2721
2722
2723
      return;
    }

XhmikosR's avatar
XhmikosR committed
2724
    var items = makeArray(SelectorEngine.find(Selector$4.VISIBLE_ITEMS, parent));
XhmikosR's avatar
Dist.  
XhmikosR committed
2725
2726
2727
2728
2729

    if (!items.length) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
2730
    var index = items.indexOf(event.target);
XhmikosR's avatar
Dist.  
XhmikosR committed
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746

    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
2747
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2748

XhmikosR's avatar
XhmikosR committed
2749
  Dropdown.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2750
    return Data.getData(element, DATA_KEY$4);
XhmikosR's avatar
XhmikosR committed
2751
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2752

XhmikosR's avatar
XhmikosR committed
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
  _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
2772
2773
2774
2775
2776
2777
2778
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
2779
2780
2781
2782
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);
XhmikosR's avatar
Dist.  
XhmikosR committed
2783
2784
2785
EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  event.preventDefault();
  event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
2786
  Dropdown.dropdownInterface(this, 'toggle');
XhmikosR's avatar
Dist.  
XhmikosR committed
2787
});
XhmikosR's avatar
XhmikosR committed
2788
2789
2790
EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  return e.stopPropagation();
});
XhmikosR's avatar
XhmikosR committed
2791
var $$5 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
2792
2793
2794
2795
2796
2797
2798
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .dropdown to jQuery only if jQuery is present
 */

2799
2800
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2801
2802
2803
2804
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
2805

XhmikosR's avatar
XhmikosR committed
2806
2807
2808
  $$5.fn[NAME$4].noConflict = function () {
    $$5.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
    return Dropdown.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
2809
2810
2811
2812
2813
2814
2815
2816
2817
  };
}

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

XhmikosR's avatar
XhmikosR committed
2818
2819
2820
2821
2822
2823
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
2824

XhmikosR's avatar
XhmikosR committed
2825
var Default$3 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2826
2827
2828
2829
2830
  backdrop: true,
  keyboard: true,
  focus: true,
  show: true
};
XhmikosR's avatar
XhmikosR committed
2831
var DefaultType$3 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2832
2833
2834
2835
2836
  backdrop: '(boolean|string)',
  keyboard: 'boolean',
  focus: 'boolean',
  show: 'boolean'
};
XhmikosR's avatar
XhmikosR committed
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
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
2849
};
XhmikosR's avatar
XhmikosR committed
2850
var ClassName$5 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2851
2852
2853
2854
2855
2856
2857
  SCROLLABLE: 'modal-dialog-scrollable',
  SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  BACKDROP: 'modal-backdrop',
  OPEN: 'modal-open',
  FADE: 'fade',
  SHOW: 'show'
};
XhmikosR's avatar
XhmikosR committed
2858
var Selector$5 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
2859
2860
2861
2862
2863
2864
2865
  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'
};
XhmikosR's avatar
XhmikosR committed
2866
2867
2868
2869
2870
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
2871

XhmikosR's avatar
XhmikosR committed
2872
2873
2874
2875
var Modal =
/*#__PURE__*/
function () {
  function Modal(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
    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
2889
  var _proto = Modal.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
2890

XhmikosR's avatar
XhmikosR committed
2891
2892
  // Public
  _proto.toggle = function toggle(relatedTarget) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2893
    return this._isShown ? this.hide() : this.show(relatedTarget);
XhmikosR's avatar
XhmikosR committed
2894
2895
2896
2897
  };

  _proto.show = function show(relatedTarget) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2898
2899
2900
2901
2902
2903
2904
2905
2906

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

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

XhmikosR's avatar
XhmikosR committed
2907
2908
    var showEvent = EventHandler.trigger(this._element, Event$6.SHOW, {
      relatedTarget: relatedTarget
XhmikosR's avatar
Dist.  
XhmikosR committed
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
    });

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

    this._isShown = true;

    this._checkScrollbar();

    this._setScrollbar();

    this._adjustDialog();

    this._setEscapeEvent();

    this._setResizeEvent();

XhmikosR's avatar
XhmikosR committed
2927
2928
2929
2930
2931
2932
2933
    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
2934
2935
2936
2937
        }
      });
    });

XhmikosR's avatar
XhmikosR committed
2938
2939
2940
2941
2942
2943
2944
    this._showBackdrop(function () {
      return _this._showElement(relatedTarget);
    });
  };

  _proto.hide = function hide(event) {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
2945
2946
2947
2948
2949
2950
2951
2952
2953

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

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

XhmikosR's avatar
XhmikosR committed
2954
    var hideEvent = EventHandler.trigger(this._element, Event$6.HIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2955

2956
    if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist.  
XhmikosR committed
2957
2958
2959
2960
2961
      return;
    }

    this._isShown = false;

XhmikosR's avatar
XhmikosR committed
2962
    var transition = this._element.classList.contains(ClassName$5.FADE);
XhmikosR's avatar
Dist.  
XhmikosR committed
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979

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

    this._setEscapeEvent();

    this._setResizeEvent();

    EventHandler.off(document, Event$6.FOCUSIN);

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

    EventHandler.off(this._element, Event$6.CLICK_DISMISS);
    EventHandler.off(this._dialog, Event$6.MOUSEDOWN_DISMISS);

    if (transition) {
XhmikosR's avatar
XhmikosR committed
2980
2981
2982
2983
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, function (event) {
        return _this2._hideModal(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
2984
2985
2986
2987
      emulateTransitionEnd(this._element, transitionDuration);
    } else {
      this._hideModal();
    }
XhmikosR's avatar
XhmikosR committed
2988
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
2989

XhmikosR's avatar
XhmikosR committed
2990
2991
2992
2993
  _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
2994
2995
2996
2997
2998
2999
3000
    /**
     * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
     * Do not move `document` in `htmlElements` array
     * It will remove `Event.CLICK_DATA_API` event that should remain
     */

    EventHandler.off(document, Event$6.FOCUSIN);
For faster browsing, not all history is shown. View entire blame