bootstrap.esm.js 143 KB
Newer Older
XhmikosR's avatar
Dist.  
XhmikosR committed
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
    }

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

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

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

    if (config.sanitize) {
      config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
    }

    return config;
XhmikosR's avatar
XhmikosR committed
4018
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4019

XhmikosR's avatar
XhmikosR committed
4020
4021
  _proto._getDelegateConfig = function _getDelegateConfig() {
    var config = {};
XhmikosR's avatar
Dist.  
XhmikosR committed
4022
4023

    if (this.config) {
XhmikosR's avatar
XhmikosR committed
4024
      for (var key in this.config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4025
4026
4027
4028
4029
4030
4031
        if (this.constructor.Default[key] !== this.config[key]) {
          config[key] = this.config[key];
        }
      }
    }

    return config;
XhmikosR's avatar
XhmikosR committed
4032
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4033

XhmikosR's avatar
XhmikosR committed
4034
4035
4036
  _proto._cleanTipClass = function _cleanTipClass() {
    var tip = this.getTipElement();
    var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
XhmikosR's avatar
Dist.  
XhmikosR committed
4037

XhmikosR's avatar
XhmikosR committed
4038
    if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
4039
4040
4041
4042
4043
      tabClass.map(function (token) {
        return token.trim();
      }).forEach(function (tClass) {
        return tip.classList.remove(tClass);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
4044
    }
XhmikosR's avatar
XhmikosR committed
4045
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4046

XhmikosR's avatar
XhmikosR committed
4047
4048
  _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
    var popperInstance = popperData.instance;
XhmikosR's avatar
Dist.  
XhmikosR committed
4049
4050
4051
4052
    this.tip = popperInstance.popper;

    this._cleanTipClass();

4053
    this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
XhmikosR committed
4054
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4055

XhmikosR's avatar
XhmikosR committed
4056
4057
4058
  _proto._fixTransition = function _fixTransition() {
    var tip = this.getTipElement();
    var initConfigAnimation = this.config.animation;
XhmikosR's avatar
Dist.  
XhmikosR committed
4059
4060
4061
4062
4063

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

XhmikosR's avatar
XhmikosR committed
4064
    tip.classList.remove(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
4065
4066
4067
4068
4069
    this.config.animation = false;
    this.hide();
    this.show();
    this.config.animation = initConfigAnimation;
  } // Static
XhmikosR's avatar
XhmikosR committed
4070
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4071

XhmikosR's avatar
XhmikosR committed
4072
  Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4073
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4074
      var data = Data.getData(this, DATA_KEY$6);
XhmikosR's avatar
Dist.  
XhmikosR committed
4075

XhmikosR's avatar
XhmikosR committed
4076
      var _config = typeof config === 'object' && config;
XhmikosR's avatar
Dist.  
XhmikosR committed
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087

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

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

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4088
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4089
4090
4091
4092
4093
        }

        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
4094
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4095

XhmikosR's avatar
XhmikosR committed
4096
  Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4097
    return Data.getData(element, DATA_KEY$6);
XhmikosR's avatar
XhmikosR committed
4098
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4099

XhmikosR's avatar
XhmikosR committed
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
  _createClass(Tooltip, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$6;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$4;
    }
  }, {
    key: "NAME",
    get: function get() {
      return NAME$6;
    }
  }, {
    key: "DATA_KEY",
    get: function get() {
      return DATA_KEY$6;
    }
  }, {
    key: "Event",
    get: function get() {
XhmikosR's avatar
XhmikosR committed
4123
      return Event$1;
XhmikosR's avatar
XhmikosR committed
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
    }
  }, {
    key: "EVENT_KEY",
    get: function get() {
      return EVENT_KEY$6;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$4;
    }
  }]);

  return Tooltip;
}();
XhmikosR's avatar
XhmikosR committed
4139
4140

var $$7 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
4141
4142
4143
4144
4145
4146
4147
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .tooltip to jQuery only if jQuery is present
 */

4148
4149
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4150
4151
4152
4153
if ($$7) {
  var JQUERY_NO_CONFLICT$6 = $$7.fn[NAME$6];
  $$7.fn[NAME$6] = Tooltip.jQueryInterface;
  $$7.fn[NAME$6].Constructor = Tooltip;
XhmikosR's avatar
Dist.  
XhmikosR committed
4154

XhmikosR's avatar
XhmikosR committed
4155
4156
4157
  $$7.fn[NAME$6].noConflict = function () {
    $$7.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
    return Tooltip.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
4158
4159
4160
4161
4162
4163
4164
4165
4166
  };
}

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

XhmikosR's avatar
XhmikosR committed
4167
var NAME$7 = 'popover';
4168
var VERSION$7 = '5.0.0-alpha1';
XhmikosR's avatar
XhmikosR committed
4169
4170
4171
4172
var DATA_KEY$7 = 'bs.popover';
var EVENT_KEY$7 = "." + DATA_KEY$7;
var CLASS_PREFIX$1 = 'bs-popover';
var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
XhmikosR's avatar
Dist.  
XhmikosR committed
4173

XhmikosR's avatar
XhmikosR committed
4174
var Default$5 = _objectSpread2(_objectSpread2({}, Tooltip.Default), {}, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4175
4176
4177
4178
4179
4180
  placement: 'right',
  trigger: 'click',
  content: '',
  template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
});

XhmikosR's avatar
XhmikosR committed
4181
var DefaultType$5 = _objectSpread2(_objectSpread2({}, Tooltip.DefaultType), {}, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4182
4183
4184
  content: '(string|element|function)'
});

XhmikosR's avatar
XhmikosR committed
4185
var Event$2 = {
XhmikosR's avatar
XhmikosR committed
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
  HIDE: "hide" + EVENT_KEY$7,
  HIDDEN: "hidden" + EVENT_KEY$7,
  SHOW: "show" + EVENT_KEY$7,
  SHOWN: "shown" + EVENT_KEY$7,
  INSERTED: "inserted" + EVENT_KEY$7,
  CLICK: "click" + EVENT_KEY$7,
  FOCUSIN: "focusin" + EVENT_KEY$7,
  FOCUSOUT: "focusout" + EVENT_KEY$7,
  MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  MOUSELEAVE: "mouseleave" + EVENT_KEY$7
XhmikosR's avatar
Dist.  
XhmikosR committed
4196
};
XhmikosR's avatar
XhmikosR committed
4197
4198
4199
4200
var CLASS_NAME_FADE$2 = 'fade';
var CLASS_NAME_SHOW$4 = 'show';
var SELECTOR_TITLE = '.popover-header';
var SELECTOR_CONTENT = '.popover-body';
XhmikosR's avatar
XhmikosR committed
4201
4202
4203
4204
4205
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
4206

XhmikosR's avatar
XhmikosR committed
4207
var Popover = /*#__PURE__*/function (_Tooltip) {
XhmikosR's avatar
XhmikosR committed
4208
  _inheritsLoose(Popover, _Tooltip);
XhmikosR's avatar
Dist.  
XhmikosR committed
4209

XhmikosR's avatar
XhmikosR committed
4210
4211
  function Popover() {
    return _Tooltip.apply(this, arguments) || this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4212
4213
  }

XhmikosR's avatar
XhmikosR committed
4214
  var _proto = Popover.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
4215

XhmikosR's avatar
XhmikosR committed
4216
4217
  // Overrides
  _proto.isWithContent = function isWithContent() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4218
    return this.getTitle() || this._getContent();
XhmikosR's avatar
XhmikosR committed
4219
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4220

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

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

XhmikosR's avatar
XhmikosR committed
4226
    var content = this._getContent();
XhmikosR's avatar
Dist.  
XhmikosR committed
4227
4228
4229
4230
4231

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

XhmikosR's avatar
XhmikosR committed
4232
    this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
XhmikosR's avatar
XhmikosR committed
4233
    tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4);
XhmikosR's avatar
XhmikosR committed
4234
4235
4236
4237
  };

  _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
    this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment);
XhmikosR's avatar
Dist.  
XhmikosR committed
4238
  } // Private
XhmikosR's avatar
XhmikosR committed
4239
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4240

XhmikosR's avatar
XhmikosR committed
4241
  _proto._getContent = function _getContent() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4242
    return this.element.getAttribute('data-content') || this.config.content;
XhmikosR's avatar
XhmikosR committed
4243
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4244

XhmikosR's avatar
XhmikosR committed
4245
4246
4247
  _proto._cleanTipClass = function _cleanTipClass() {
    var tip = this.getTipElement();
    var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
4248
4249

    if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
4250
4251
4252
4253
4254
      tabClass.map(function (token) {
        return token.trim();
      }).forEach(function (tClass) {
        return tip.classList.remove(tClass);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
4255
4256
    }
  } // Static
XhmikosR's avatar
XhmikosR committed
4257
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4258

XhmikosR's avatar
XhmikosR committed
4259
  Popover.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4260
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4261
      var data = Data.getData(this, DATA_KEY$7);
XhmikosR's avatar
Dist.  
XhmikosR committed
4262

XhmikosR's avatar
XhmikosR committed
4263
      var _config = typeof config === 'object' ? config : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275

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

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

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4276
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4277
4278
4279
4280
4281
        }

        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
4282
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4283

XhmikosR's avatar
XhmikosR committed
4284
  Popover.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4285
    return Data.getData(element, DATA_KEY$7);
XhmikosR's avatar
XhmikosR committed
4286
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4287

XhmikosR's avatar
XhmikosR committed
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
  _createClass(Popover, null, [{
    key: "VERSION",
    // Getters
    get: function get() {
      return VERSION$7;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$5;
    }
  }, {
    key: "NAME",
    get: function get() {
      return NAME$7;
    }
  }, {
    key: "DATA_KEY",
    get: function get() {
      return DATA_KEY$7;
    }
  }, {
    key: "Event",
    get: function get() {
XhmikosR's avatar
XhmikosR committed
4312
      return Event$2;
XhmikosR's avatar
XhmikosR committed
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
    }
  }, {
    key: "EVENT_KEY",
    get: function get() {
      return EVENT_KEY$7;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$5;
    }
  }]);

  return Popover;
}(Tooltip);
XhmikosR's avatar
XhmikosR committed
4328
4329

var $$8 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
4330
4331
4332
4333
4334
4335
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 */

4336
4337
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4338
4339
4340
4341
if ($$8) {
  var JQUERY_NO_CONFLICT$7 = $$8.fn[NAME$7];
  $$8.fn[NAME$7] = Popover.jQueryInterface;
  $$8.fn[NAME$7].Constructor = Popover;
XhmikosR's avatar
Dist.  
XhmikosR committed
4342

XhmikosR's avatar
XhmikosR committed
4343
4344
4345
  $$8.fn[NAME$7].noConflict = function () {
    $$8.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
    return Popover.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
4346
4347
4348
4349
4350
4351
4352
4353
4354
  };
}

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

XhmikosR's avatar
XhmikosR committed
4355
var NAME$8 = 'scrollspy';
4356
var VERSION$8 = '5.0.0-alpha1';
XhmikosR's avatar
XhmikosR committed
4357
4358
4359
4360
var DATA_KEY$8 = 'bs.scrollspy';
var EVENT_KEY$8 = "." + DATA_KEY$8;
var DATA_API_KEY$6 = '.data-api';
var Default$6 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
4361
4362
4363
4364
  offset: 10,
  method: 'auto',
  target: ''
};
XhmikosR's avatar
XhmikosR committed
4365
var DefaultType$6 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
4366
4367
4368
4369
  offset: 'number',
  method: 'string',
  target: '(string|element)'
};
XhmikosR's avatar
XhmikosR committed
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
var CLASS_NAME_ACTIVE$2 = 'active';
var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
var SELECTOR_NAV_LINKS = '.nav-link';
var SELECTOR_NAV_ITEMS = '.nav-item';
var SELECTOR_LIST_ITEMS = '.list-group-item';
var SELECTOR_DROPDOWN = '.dropdown';
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
var METHOD_OFFSET = 'offset';
var METHOD_POSITION = 'position';
XhmikosR's avatar
XhmikosR committed
4384
4385
4386
4387
4388
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
4389

XhmikosR's avatar
XhmikosR committed
4390
var ScrollSpy = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
4391
4392
4393
  function ScrollSpy(element, config) {
    var _this = this;

XhmikosR's avatar
Dist.  
XhmikosR committed
4394
4395
4396
    this._element = element;
    this._scrollElement = element.tagName === 'BODY' ? window : element;
    this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
4397
    this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM);
XhmikosR's avatar
Dist.  
XhmikosR committed
4398
4399
4400
4401
    this._offsets = [];
    this._targets = [];
    this._activeTarget = null;
    this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
4402
    EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) {
XhmikosR's avatar
XhmikosR committed
4403
4404
      return _this._process(event);
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
4405
4406
4407
4408
4409
4410
4411
4412
    this.refresh();

    this._process();

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


XhmikosR's avatar
XhmikosR committed
4413
  var _proto = ScrollSpy.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
4414

XhmikosR's avatar
XhmikosR committed
4415
4416
4417
  // Public
  _proto.refresh = function refresh() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4418

XhmikosR's avatar
XhmikosR committed
4419
    var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
XhmikosR's avatar
XhmikosR committed
4420
    var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
XhmikosR's avatar
XhmikosR committed
4421
    var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
XhmikosR's avatar
Dist.  
XhmikosR committed
4422
4423
4424
    this._offsets = [];
    this._targets = [];
    this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
4425
    var targets = SelectorEngine.find(this._selector);
XhmikosR's avatar
XhmikosR committed
4426
4427
4428
    targets.map(function (element) {
      var target;
      var targetSelector = getSelectorFromElement(element);
XhmikosR's avatar
Dist.  
XhmikosR committed
4429
4430
4431
4432
4433
4434

      if (targetSelector) {
        target = SelectorEngine.findOne(targetSelector);
      }

      if (target) {
XhmikosR's avatar
XhmikosR committed
4435
        var targetBCR = target.getBoundingClientRect();
XhmikosR's avatar
Dist.  
XhmikosR committed
4436
4437
4438
4439
4440
4441
4442

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

      return null;
XhmikosR's avatar
XhmikosR committed
4443
4444
4445
4446
4447
4448
4449
4450
    }).filter(function (item) {
      return item;
    }).sort(function (a, b) {
      return a[0] - b[0];
    }).forEach(function (item) {
      _this2._offsets.push(item[0]);

      _this2._targets.push(item[1]);
XhmikosR's avatar
Dist.  
XhmikosR committed
4451
    });
XhmikosR's avatar
XhmikosR committed
4452
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4453

XhmikosR's avatar
XhmikosR committed
4454
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
    Data.removeData(this._element, DATA_KEY$8);
    EventHandler.off(this._scrollElement, EVENT_KEY$8);
    this._element = null;
    this._scrollElement = null;
    this._config = null;
    this._selector = null;
    this._offsets = null;
    this._targets = null;
    this._activeTarget = null;
    this._scrollHeight = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
4466
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4467

XhmikosR's avatar
XhmikosR committed
4468
  _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4469
    config = _objectSpread2(_objectSpread2({}, Default$6), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
4470

XhmikosR's avatar
XhmikosR committed
4471
    if (typeof config.target !== 'string' && isElement(config.target)) {
XhmikosR's avatar
XhmikosR committed
4472
      var id = config.target.id;
XhmikosR's avatar
Dist.  
XhmikosR committed
4473
4474
4475
4476
4477
4478

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

XhmikosR's avatar
XhmikosR committed
4479
      config.target = "#" + id;
XhmikosR's avatar
Dist.  
XhmikosR committed
4480
4481
4482
4483
    }

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

XhmikosR's avatar
XhmikosR committed
4486
  _proto._getScrollTop = function _getScrollTop() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4487
    return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
XhmikosR's avatar
XhmikosR committed
4488
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4489

XhmikosR's avatar
XhmikosR committed
4490
  _proto._getScrollHeight = function _getScrollHeight() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4491
    return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
XhmikosR's avatar
XhmikosR committed
4492
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4493

XhmikosR's avatar
XhmikosR committed
4494
  _proto._getOffsetHeight = function _getOffsetHeight() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4495
    return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
XhmikosR's avatar
XhmikosR committed
4496
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4497

XhmikosR's avatar
XhmikosR committed
4498
4499
  _proto._process = function _process() {
    var scrollTop = this._getScrollTop() + this._config.offset;
XhmikosR's avatar
Dist.  
XhmikosR committed
4500

XhmikosR's avatar
XhmikosR committed
4501
    var scrollHeight = this._getScrollHeight();
XhmikosR's avatar
Dist.  
XhmikosR committed
4502

XhmikosR's avatar
XhmikosR committed
4503
    var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
XhmikosR's avatar
Dist.  
XhmikosR committed
4504
4505
4506
4507
4508
4509

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

    if (scrollTop >= maxScroll) {
XhmikosR's avatar
XhmikosR committed
4510
      var target = this._targets[this._targets.length - 1];
XhmikosR's avatar
Dist.  
XhmikosR committed
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526

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

      return;
    }

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

      this._clear();

      return;
    }

XhmikosR's avatar
XhmikosR committed
4527
    for (var i = this._offsets.length; i--;) {
XhmikosR's avatar
XhmikosR committed
4528
      var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
XhmikosR's avatar
Dist.  
XhmikosR committed
4529
4530
4531
4532
4533

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

XhmikosR's avatar
XhmikosR committed
4536
  _proto._activate = function _activate(target) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4537
4538
4539
4540
    this._activeTarget = target;

    this._clear();

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

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

XhmikosR's avatar
XhmikosR committed
4547
    if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
XhmikosR's avatar
XhmikosR committed
4548
      SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4549
      link.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
4550
4551
    } else {
      // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
4552
4553
      link.classList.add(CLASS_NAME_ACTIVE$2);
      SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach(function (listGroup) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4554
4555
        // Set triggered links parents as active
        // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
XhmikosR's avatar
XhmikosR committed
4556
4557
        SelectorEngine.prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) {
          return item.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4558
        }); // Handle special case when .nav-link is inside .nav-item
XhmikosR's avatar
Dist.  
XhmikosR committed
4559

XhmikosR's avatar
XhmikosR committed
4560
4561
4562
        SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) {
          SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) {
            return item.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4563
          });
XhmikosR's avatar
Dist.  
XhmikosR committed
4564
4565
4566
4567
        });
      });
    }

XhmikosR's avatar
XhmikosR committed
4568
    EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4569
4570
      relatedTarget: target
    });
XhmikosR's avatar
XhmikosR committed
4571
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4572

XhmikosR's avatar
XhmikosR committed
4573
  _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
4574
4575
    SelectorEngine.find(this._selector).filter(function (node) {
      return node.classList.contains(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4576
    }).forEach(function (node) {
XhmikosR's avatar
XhmikosR committed
4577
      return node.classList.remove(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4578
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
4579
  } // Static
XhmikosR's avatar
XhmikosR committed
4580
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4581

XhmikosR's avatar
XhmikosR committed
4582
  ScrollSpy.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4583
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4584
      var data = Data.getData(this, DATA_KEY$8);
XhmikosR's avatar
Dist.  
XhmikosR committed
4585

XhmikosR's avatar
XhmikosR committed
4586
      var _config = typeof config === 'object' && config;
XhmikosR's avatar
Dist.  
XhmikosR committed
4587
4588
4589
4590
4591
4592
4593

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

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4594
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4595
4596
4597
4598
4599
        }

        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
4600
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4601

XhmikosR's avatar
XhmikosR committed
4602
  ScrollSpy.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4603
    return Data.getData(element, DATA_KEY$8);
XhmikosR's avatar
XhmikosR committed
4604
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4605

XhmikosR's avatar
XhmikosR committed
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
  _createClass(ScrollSpy, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$8;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$6;
    }
  }]);

  return ScrollSpy;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
4620
4621
4622
4623
4624
4625
4626
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
4627
4628
EventHandler.on(window, EVENT_LOAD_DATA_API$1, function () {
  SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) {
XhmikosR's avatar
XhmikosR committed
4629
4630
    return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
  });
XhmikosR's avatar
Dist.  
XhmikosR committed
4631
});
XhmikosR's avatar
XhmikosR committed
4632
var $$9 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
4633
4634
4635
4636
4637
4638
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 */

4639
4640
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4641
4642
4643
4644
if ($$9) {
  var JQUERY_NO_CONFLICT$8 = $$9.fn[NAME$8];
  $$9.fn[NAME$8] = ScrollSpy.jQueryInterface;
  $$9.fn[NAME$8].Constructor = ScrollSpy;
XhmikosR's avatar
Dist.  
XhmikosR committed
4645

XhmikosR's avatar
XhmikosR committed
4646
4647
4648
  $$9.fn[NAME$8].noConflict = function () {
    $$9.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
    return ScrollSpy.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
4649
4650
4651
4652
4653
4654
4655
4656
4657
  };
}

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

XhmikosR's avatar
XhmikosR committed
4658
var NAME$9 = 'tab';
4659
var VERSION$9 = '5.0.0-alpha1';
XhmikosR's avatar
XhmikosR committed
4660
4661
4662
var DATA_KEY$9 = 'bs.tab';
var EVENT_KEY$9 = "." + DATA_KEY$9;
var DATA_API_KEY$7 = '.data-api';
XhmikosR's avatar
XhmikosR committed
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
var CLASS_NAME_ACTIVE$3 = 'active';
var CLASS_NAME_DISABLED$2 = 'disabled';
var CLASS_NAME_FADE$3 = 'fade';
var CLASS_NAME_SHOW$5 = 'show';
var SELECTOR_DROPDOWN$1 = '.dropdown';
var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
var SELECTOR_ACTIVE$2 = '.active';
var SELECTOR_ACTIVE_UL = ':scope > li > .active';
var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
XhmikosR's avatar
XhmikosR committed
4680
4681
4682
4683
4684
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
4685

XhmikosR's avatar
XhmikosR committed
4686
var Tab = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
4687
  function Tab(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4688
4689
4690
4691
4692
    this._element = element;
    Data.setData(this._element, DATA_KEY$9, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
4693
  var _proto = Tab.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
4694

XhmikosR's avatar
XhmikosR committed
4695
4696
4697
  // Public
  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4698

XhmikosR's avatar
XhmikosR committed
4699
    if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE$3) || this._element.classList.contains(CLASS_NAME_DISABLED$2)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4700
4701
4702
      return;
    }

XhmikosR's avatar
XhmikosR committed
4703
    var previous;
XhmikosR's avatar
XhmikosR committed
4704
    var target = getElementFromSelector(this._element);
XhmikosR's avatar
XhmikosR committed
4705
4706

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

    if (listElement) {
XhmikosR's avatar
XhmikosR committed
4709
4710
      var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
      previous = SelectorEngine.find(itemSelector, listElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
4711
4712
4713
      previous = previous[previous.length - 1];
    }

XhmikosR's avatar
XhmikosR committed
4714
    var hideEvent = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
4715
4716

    if (previous) {
XhmikosR's avatar
XhmikosR committed
4717
      hideEvent = EventHandler.trigger(previous, EVENT_HIDE$3, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4718
4719
4720
4721
        relatedTarget: this._element
      });
    }

XhmikosR's avatar
XhmikosR committed
4722
    var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4723
4724
4725
4726
4727
4728
4729
4730
4731
      relatedTarget: previous
    });

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

    this._activate(this._element, listElement);

XhmikosR's avatar
XhmikosR committed
4732
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4733
      EventHandler.trigger(previous, EVENT_HIDDEN$3, {
XhmikosR's avatar
XhmikosR committed
4734
        relatedTarget: _this._element
XhmikosR's avatar
Dist.  
XhmikosR committed
4735
      });
XhmikosR's avatar
XhmikosR committed
4736
      EventHandler.trigger(_this._element, EVENT_SHOWN$3, {
XhmikosR's avatar
Dist.  
XhmikosR committed
4737
4738
4739
4740
4741
4742
4743
4744
4745
        relatedTarget: previous
      });
    };

    if (target) {
      this._activate(target, target.parentNode, complete);
    } else {
      complete();
    }
XhmikosR's avatar
XhmikosR committed
4746
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4747

XhmikosR's avatar
XhmikosR committed
4748
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
4749
4750
4751
    Data.removeData(this._element, DATA_KEY$9);
    this._element = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
4752
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4753

XhmikosR's avatar
XhmikosR committed
4754
4755
  _proto._activate = function _activate(element, container, callback) {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4756

XhmikosR's avatar
XhmikosR committed
4757
    var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4758
    var active = activeElements[0];
XhmikosR's avatar
XhmikosR committed
4759
    var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$3);
XhmikosR's avatar
Dist.  
XhmikosR committed
4760

XhmikosR's avatar
XhmikosR committed
4761
4762
4763
    var complete = function complete() {
      return _this2._transitionComplete(element, active, callback);
    };
XhmikosR's avatar
Dist.  
XhmikosR committed
4764
4765

    if (active && isTransitioning) {
XhmikosR's avatar
XhmikosR committed
4766
      var transitionDuration = getTransitionDurationFromElement(active);
XhmikosR's avatar
XhmikosR committed
4767
      active.classList.remove(CLASS_NAME_SHOW$5);
XhmikosR's avatar
Dist.  
XhmikosR committed
4768
4769
4770
4771
4772
      EventHandler.one(active, TRANSITION_END, complete);
      emulateTransitionEnd(active, transitionDuration);
    } else {
      complete();
    }
XhmikosR's avatar
XhmikosR committed
4773
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4774

XhmikosR's avatar
XhmikosR committed
4775
  _proto._transitionComplete = function _transitionComplete(element, active, callback) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4776
    if (active) {
XhmikosR's avatar
XhmikosR committed
4777
4778
      active.classList.remove(CLASS_NAME_ACTIVE$3);
      var dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
XhmikosR's avatar
Dist.  
XhmikosR committed
4779
4780

      if (dropdownChild) {
XhmikosR's avatar
XhmikosR committed
4781
        dropdownChild.classList.remove(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
Dist.  
XhmikosR committed
4782
4783
4784
4785
4786
4787
4788
      }

      if (active.getAttribute('role') === 'tab') {
        active.setAttribute('aria-selected', false);
      }
    }

XhmikosR's avatar
XhmikosR committed
4789
    element.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
Dist.  
XhmikosR committed
4790
4791
4792
4793
4794
4795
4796

    if (element.getAttribute('role') === 'tab') {
      element.setAttribute('aria-selected', true);
    }

    reflow(element);

XhmikosR's avatar
XhmikosR committed
4797
4798
    if (element.classList.contains(CLASS_NAME_FADE$3)) {
      element.classList.add(CLASS_NAME_SHOW$5);
XhmikosR's avatar
Dist.  
XhmikosR committed
4799
4800
    }

XhmikosR's avatar
XhmikosR committed
4801
    if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
XhmikosR's avatar
XhmikosR committed
4802
      var dropdownElement = element.closest(SELECTOR_DROPDOWN$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
4803
4804

      if (dropdownElement) {
XhmikosR's avatar
XhmikosR committed
4805
4806
        SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE$1).forEach(function (dropdown) {
          return dropdown.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
XhmikosR committed
4807
        });
XhmikosR's avatar
Dist.  
XhmikosR committed
4808
4809
4810
4811
4812
4813
4814
4815
4816
      }

      element.setAttribute('aria-expanded', true);
    }

    if (callback) {
      callback();
    }
  } // Static
XhmikosR's avatar
XhmikosR committed
4817
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
4818

XhmikosR's avatar
XhmikosR committed
4819
  Tab.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4820
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4821
      var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
4822
4823
4824

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4825
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
4826
4827
4828
4829
4830
        }

        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
4831
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4832

XhmikosR's avatar
XhmikosR committed
4833
  Tab.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4834
    return Data.getData(element, DATA_KEY$9);
XhmikosR's avatar
XhmikosR committed
4835
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
4836

XhmikosR's avatar
XhmikosR committed
4837
4838
4839
4840
4841
4842
4843
4844
4845
  _createClass(Tab, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$9;
    }
  }]);

  return Tab;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
4846
4847
4848
4849
4850
4851
4852
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
4853
EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4854
  event.preventDefault();
XhmikosR's avatar
XhmikosR committed
4855
  var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
4856
4857
  data.show();
});
XhmikosR's avatar
XhmikosR committed
4858
var $$a = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
4859
4860
4861
4862
4863
4864
4865
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .tab to jQuery only if jQuery is present
 */

4866
4867
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4868
4869
4870
4871
if ($$a) {
  var JQUERY_NO_CONFLICT$9 = $$a.fn[NAME$9];
  $$a.fn[NAME$9] = Tab.jQueryInterface;
  $$a.fn[NAME$9].Constructor = Tab;
XhmikosR's avatar
Dist.  
XhmikosR committed
4872

XhmikosR's avatar
XhmikosR committed
4873
4874
4875
  $$a.fn[NAME$9].noConflict = function () {
    $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
    return Tab.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
4876
4877
4878
4879
4880
4881
4882
4883
4884
  };
}

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

XhmikosR's avatar
XhmikosR committed
4885
var NAME$a = 'toast';
4886
var VERSION$a = '5.0.0-alpha1';
XhmikosR's avatar
XhmikosR committed
4887
4888
var DATA_KEY$a = 'bs.toast';
var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
4889
4890
4891
4892
4893
4894
4895
4896
4897
var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
var CLASS_NAME_FADE$4 = 'fade';
var CLASS_NAME_HIDE = 'hide';
var CLASS_NAME_SHOW$6 = 'show';
var CLASS_NAME_SHOWING = 'showing';
XhmikosR's avatar
XhmikosR committed
4898
var DefaultType$7 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
4899
4900
4901
4902
  animation: 'boolean',
  autohide: 'boolean',
  delay: 'number'
};
XhmikosR's avatar
XhmikosR committed
4903
var Default$7 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
4904
4905
4906
4907
  animation: true,
  autohide: true,
  delay: 500
};
XhmikosR's avatar
XhmikosR committed
4908
var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
XhmikosR's avatar
XhmikosR committed
4909
4910
4911
4912
4913
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
4914

XhmikosR's avatar
XhmikosR committed
4915
var Toast = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
4916
  function Toast(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
    this._element = element;
    this._config = this._getConfig(config);
    this._timeout = null;

    this._setListeners();

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


XhmikosR's avatar
XhmikosR committed
4927
  var _proto = Toast.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
4928

XhmikosR's avatar
XhmikosR committed
4929
4930
4931
  // Public
  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
4932

XhmikosR's avatar
XhmikosR committed
4933
    var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
4934
4935
4936
4937

    if (showEvent.defaultPrevented) {
      return;
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
4938
4939

    if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
4940
      this._element.classList.add(CLASS_NAME_FADE$4);
XhmikosR's avatar
Dist.  
XhmikosR committed
4941
4942
    }

XhmikosR's avatar
XhmikosR committed
4943
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4944
      _this._element.classList.remove(CLASS_NAME_SHOWING);
XhmikosR's avatar
Dist.  
XhmikosR committed
4945

XhmikosR's avatar
XhmikosR committed
4946
      _this._element.classList.add(CLASS_NAME_SHOW$6);
XhmikosR's avatar
Dist.  
XhmikosR committed
4947

XhmikosR's avatar
XhmikosR committed
4948
      EventHandler.trigger(_this._element, EVENT_SHOWN$4);
XhmikosR's avatar
Dist.  
XhmikosR committed
4949

XhmikosR's avatar
XhmikosR committed
4950
4951
4952
4953
      if (_this._config.autohide) {
        _this._timeout = setTimeout(function () {
          _this.hide();
        }, _this._config.delay);
XhmikosR's avatar
Dist.  
XhmikosR committed
4954
4955
4956
      }
    };

XhmikosR's avatar
XhmikosR committed
4957
    this._element.classList.remove(CLASS_NAME_HIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
4958

4959
4960
    reflow(this._element);

XhmikosR's avatar
XhmikosR committed
4961
    this._element.classList.add(CLASS_NAME_SHOWING);
XhmikosR's avatar
Dist.  
XhmikosR committed
4962
4963

    if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
4964
      var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
4965
4966
4967
4968
4969
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
    } else {
      complete();
    }
XhmikosR's avatar
XhmikosR committed
4970
4971
4972
4973
  };

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

XhmikosR's avatar
XhmikosR committed
4975
    if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
4976
4977
4978
      return;
    }

XhmikosR's avatar
XhmikosR committed
4979
    var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
4980
4981
4982
4983

    if (hideEvent.defaultPrevented) {
      return;
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
4984

XhmikosR's avatar
XhmikosR committed
4985
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4986
      _this2._element.classList.add(CLASS_NAME_HIDE);
XhmikosR's avatar
XhmikosR committed
4987

XhmikosR's avatar
XhmikosR committed
4988
      EventHandler.trigger(_this2._element, EVENT_HIDDEN$4);
XhmikosR's avatar
XhmikosR committed
4989
4990
    };

XhmikosR's avatar
XhmikosR committed
4991
    this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
XhmikosR committed
4992
4993
4994
4995
4996

    if (this._config.animation) {
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist.  
XhmikosR committed
4997
    } else {
XhmikosR's avatar
XhmikosR committed
4998
      complete();
XhmikosR's avatar
Dist.  
XhmikosR committed
4999
    }
XhmikosR's avatar
XhmikosR committed
5000
  };
For faster browsing, not all history is shown. View entire blame