vrembem 3.0.11 → 3.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dev/scripts.js CHANGED
@@ -302,10 +302,10 @@ var Collection = /*#__PURE__*/function () {
302
302
  var _proto = Collection.prototype;
303
303
  _proto.register = function register(item) {
304
304
  try {
305
- var _this2 = this;
306
- return Promise.resolve(_this2.deregister(item)).then(function () {
307
- _this2.collection.push(item);
308
- return _this2.collection;
305
+ var _this = this;
306
+ return Promise.resolve(_this.deregister(item)).then(function () {
307
+ _this.collection.push(item);
308
+ return _this.collection;
309
309
  });
310
310
  } catch (e) {
311
311
  return Promise.reject(e);
@@ -313,29 +313,29 @@ var Collection = /*#__PURE__*/function () {
313
313
  };
314
314
  _proto.deregister = function deregister(ref) {
315
315
  try {
316
- var _this4 = this;
317
- var index = _this4.collection.findIndex(function (entry) {
316
+ var _this2 = this;
317
+ var index = _this2.collection.findIndex(function (entry) {
318
318
  return entry === ref;
319
319
  });
320
320
  if (index >= 0) {
321
- var entry = _this4.collection[index];
321
+ var entry = _this2.collection[index];
322
322
  Object.getOwnPropertyNames(entry).forEach(function (prop) {
323
323
  delete entry[prop];
324
324
  });
325
- _this4.collection.splice(index, 1);
325
+ _this2.collection.splice(index, 1);
326
326
  }
327
- return Promise.resolve(_this4.collection);
327
+ return Promise.resolve(_this2.collection);
328
328
  } catch (e) {
329
329
  return Promise.reject(e);
330
330
  }
331
331
  };
332
332
  _proto.registerCollection = function registerCollection(items) {
333
333
  try {
334
- var _this6 = this;
334
+ var _this3 = this;
335
335
  return Promise.resolve(Promise.all(Array.from(items, function (item) {
336
- _this6.register(item);
336
+ _this3.register(item);
337
337
  }))).then(function () {
338
- return _this6.collection;
338
+ return _this3.collection;
339
339
  });
340
340
  } catch (e) {
341
341
  return Promise.reject(e);
@@ -343,16 +343,16 @@ var Collection = /*#__PURE__*/function () {
343
343
  };
344
344
  _proto.deregisterCollection = function deregisterCollection() {
345
345
  try {
346
- var _temp3 = function _temp3() {
347
- return _this8.collection;
346
+ var _temp2 = function _temp2() {
347
+ return _this4.collection;
348
348
  };
349
- var _this8 = this;
350
- var _temp4 = _for(function () {
351
- return _this8.collection.length > 0;
349
+ var _this4 = this;
350
+ var _temp = _for(function () {
351
+ return _this4.collection.length > 0;
352
352
  }, void 0, function () {
353
- return Promise.resolve(_this8.deregister(_this8.collection[0])).then(function () {});
353
+ return Promise.resolve(_this4.deregister(_this4.collection[0])).then(function () {});
354
354
  });
355
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
355
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
356
356
  } catch (e) {
357
357
  return Promise.reject(e);
358
358
  }
@@ -368,19 +368,29 @@ var Collection = /*#__PURE__*/function () {
368
368
  return Collection;
369
369
  }();
370
370
 
371
+ const not = {
372
+ inert: ':not([inert]):not([inert] *)',
373
+ negTabIndex: ':not([tabindex^="-"])',
374
+ disabled: ':not(:disabled)',
375
+ };
376
+
371
377
  var e = [
372
- 'a[href]:not([tabindex^="-"])',
373
- 'area[href]:not([tabindex^="-"])',
374
- 'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])',
375
- 'input[type="radio"]:not([disabled]):not([tabindex^="-"])',
376
- 'select:not([disabled]):not([tabindex^="-"])',
377
- 'textarea:not([disabled]):not([tabindex^="-"])',
378
- 'button:not([disabled]):not([tabindex^="-"])',
379
- 'iframe:not([tabindex^="-"])',
380
- 'audio[controls]:not([tabindex^="-"])',
381
- 'video[controls]:not([tabindex^="-"])',
382
- '[contenteditable]:not([tabindex^="-"])',
383
- '[tabindex]:not([tabindex^="-"])',
378
+ `a[href]${not.inert}${not.negTabIndex}`,
379
+ `area[href]${not.inert}${not.negTabIndex}`,
380
+ `input:not([type="hidden"]):not([type="radio"])${not.inert}${not.negTabIndex}${not.disabled}`,
381
+ `input[type="radio"]${not.inert}${not.negTabIndex}${not.disabled}`,
382
+ `select${not.inert}${not.negTabIndex}${not.disabled}`,
383
+ `textarea${not.inert}${not.negTabIndex}${not.disabled}`,
384
+ `button${not.inert}${not.negTabIndex}${not.disabled}`,
385
+ `details${not.inert} > summary:first-of-type${not.negTabIndex}`,
386
+ // Discard until Firefox supports `:has()`
387
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
388
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
389
+ `iframe${not.inert}${not.negTabIndex}`,
390
+ `audio[controls]${not.inert}${not.negTabIndex}`,
391
+ `video[controls]${not.inert}${not.negTabIndex}`,
392
+ `[contenteditable]${not.inert}${not.negTabIndex}`,
393
+ `[tabindex]${not.inert}${not.negTabIndex}`,
384
394
  ];
385
395
 
386
396
  var _focusable = /*#__PURE__*/_classPrivateFieldLooseKey("focusable");
@@ -872,23 +882,23 @@ var deregister$2 = function deregister(obj, close) {
872
882
  close = true;
873
883
  }
874
884
  try {
875
- var _temp5 = function _temp5() {
885
+ var _temp4 = function _temp4() {
876
886
  // Return the modified collection.
877
- return _this2.collection;
887
+ return _this.collection;
878
888
  };
879
- var _this2 = this;
889
+ var _this = this;
880
890
  // Return collection if nothing was passed.
881
- if (!obj) return Promise.resolve(_this2.collection);
891
+ if (!obj) return Promise.resolve(_this.collection);
882
892
 
883
893
  // Check if entry has been registered in the collection.
884
- var index = _this2.collection.findIndex(function (entry) {
894
+ var index = _this.collection.findIndex(function (entry) {
885
895
  return entry.id === obj.id;
886
896
  });
887
- var _temp6 = function () {
897
+ var _temp3 = function () {
888
898
  if (index >= 0) {
889
- var _temp7 = function _temp7() {
899
+ var _temp2 = function _temp2() {
890
900
  // Remove entry from local store.
891
- _this2.store.set(_entry.id);
901
+ _this.store.set(_entry.id);
892
902
 
893
903
  // Unmount the MatchMedia functionality.
894
904
  _entry.unmountBreakpoint();
@@ -899,22 +909,22 @@ var deregister$2 = function deregister(obj, close) {
899
909
  });
900
910
 
901
911
  // Remove entry from collection.
902
- _this2.collection.splice(index, 1);
912
+ _this.collection.splice(index, 1);
903
913
  };
904
914
  // Get the collection entry.
905
- var _entry = _this2.collection[index];
915
+ var _entry = _this.collection[index];
906
916
 
907
917
  // If entry is in the opened state.
908
- var _temp8 = function () {
918
+ var _temp = function () {
909
919
  if (close && _entry.state === 'opened') {
910
920
  // Close the drawer.
911
921
  return Promise.resolve(_entry.close(false)).then(function () {});
912
922
  }
913
923
  }();
914
- return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
924
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
915
925
  }
916
926
  }();
917
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6));
927
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
918
928
  } catch (e) {
919
929
  return Promise.reject(e);
920
930
  }
@@ -1018,33 +1028,33 @@ function getDrawerElements(query) {
1018
1028
 
1019
1029
  var initialState = function initialState(entry) {
1020
1030
  try {
1021
- var _this2 = this;
1022
- var _temp3 = function () {
1023
- if (_this2.store.get(entry.id)) {
1024
- var _temp4 = function () {
1025
- if (_this2.store.get(entry.id) === 'opened') {
1031
+ var _this = this;
1032
+ var _temp2 = function () {
1033
+ if (_this.store.get(entry.id)) {
1034
+ var _temp = function () {
1035
+ if (_this.store.get(entry.id) === 'opened') {
1026
1036
  return Promise.resolve(entry.open(false, false)).then(function () {});
1027
1037
  } else {
1028
1038
  return Promise.resolve(entry.close(false, false)).then(function () {});
1029
1039
  }
1030
1040
  }();
1031
- if (_temp4 && _temp4.then) return _temp4.then(function () {});
1032
- } else if (entry.el.classList.contains(_this2.settings.stateOpened)) {
1041
+ if (_temp && _temp.then) return _temp.then(function () {});
1042
+ } else if (entry.el.classList.contains(_this.settings.stateOpened)) {
1033
1043
  // Update drawer state.
1034
1044
  entry.state = 'opened';
1035
1045
  } else {
1036
1046
  // Remove transition state classes.
1037
- entry.el.classList.remove(_this2.settings.stateOpening);
1038
- entry.el.classList.remove(_this2.settings.stateClosing);
1047
+ entry.el.classList.remove(_this.settings.stateOpening);
1048
+ entry.el.classList.remove(_this.settings.stateClosing);
1039
1049
  // Add closed state class.
1040
- entry.el.classList.add(_this2.settings.stateClosed);
1050
+ entry.el.classList.add(_this.settings.stateClosed);
1041
1051
  }
1042
1052
  }();
1043
1053
  // Setup initial state using the following priority:
1044
1054
  // 1. If a store state is available, restore from local store.
1045
1055
  // 2. If opened state class is set, set state to opened.
1046
1056
  // 3. Else, initialize default state.
1047
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
1057
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
1048
1058
  } catch (e) {
1049
1059
  return Promise.reject(e);
1050
1060
  }
@@ -1074,33 +1084,33 @@ var open$2 = function open(query, transition, focus) {
1074
1084
  focus = true;
1075
1085
  }
1076
1086
  try {
1077
- var _temp3 = function _temp3() {
1087
+ var _temp2 = function _temp2() {
1078
1088
  // Set focus to the drawer element if the focus param is true.
1079
1089
  if (focus) {
1080
- updateFocusState$1.call(_this2, drawer);
1090
+ updateFocusState$1.call(_this, drawer);
1081
1091
  }
1082
1092
 
1083
1093
  // Dispatch custom opened event.
1084
1094
  drawer.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
1085
- detail: _this2,
1095
+ detail: _this,
1086
1096
  bubbles: true
1087
1097
  }));
1088
1098
 
1089
1099
  // Return the drawer.
1090
1100
  return drawer;
1091
1101
  };
1092
- var _this2 = this;
1102
+ var _this = this;
1093
1103
  // Get the drawer from collection.
1094
- var drawer = getDrawer.call(_this2, query);
1104
+ var drawer = getDrawer.call(_this, query);
1095
1105
 
1096
1106
  // Get the modal configuration.
1097
- var config = _extends({}, _this2.settings, drawer.settings);
1107
+ var config = _extends({}, _this.settings, drawer.settings);
1098
1108
 
1099
1109
  // Add transition parameter to configuration.
1100
1110
  if (transition !== undefined) config.transition = transition;
1101
1111
 
1102
1112
  // If drawer is closed.
1103
- var _temp4 = function () {
1113
+ var _temp = function () {
1104
1114
  if (drawer.state === 'closed') {
1105
1115
  // Update drawer state.
1106
1116
  drawer.state = 'opening';
@@ -1115,7 +1125,7 @@ var open$2 = function open(query, transition, focus) {
1115
1125
  });
1116
1126
  }
1117
1127
  }();
1118
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1128
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1119
1129
  } catch (e) {
1120
1130
  return Promise.reject(e);
1121
1131
  }
@@ -1126,18 +1136,18 @@ var close$2 = function close(query, transition, focus) {
1126
1136
  focus = true;
1127
1137
  }
1128
1138
  try {
1129
- var _this2 = this;
1139
+ var _this = this;
1130
1140
  // Get the drawer from collection.
1131
- var drawer = getDrawer.call(_this2, query);
1141
+ var drawer = getDrawer.call(_this, query);
1132
1142
 
1133
1143
  // Get the modal configuration.
1134
- var config = _extends({}, _this2.settings, drawer.settings);
1144
+ var config = _extends({}, _this.settings, drawer.settings);
1135
1145
 
1136
1146
  // Add transition parameter to configuration.
1137
1147
  if (transition !== undefined) config.transition = transition;
1138
1148
 
1139
1149
  // If drawer is opened.
1140
- var _temp2 = function () {
1150
+ var _temp = function () {
1141
1151
  if (drawer.state === 'opened') {
1142
1152
  // Update drawer state.
1143
1153
  drawer.state = 'closing';
@@ -1152,7 +1162,7 @@ var close$2 = function close(query, transition, focus) {
1152
1162
 
1153
1163
  // Set focus to the trigger element if the focus param is true.
1154
1164
  if (focus) {
1155
- updateFocusState$1.call(_this2, drawer);
1165
+ updateFocusState$1.call(_this, drawer);
1156
1166
  }
1157
1167
 
1158
1168
  // Update drawer state.
@@ -1160,13 +1170,13 @@ var close$2 = function close(query, transition, focus) {
1160
1170
 
1161
1171
  // Dispatch custom closed event.
1162
1172
  drawer.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
1163
- detail: _this2,
1173
+ detail: _this,
1164
1174
  bubbles: true
1165
1175
  }));
1166
1176
  });
1167
1177
  }
1168
1178
  }();
1169
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
1179
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
1170
1180
  // Return the drawer.
1171
1181
  return drawer;
1172
1182
  }) : drawer);
@@ -1177,15 +1187,15 @@ var close$2 = function close(query, transition, focus) {
1177
1187
 
1178
1188
  var toggle = function toggle(query, transition, focus) {
1179
1189
  try {
1180
- var _this2 = this;
1190
+ var _this = this;
1181
1191
  // Get the drawer from collection.
1182
- var drawer = getDrawer.call(_this2, query);
1192
+ var drawer = getDrawer.call(_this, query);
1183
1193
 
1184
1194
  // Open or close the drawer based on its current state.
1185
1195
  if (drawer.state === 'closed') {
1186
- return Promise.resolve(open$2.call(_this2, drawer, transition, focus));
1196
+ return Promise.resolve(open$2.call(_this, drawer, transition, focus));
1187
1197
  } else {
1188
- return Promise.resolve(close$2.call(_this2, drawer, transition, focus));
1198
+ return Promise.resolve(close$2.call(_this, drawer, transition, focus));
1189
1199
  }
1190
1200
  } catch (e) {
1191
1201
  return Promise.reject(e);
@@ -1194,7 +1204,7 @@ var toggle = function toggle(query, transition, focus) {
1194
1204
 
1195
1205
  var toModal = function toModal(entry) {
1196
1206
  try {
1197
- var _this4 = this;
1207
+ var _this2 = this;
1198
1208
  // Get the drawer configuration.
1199
1209
 
1200
1210
  // Add the modal class.
@@ -1204,16 +1214,16 @@ var toModal = function toModal(entry) {
1204
1214
  entry.dialog.setAttribute('aria-modal', 'true');
1205
1215
 
1206
1216
  // If there isn't a stored state but also has the opened state class...
1207
- if (!_this4.store.get(entry.id) && entry.el.classList.contains(entry.getSetting('stateOpened'))) {
1217
+ if (!_this2.store.get(entry.id) && entry.el.classList.contains(entry.getSetting('stateOpened'))) {
1208
1218
  // Save the opened state in local store.
1209
- _this4.store.set(entry.id, 'opened');
1219
+ _this2.store.set(entry.id, 'opened');
1210
1220
  }
1211
1221
 
1212
1222
  // Modal drawer defaults to closed state.
1213
- return Promise.resolve(close$2.call(_this4, entry, false, false)).then(function () {
1223
+ return Promise.resolve(close$2.call(_this2, entry, false, false)).then(function () {
1214
1224
  // Dispatch custom switch event.
1215
1225
  entry.el.dispatchEvent(new CustomEvent(entry.getSetting('customEventPrefix') + 'switchMode', {
1216
- detail: _this4,
1226
+ detail: _this2,
1217
1227
  bubbles: true
1218
1228
  }));
1219
1229
 
@@ -1226,7 +1236,7 @@ var toModal = function toModal(entry) {
1226
1236
  };
1227
1237
  var toInline = function toInline(entry) {
1228
1238
  try {
1229
- var _this2 = this;
1239
+ var _this = this;
1230
1240
  // Remove the modal class.
1231
1241
  entry.el.classList.remove(entry.getSetting('classModal'));
1232
1242
 
@@ -1234,16 +1244,16 @@ var toInline = function toInline(entry) {
1234
1244
  entry.dialog.removeAttribute('aria-modal');
1235
1245
 
1236
1246
  // Update the global state.
1237
- updateGlobalState(false, _extends({}, _this2.settings, entry.settings));
1247
+ updateGlobalState(false, _extends({}, _this.settings, entry.settings));
1238
1248
 
1239
1249
  // Remove any focus traps.
1240
- _this2.focusTrap.unmount();
1250
+ _this.focusTrap.unmount();
1241
1251
 
1242
1252
  // Setup initial state.
1243
- return Promise.resolve(initialState.call(_this2, entry)).then(function () {
1253
+ return Promise.resolve(initialState.call(_this, entry)).then(function () {
1244
1254
  // Dispatch custom switch event.
1245
1255
  entry.el.dispatchEvent(new CustomEvent(entry.getSetting('customEventPrefix') + 'switchMode', {
1246
- detail: _this2,
1256
+ detail: _this,
1247
1257
  bubbles: true
1248
1258
  }));
1249
1259
 
@@ -1267,11 +1277,11 @@ function switchMode(entry) {
1267
1277
 
1268
1278
  var register$2 = function register(el, dialog) {
1269
1279
  try {
1270
- var _this2 = this;
1280
+ var _this = this;
1271
1281
  // Deregister entry incase it has already been registered.
1272
- return Promise.resolve(deregister$2.call(_this2, el, false)).then(function () {
1282
+ return Promise.resolve(deregister$2.call(_this, el, false)).then(function () {
1273
1283
  // Save root this for use inside methods API.
1274
- var root = _this2;
1284
+ var root = _this;
1275
1285
 
1276
1286
  // Create an instance of the Breakpoint class.
1277
1287
  var breakpoint = new Breakpoint();
@@ -1315,7 +1325,7 @@ var register$2 = function register(el, dialog) {
1315
1325
  el: el,
1316
1326
  dialog: dialog,
1317
1327
  trigger: null,
1318
- settings: getConfig$1(el, _this2.settings.dataConfig),
1328
+ settings: getConfig$1(el, _this.settings.dataConfig),
1319
1329
  get breakpoint() {
1320
1330
  return getBreakpoint.call(root, el);
1321
1331
  },
@@ -1359,7 +1369,7 @@ var register$2 = function register(el, dialog) {
1359
1369
  }
1360
1370
 
1361
1371
  // Add entry to collection.
1362
- _this2.collection.push(entry);
1372
+ _this.collection.push(entry);
1363
1373
 
1364
1374
  // If the entry has a breakpoint...
1365
1375
  var _temp = function () {
@@ -1368,7 +1378,7 @@ var register$2 = function register(el, dialog) {
1368
1378
  entry.mountBreakpoint();
1369
1379
  } else {
1370
1380
  // Else, Setup initial state.
1371
- return Promise.resolve(initialState.call(_this2, entry)).then(function () {});
1381
+ return Promise.resolve(initialState.call(_this, entry)).then(function () {});
1372
1382
  }
1373
1383
  }();
1374
1384
  return _temp && _temp.then ? _temp.then(function () {
@@ -1413,20 +1423,20 @@ var Drawer = /*#__PURE__*/function (_Collection) {
1413
1423
  options = null;
1414
1424
  }
1415
1425
  try {
1416
- var _this3 = this;
1426
+ var _this2 = this;
1417
1427
  // Update settings with passed options.
1418
- if (options) _this3.settings = _extends({}, _this3.settings, options);
1428
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
1419
1429
 
1420
1430
  // Get all the modals.
1421
- var drawers = document.querySelectorAll(_this3.settings.selectorDrawer);
1431
+ var drawers = document.querySelectorAll(_this2.settings.selectorDrawer);
1422
1432
 
1423
1433
  // Register the collections array with modal instances.
1424
- return Promise.resolve(_this3.registerCollection(drawers)).then(function () {
1434
+ return Promise.resolve(_this2.registerCollection(drawers)).then(function () {
1425
1435
  // If eventListeners are enabled, init event listeners.
1426
- if (_this3.settings.eventListeners) {
1427
- _this3.initEventListeners();
1436
+ if (_this2.settings.eventListeners) {
1437
+ _this2.initEventListeners();
1428
1438
  }
1429
- return _this3;
1439
+ return _this2;
1430
1440
  });
1431
1441
  } catch (e) {
1432
1442
  return Promise.reject(e);
@@ -1434,14 +1444,14 @@ var Drawer = /*#__PURE__*/function (_Collection) {
1434
1444
  };
1435
1445
  _proto.destroy = function destroy() {
1436
1446
  try {
1437
- var _this5 = this;
1447
+ var _this3 = this;
1438
1448
  // Remove all entries from the collection.
1439
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
1449
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
1440
1450
  // If eventListeners are enabled, init event listeners.
1441
- if (_this5.settings.eventListeners) {
1442
- _this5.destroyEventListeners();
1451
+ if (_this3.settings.eventListeners) {
1452
+ _this3.destroyEventListeners();
1443
1453
  }
1444
- return _this5;
1454
+ return _this3;
1445
1455
  });
1446
1456
  } catch (e) {
1447
1457
  return Promise.reject(e);
@@ -1609,33 +1619,33 @@ function updateFocusState() {
1609
1619
 
1610
1620
  var handleClick$1 = function handleClick(event) {
1611
1621
  try {
1612
- var _this2 = this;
1622
+ var _this = this;
1613
1623
  // If an open or replace button was clicked, open or replace the modal.
1614
- var trigger = event.target.closest("[data-" + _this2.settings.dataOpen + "], [data-" + _this2.settings.dataReplace + "]");
1624
+ var trigger = event.target.closest("[data-" + _this.settings.dataOpen + "], [data-" + _this.settings.dataReplace + "]");
1615
1625
  if (trigger) {
1616
1626
  event.preventDefault();
1617
1627
  // Save the trigger if it's not coming from inside a modal.
1618
- var fromModal = event.target.closest(_this2.settings.selectorModal);
1619
- if (!fromModal) _this2.trigger = trigger;
1628
+ var fromModal = event.target.closest(_this.settings.selectorModal);
1629
+ if (!fromModal) _this.trigger = trigger;
1620
1630
  // Get the modal.
1621
- var modal = _this2.get(getModalID.call(_this2, trigger));
1631
+ var modal = _this.get(getModalID.call(_this, trigger));
1622
1632
  // Depending on the button type, either open or replace the modal.
1623
- return Promise.resolve(trigger.matches("[data-" + _this2.settings.dataOpen + "]") ? modal.open() : modal.replace());
1633
+ return Promise.resolve(trigger.matches("[data-" + _this.settings.dataOpen + "]") ? modal.open() : modal.replace());
1624
1634
  }
1625
1635
 
1626
1636
  // If a close button was clicked, close the modal.
1627
- trigger = event.target.closest("[data-" + _this2.settings.dataClose + "]");
1637
+ trigger = event.target.closest("[data-" + _this.settings.dataClose + "]");
1628
1638
  if (trigger) {
1629
1639
  event.preventDefault();
1630
1640
  // Get the value of the data attribute.
1631
- var value = trigger.getAttribute("data-" + _this2.settings.dataClose);
1641
+ var value = trigger.getAttribute("data-" + _this.settings.dataClose);
1632
1642
  // Close all if * wildcard is passed, otherwise close a single modal.
1633
- return Promise.resolve(value === '*' ? _this2.closeAll() : _this2.close(value));
1643
+ return Promise.resolve(value === '*' ? _this.closeAll() : _this.close(value));
1634
1644
  }
1635
1645
 
1636
1646
  // If the modal screen was clicked, close the modal.
1637
- if (event.target.matches(_this2.settings.selectorModal) && !event.target.querySelector(_this2.settings.selectorRequired)) {
1638
- return Promise.resolve(_this2.close(getModalID.call(_this2, event.target)));
1647
+ if (event.target.matches(_this.settings.selectorModal) && !event.target.querySelector(_this.settings.selectorRequired)) {
1648
+ return Promise.resolve(_this.close(getModalID.call(_this, event.target)));
1639
1649
  }
1640
1650
  return Promise.resolve();
1641
1651
  } catch (e) {
@@ -1657,21 +1667,21 @@ var deregister$1 = function deregister(obj, close) {
1657
1667
  close = true;
1658
1668
  }
1659
1669
  try {
1660
- var _temp5 = function _temp5() {
1670
+ var _temp4 = function _temp4() {
1661
1671
  // Return the modified collection.
1662
- return _this2.collection;
1672
+ return _this.collection;
1663
1673
  };
1664
- var _this2 = this;
1674
+ var _this = this;
1665
1675
  // Return collection if nothing was passed.
1666
- if (!obj) return Promise.resolve(_this2.collection);
1676
+ if (!obj) return Promise.resolve(_this.collection);
1667
1677
 
1668
1678
  // Check if entry has been registered in the collection.
1669
- var index = _this2.collection.findIndex(function (entry) {
1679
+ var index = _this.collection.findIndex(function (entry) {
1670
1680
  return entry.id === obj.id;
1671
1681
  });
1672
- var _temp6 = function () {
1682
+ var _temp3 = function () {
1673
1683
  if (index >= 0) {
1674
- var _temp7 = function _temp7() {
1684
+ var _temp2 = function _temp2() {
1675
1685
  // Return teleported modal if a reference has been set.
1676
1686
  if (_entry.getSetting('teleport')) {
1677
1687
  _entry.teleportReturn();
@@ -1683,24 +1693,24 @@ var deregister$1 = function deregister(obj, close) {
1683
1693
  });
1684
1694
 
1685
1695
  // Remove entry from collection.
1686
- _this2.collection.splice(index, 1);
1696
+ _this.collection.splice(index, 1);
1687
1697
  };
1688
1698
  // Get the collection entry.
1689
- var _entry = _this2.collection[index];
1699
+ var _entry = _this.collection[index];
1690
1700
 
1691
1701
  // If entry is in the opened state, close it.
1692
- var _temp8 = function () {
1702
+ var _temp = function () {
1693
1703
  if (close && _entry.state === 'opened') {
1694
1704
  return Promise.resolve(_entry.close(false)).then(function () {});
1695
1705
  } else {
1696
1706
  // Remove modal from stack.
1697
- _this2.stack.remove(_entry);
1707
+ _this.stack.remove(_entry);
1698
1708
  }
1699
1709
  }();
1700
- return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
1710
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
1701
1711
  }
1702
1712
  }();
1703
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6));
1713
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
1704
1714
  } catch (e) {
1705
1715
  return Promise.reject(e);
1706
1716
  }
@@ -1711,42 +1721,42 @@ var open$1 = function open(query, transition, focus) {
1711
1721
  focus = true;
1712
1722
  }
1713
1723
  try {
1714
- var _temp3 = function _temp3() {
1724
+ var _temp2 = function _temp2() {
1715
1725
  // Update focus if the focus param is true.
1716
1726
  if (focus) {
1717
- updateFocusState.call(_this2);
1727
+ updateFocusState.call(_this);
1718
1728
  }
1719
1729
 
1720
1730
  // Dispatch custom opened event.
1721
1731
  modal.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
1722
- detail: _this2,
1732
+ detail: _this,
1723
1733
  bubbles: true
1724
1734
  }));
1725
1735
 
1726
1736
  // Return the modal.
1727
1737
  return modal;
1728
1738
  };
1729
- var _this2 = this;
1739
+ var _this = this;
1730
1740
  // Get the modal from collection.
1731
- var modal = getModal.call(_this2, query);
1741
+ var modal = getModal.call(_this, query);
1732
1742
 
1733
1743
  // Get the modal configuration.
1734
- var config = _extends({}, _this2.settings, modal.settings);
1744
+ var config = _extends({}, _this.settings, modal.settings);
1735
1745
 
1736
1746
  // Add transition parameter to configuration.
1737
1747
  if (transition !== undefined) config.transition = transition;
1738
1748
 
1739
1749
  // Maybe add modal to top of stack.
1740
- _this2.stack.moveToTop(modal);
1750
+ _this.stack.moveToTop(modal);
1741
1751
 
1742
1752
  // If modal is closed.
1743
- var _temp4 = function () {
1753
+ var _temp = function () {
1744
1754
  if (modal.state === 'closed') {
1745
1755
  // Update modal state.
1746
1756
  modal.state = 'opening';
1747
1757
 
1748
1758
  // Add modal to stack.
1749
- _this2.stack.add(modal);
1759
+ _this.stack.add(modal);
1750
1760
 
1751
1761
  // Run the open transition.
1752
1762
  return Promise.resolve(openTransition(modal.el, config)).then(function () {
@@ -1755,7 +1765,7 @@ var open$1 = function open(query, transition, focus) {
1755
1765
  });
1756
1766
  }
1757
1767
  }();
1758
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1768
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1759
1769
  } catch (e) {
1760
1770
  return Promise.reject(e);
1761
1771
  }
@@ -1766,18 +1776,18 @@ var close$1 = function close(query, transition, focus) {
1766
1776
  focus = true;
1767
1777
  }
1768
1778
  try {
1769
- var _this2 = this;
1779
+ var _this = this;
1770
1780
  // Get the modal from collection, or top modal in stack if no query is provided.
1771
- var modal = query ? getModal.call(_this2, query) : _this2.active;
1781
+ var modal = query ? getModal.call(_this, query) : _this.active;
1772
1782
 
1773
1783
  // If a modal exists and its state is opened.
1774
- var _temp2 = function () {
1784
+ var _temp = function () {
1775
1785
  if (modal && modal.state === 'opened') {
1776
1786
  // Update modal state.
1777
1787
  modal.state = 'closing';
1778
1788
 
1779
1789
  // Get the modal configuration.
1780
- var config = _extends({}, _this2.settings, modal.settings);
1790
+ var config = _extends({}, _this.settings, modal.settings);
1781
1791
 
1782
1792
  // Add transition parameter to configuration.
1783
1793
  if (transition !== undefined) config.transition = transition;
@@ -1788,11 +1798,11 @@ var close$1 = function close(query, transition, focus) {
1788
1798
  // Run the close transition.
1789
1799
  return Promise.resolve(closeTransition(modal.el, config)).then(function () {
1790
1800
  // Remove modal from stack.
1791
- _this2.stack.remove(modal);
1801
+ _this.stack.remove(modal);
1792
1802
 
1793
1803
  // Update focus if the focus param is true.
1794
1804
  if (focus) {
1795
- updateFocusState.call(_this2);
1805
+ updateFocusState.call(_this);
1796
1806
  }
1797
1807
 
1798
1808
  // Update modal state.
@@ -1800,13 +1810,13 @@ var close$1 = function close(query, transition, focus) {
1800
1810
 
1801
1811
  // Dispatch custom closed event.
1802
1812
  modal.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
1803
- detail: _this2,
1813
+ detail: _this,
1804
1814
  bubbles: true
1805
1815
  }));
1806
1816
  });
1807
1817
  }
1808
1818
  }();
1809
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
1819
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
1810
1820
  // Return the modal.
1811
1821
  return modal;
1812
1822
  }) : modal);
@@ -1817,24 +1827,24 @@ var close$1 = function close(query, transition, focus) {
1817
1827
 
1818
1828
  var closeAll$1 = function closeAll(exclude, transition) {
1819
1829
  try {
1820
- var _this2 = this;
1830
+ var _this = this;
1821
1831
  var result = [];
1822
- return Promise.resolve(Promise.all(_this2.stack.value.map(function (modal) {
1832
+ return Promise.resolve(Promise.all(_this.stack.value.map(function (modal) {
1823
1833
  try {
1824
- var _temp3 = function _temp3() {
1834
+ var _temp2 = function _temp2() {
1825
1835
  modal.trigger = null;
1826
1836
  };
1827
- var _temp4 = function () {
1837
+ var _temp = function () {
1828
1838
  if (exclude && exclude === modal.id) {
1829
1839
  Promise.resolve();
1830
1840
  } else {
1831
- var _push2 = result.push;
1832
- return Promise.resolve(close$1.call(_this2, modal, transition, false)).then(function (_close$call) {
1833
- _push2.call(result, _close$call);
1841
+ var _push = result.push;
1842
+ return Promise.resolve(close$1.call(_this, modal, transition, false)).then(function (_close$call) {
1843
+ _push.call(result, _close$call);
1834
1844
  });
1835
1845
  }
1836
1846
  }();
1837
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1847
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1838
1848
  } catch (e) {
1839
1849
  return Promise.reject(e);
1840
1850
  }
@@ -1851,10 +1861,10 @@ var replace = function replace(query, transition, focus) {
1851
1861
  focus = true;
1852
1862
  }
1853
1863
  try {
1854
- var _temp3 = function _temp3() {
1864
+ var _temp2 = function _temp2() {
1855
1865
  // Update focus if the focus param is true.
1856
1866
  if (focus) {
1857
- updateFocusState.call(_this2);
1867
+ updateFocusState.call(_this);
1858
1868
  }
1859
1869
 
1860
1870
  // Return the modals there were opened and closed.
@@ -1863,27 +1873,27 @@ var replace = function replace(query, transition, focus) {
1863
1873
  closed: resultClosed
1864
1874
  };
1865
1875
  };
1866
- var _this2 = this;
1876
+ var _this = this;
1867
1877
  // Get the modal from collection.
1868
- var modal = getModal.call(_this2, query);
1878
+ var modal = getModal.call(_this, query);
1869
1879
 
1870
1880
  // Setup results for return.
1871
1881
  var resultOpened, resultClosed;
1872
- var _temp4 = function () {
1882
+ var _temp = function () {
1873
1883
  if (modal.state === 'opened') {
1874
1884
  // If modal is open, close all modals except for replacement.
1875
1885
  resultOpened = modal;
1876
- return Promise.resolve(closeAll$1.call(_this2, modal.id, transition)).then(function (_closeAll$call) {
1886
+ return Promise.resolve(closeAll$1.call(_this, modal.id, transition)).then(function (_closeAll$call) {
1877
1887
  resultClosed = _closeAll$call;
1878
1888
  });
1879
1889
  } else {
1880
1890
  // If modal is closed, close all and open replacement at the same time.
1881
- resultOpened = open$1.call(_this2, modal, transition, false);
1882
- resultClosed = closeAll$1.call(_this2, false, transition);
1891
+ resultOpened = open$1.call(_this, modal, transition, false);
1892
+ resultClosed = closeAll$1.call(_this, false, transition);
1883
1893
  return Promise.resolve(Promise.all([resultOpened, resultClosed])).then(function () {});
1884
1894
  }
1885
1895
  }();
1886
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1896
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1887
1897
  } catch (e) {
1888
1898
  return Promise.reject(e);
1889
1899
  }
@@ -1891,11 +1901,11 @@ var replace = function replace(query, transition, focus) {
1891
1901
 
1892
1902
  var register$1 = function register(el, dialog) {
1893
1903
  try {
1894
- var _this2 = this;
1904
+ var _this = this;
1895
1905
  // Deregister entry incase it has already been registered.
1896
- return Promise.resolve(deregister$1.call(_this2, el, false)).then(function () {
1906
+ return Promise.resolve(deregister$1.call(_this, el, false)).then(function () {
1897
1907
  // Save root this for use inside methods API.
1898
- var root = _this2;
1908
+ var root = _this;
1899
1909
 
1900
1910
  // Setup methods API.
1901
1911
  var methods = {
@@ -1947,7 +1957,7 @@ var register$1 = function register(el, dialog) {
1947
1957
  el: el,
1948
1958
  dialog: dialog,
1949
1959
  returnRef: null,
1950
- settings: getConfig$1(el, _this2.settings.dataConfig)
1960
+ settings: getConfig$1(el, _this.settings.dataConfig)
1951
1961
  }, methods);
1952
1962
 
1953
1963
  // Set aria-modal attribute to true.
@@ -1969,19 +1979,19 @@ var register$1 = function register(el, dialog) {
1969
1979
  }
1970
1980
 
1971
1981
  // Add entry to collection.
1972
- _this2.collection.push(entry);
1982
+ _this.collection.push(entry);
1973
1983
 
1974
1984
  // Setup initial state.
1975
1985
  var _temp = function () {
1976
- if (entry.el.classList.contains(_this2.settings.stateOpened)) {
1986
+ if (entry.el.classList.contains(_this.settings.stateOpened)) {
1977
1987
  // Open entry with transitions disabled.
1978
1988
  return Promise.resolve(entry.open(false)).then(function () {});
1979
1989
  } else {
1980
1990
  // Remove transition state classes.
1981
- entry.el.classList.remove(_this2.settings.stateOpening);
1982
- entry.el.classList.remove(_this2.settings.stateClosing);
1991
+ entry.el.classList.remove(_this.settings.stateOpening);
1992
+ entry.el.classList.remove(_this.settings.stateClosing);
1983
1993
  // Add closed state class.
1984
- entry.el.classList.add(_this2.settings.stateClosed);
1994
+ entry.el.classList.add(_this.settings.stateClosed);
1985
1995
  }
1986
1996
  }();
1987
1997
  return _temp && _temp.then ? _temp.then(function () {
@@ -2092,20 +2102,20 @@ var Modal = /*#__PURE__*/function (_Collection) {
2092
2102
  var _proto = Modal.prototype;
2093
2103
  _proto.init = function init(options) {
2094
2104
  try {
2095
- var _this3 = this;
2105
+ var _this2 = this;
2096
2106
  // Update settings with passed options.
2097
- if (options) _this3.settings = _extends({}, _this3.settings, options);
2107
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
2098
2108
 
2099
2109
  // Get all the modals.
2100
- var modals = document.querySelectorAll(_this3.settings.selectorModal);
2110
+ var modals = document.querySelectorAll(_this2.settings.selectorModal);
2101
2111
 
2102
2112
  // Register the collections array with modal instances.
2103
- return Promise.resolve(_this3.registerCollection(modals)).then(function () {
2113
+ return Promise.resolve(_this2.registerCollection(modals)).then(function () {
2104
2114
  // If eventListeners are enabled, init event listeners.
2105
- if (_this3.settings.eventListeners) {
2106
- _this3.initEventListeners();
2115
+ if (_this2.settings.eventListeners) {
2116
+ _this2.initEventListeners();
2107
2117
  }
2108
- return _this3;
2118
+ return _this2;
2109
2119
  });
2110
2120
  } catch (e) {
2111
2121
  return Promise.reject(e);
@@ -2113,17 +2123,17 @@ var Modal = /*#__PURE__*/function (_Collection) {
2113
2123
  };
2114
2124
  _proto.destroy = function destroy() {
2115
2125
  try {
2116
- var _this5 = this;
2126
+ var _this3 = this;
2117
2127
  // Clear stored trigger.
2118
- _this5.trigger = null;
2128
+ _this3.trigger = null;
2119
2129
 
2120
2130
  // Remove all entries from the collection.
2121
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
2131
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
2122
2132
  // If eventListeners are enabled, destroy event listeners.
2123
- if (_this5.settings.eventListeners) {
2124
- _this5.destroyEventListeners();
2133
+ if (_this3.settings.eventListeners) {
2134
+ _this3.destroyEventListeners();
2125
2135
  }
2126
- return _this5;
2136
+ return _this3;
2127
2137
  });
2128
2138
  } catch (e) {
2129
2139
  return Promise.reject(e);
@@ -2163,11 +2173,11 @@ var Modal = /*#__PURE__*/function (_Collection) {
2163
2173
  focus = true;
2164
2174
  }
2165
2175
  try {
2166
- var _this7 = this;
2167
- return Promise.resolve(closeAll$1.call(_this7, exclude, transition)).then(function (result) {
2176
+ var _this4 = this;
2177
+ return Promise.resolve(closeAll$1.call(_this4, exclude, transition)).then(function (result) {
2168
2178
  // Update focus if the focus param is true.
2169
2179
  if (focus) {
2170
- updateFocusState.call(_this7);
2180
+ updateFocusState.call(_this4);
2171
2181
  }
2172
2182
  return result;
2173
2183
  });
@@ -2383,19 +2393,19 @@ function getPopoverElements(query) {
2383
2393
 
2384
2394
  var closeAll = function closeAll() {
2385
2395
  try {
2386
- var _this4 = this;
2396
+ var _this2 = this;
2387
2397
  var result = [];
2388
- return Promise.resolve(Promise.all(_this4.collection.map(function (popover) {
2398
+ return Promise.resolve(Promise.all(_this2.collection.map(function (popover) {
2389
2399
  try {
2390
- var _temp4 = function () {
2400
+ var _temp2 = function () {
2391
2401
  if (popover.state === 'opened') {
2392
- var _push2 = result.push;
2393
- return Promise.resolve(close.call(_this4, popover)).then(function (_close$call) {
2394
- _push2.call(result, _close$call);
2402
+ var _push = result.push;
2403
+ return Promise.resolve(close.call(_this2, popover)).then(function (_close$call) {
2404
+ _push.call(result, _close$call);
2395
2405
  });
2396
2406
  }
2397
2407
  }();
2398
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
2408
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
2399
2409
  } catch (e) {
2400
2410
  return Promise.reject(e);
2401
2411
  }
@@ -2408,11 +2418,11 @@ var closeAll = function closeAll() {
2408
2418
  };
2409
2419
  var close = function close(query) {
2410
2420
  try {
2411
- var _temp2 = function _temp2(popover) {
2421
+ var _temp = function _temp(popover) {
2412
2422
  // If a modal exists and its state is opened.
2413
2423
  if (popover && popover.state === 'opened') {
2414
2424
  // Update state class.
2415
- popover.el.classList.remove(_this2.settings.stateActive);
2425
+ popover.el.classList.remove(_this.settings.stateActive);
2416
2426
 
2417
2427
  // Update accessibility attribute(s).
2418
2428
  if (popover.trigger.hasAttribute('aria-controls')) {
@@ -2431,17 +2441,17 @@ var close = function close(query) {
2431
2441
  popover.state = 'closed';
2432
2442
 
2433
2443
  // Clear root trigger if popover trigger matches.
2434
- if (popover.trigger === _this2.trigger) {
2435
- _this2.trigger = null;
2444
+ if (popover.trigger === _this.trigger) {
2445
+ _this.trigger = null;
2436
2446
  }
2437
2447
  }
2438
2448
 
2439
2449
  // Return the popover.
2440
2450
  return popover;
2441
2451
  };
2442
- var _this2 = this;
2452
+ var _this = this;
2443
2453
  // Get the popover from collection.
2444
- return Promise.resolve(query ? _temp2(getPopover.call(_this2, query)) : Promise.resolve(closeAll.call(_this2)).then(_temp2));
2454
+ return Promise.resolve(query ? _temp(getPopover.call(_this, query)) : Promise.resolve(closeAll.call(_this)).then(_temp));
2445
2455
  } catch (e) {
2446
2456
  return Promise.reject(e);
2447
2457
  }
@@ -2680,7 +2690,7 @@ var round = Math.round;
2680
2690
  function getUAString() {
2681
2691
  var uaData = navigator.userAgentData;
2682
2692
 
2683
- if (uaData != null && uaData.brands) {
2693
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
2684
2694
  return uaData.brands.map(function (item) {
2685
2695
  return item.brand + "/" + item.version;
2686
2696
  }).join(' ');
@@ -2968,7 +2978,6 @@ function effect$1(_ref2) {
2968
2978
  }
2969
2979
 
2970
2980
  if (!contains(state.elements.popper, arrowElement)) {
2971
-
2972
2981
  return;
2973
2982
  }
2974
2983
 
@@ -2999,10 +3008,9 @@ var unsetSides = {
2999
3008
  // Zooming can change the DPR, but it seems to report a value that will
3000
3009
  // cleanly divide the values into the appropriate subpixels.
3001
3010
 
3002
- function roundOffsetsByDPR(_ref) {
3011
+ function roundOffsetsByDPR(_ref, win) {
3003
3012
  var x = _ref.x,
3004
3013
  y = _ref.y;
3005
- var win = window;
3006
3014
  var dpr = win.devicePixelRatio || 1;
3007
3015
  return {
3008
3016
  x: round(x * dpr) / dpr || 0,
@@ -3085,7 +3093,7 @@ function mapToStyles(_ref2) {
3085
3093
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
3086
3094
  x: x,
3087
3095
  y: y
3088
- }) : {
3096
+ }, getWindow(popper)) : {
3089
3097
  x: x,
3090
3098
  y: y
3091
3099
  };
@@ -3111,7 +3119,6 @@ function computeStyles(_ref5) {
3111
3119
  adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
3112
3120
  _options$roundOffsets = options.roundOffsets,
3113
3121
  roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
3114
-
3115
3122
  var commonStyles = {
3116
3123
  placement: getBasePlacement(state.placement),
3117
3124
  variation: getVariation(state.placement),
@@ -4179,8 +4186,7 @@ function popperGenerator(generatorOptions) {
4179
4186
 
4180
4187
  state.orderedModifiers = orderedModifiers.filter(function (m) {
4181
4188
  return m.enabled;
4182
- }); // Validate the provided modifiers so that the consumer will get warned
4183
-
4189
+ });
4184
4190
  runModifierEffects();
4185
4191
  return instance.update();
4186
4192
  },
@@ -4200,7 +4206,6 @@ function popperGenerator(generatorOptions) {
4200
4206
  // anymore
4201
4207
 
4202
4208
  if (!areValidElements(reference, popper)) {
4203
-
4204
4209
  return;
4205
4210
  } // Store the reference and popper rects to be read by modifiers
4206
4211
 
@@ -4225,7 +4230,6 @@ function popperGenerator(generatorOptions) {
4225
4230
  });
4226
4231
 
4227
4232
  for (var index = 0; index < state.orderedModifiers.length; index++) {
4228
-
4229
4233
  if (state.reset === true) {
4230
4234
  state.reset = false;
4231
4235
  index = -1;
@@ -4263,7 +4267,6 @@ function popperGenerator(generatorOptions) {
4263
4267
  };
4264
4268
 
4265
4269
  if (!areValidElements(reference, popper)) {
4266
-
4267
4270
  return instance;
4268
4271
  }
4269
4272
 
@@ -4278,11 +4281,11 @@ function popperGenerator(generatorOptions) {
4278
4281
  // one.
4279
4282
 
4280
4283
  function runModifierEffects() {
4281
- state.orderedModifiers.forEach(function (_ref3) {
4282
- var name = _ref3.name,
4283
- _ref3$options = _ref3.options,
4284
- options = _ref3$options === void 0 ? {} : _ref3$options,
4285
- effect = _ref3.effect;
4284
+ state.orderedModifiers.forEach(function (_ref) {
4285
+ var name = _ref.name,
4286
+ _ref$options = _ref.options,
4287
+ options = _ref$options === void 0 ? {} : _ref$options,
4288
+ effect = _ref.effect;
4286
4289
 
4287
4290
  if (typeof effect === 'function') {
4288
4291
  var cleanupFn = effect({
@@ -4317,17 +4320,17 @@ var createPopper = /*#__PURE__*/popperGenerator({
4317
4320
 
4318
4321
  var deregister = function deregister(obj) {
4319
4322
  try {
4320
- var _this2 = this;
4323
+ var _this = this;
4321
4324
  // Return collection if nothing was passed.
4322
- if (!obj) return Promise.resolve(_this2.collection);
4325
+ if (!obj) return Promise.resolve(_this.collection);
4323
4326
 
4324
4327
  // Check if entry has been registered in the collection.
4325
- var index = _this2.collection.findIndex(function (entry) {
4328
+ var index = _this.collection.findIndex(function (entry) {
4326
4329
  return entry.id === obj.id;
4327
4330
  });
4328
4331
  if (index >= 0) {
4329
4332
  // Get the collection entry.
4330
- var entry = _this2.collection[index];
4333
+ var entry = _this.collection[index];
4331
4334
 
4332
4335
  // If entry is in the opened state, close it.
4333
4336
  if (entry.state === 'opened') {
@@ -4346,11 +4349,11 @@ var deregister = function deregister(obj) {
4346
4349
  });
4347
4350
 
4348
4351
  // Remove entry from collection.
4349
- _this2.collection.splice(index, 1);
4352
+ _this.collection.splice(index, 1);
4350
4353
  }
4351
4354
 
4352
4355
  // Return the modified collection.
4353
- return Promise.resolve(_this2.collection);
4356
+ return Promise.resolve(_this.collection);
4354
4357
  } catch (e) {
4355
4358
  return Promise.reject(e);
4356
4359
  }
@@ -4377,12 +4380,12 @@ function deregisterEventListeners(entry) {
4377
4380
 
4378
4381
  var open = function open(query) {
4379
4382
  try {
4380
- var _this2 = this;
4383
+ var _this = this;
4381
4384
  // Get the popover from collection.
4382
- var popover = getPopover.call(_this2, query);
4385
+ var popover = getPopover.call(_this, query);
4383
4386
 
4384
4387
  // Update state class.
4385
- popover.el.classList.add(_this2.settings.stateActive);
4388
+ popover.el.classList.add(_this.settings.stateActive);
4386
4389
 
4387
4390
  // Update accessibility attribute(s).
4388
4391
  if (popover.trigger.hasAttribute('aria-controls')) {
@@ -4390,7 +4393,7 @@ var open = function open(query) {
4390
4393
  }
4391
4394
 
4392
4395
  // Update popover config.
4393
- popover.config = getConfig(popover.el, _this2.settings);
4396
+ popover.config = getConfig(popover.el, _this.settings);
4394
4397
 
4395
4398
  // Enable popper event listeners and set placement/modifiers.
4396
4399
  popover.popper.setOptions({
@@ -4416,12 +4419,12 @@ var open = function open(query) {
4416
4419
 
4417
4420
  var register = function register(el, trigger) {
4418
4421
  try {
4419
- var _this2 = this;
4422
+ var _this = this;
4420
4423
  // Deregister entry incase it has already been registered.
4421
- deregister.call(_this2, el);
4424
+ deregister.call(_this, el);
4422
4425
 
4423
4426
  // Save root this for use inside methods API.
4424
- var root = _this2;
4427
+ var root = _this;
4425
4428
 
4426
4429
  // Setup methods API.
4427
4430
  var methods = {
@@ -4443,7 +4446,7 @@ var register = function register(el, trigger) {
4443
4446
  el: el,
4444
4447
  trigger: trigger,
4445
4448
  popper: createPopper(trigger, el),
4446
- config: getConfig(el, _this2.settings)
4449
+ config: getConfig(el, _this.settings)
4447
4450
  }, methods);
4448
4451
 
4449
4452
  // Set aria-expanded to false if trigger has aria-controls attribute.
@@ -4452,20 +4455,20 @@ var register = function register(el, trigger) {
4452
4455
  }
4453
4456
 
4454
4457
  // Setup event listeners.
4455
- registerEventListeners.call(_this2, entry);
4458
+ registerEventListeners.call(_this, entry);
4456
4459
 
4457
4460
  // Add entry to collection.
4458
- _this2.collection.push(entry);
4461
+ _this.collection.push(entry);
4459
4462
 
4460
4463
  // Set initial state.
4461
- var _temp2 = function () {
4462
- if (entry.el.classList.contains(_this2.settings.stateActive)) {
4464
+ var _temp = function () {
4465
+ if (entry.el.classList.contains(_this.settings.stateActive)) {
4463
4466
  return Promise.resolve(entry.open()).then(function () {
4464
- handleDocumentClick.call(_this2, entry);
4467
+ handleDocumentClick.call(_this, entry);
4465
4468
  });
4466
4469
  }
4467
4470
  }();
4468
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
4471
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
4469
4472
  // Return the registered entry.
4470
4473
  return entry;
4471
4474
  }) : entry);
@@ -4546,22 +4549,22 @@ var Popover = /*#__PURE__*/function (_Collection) {
4546
4549
  var _proto = Popover.prototype;
4547
4550
  _proto.init = function init(options) {
4548
4551
  try {
4549
- var _this3 = this;
4552
+ var _this2 = this;
4550
4553
  // Update settings with passed options.
4551
- if (options) _this3.settings = _extends({}, _this3.settings, options);
4554
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
4552
4555
 
4553
4556
  // Get all the popovers.
4554
- var popovers = document.querySelectorAll(_this3.settings.selectorPopover);
4557
+ var popovers = document.querySelectorAll(_this2.settings.selectorPopover);
4555
4558
 
4556
4559
  // Register the collections array with popover instances.
4557
- return Promise.resolve(_this3.registerCollection(popovers)).then(function () {
4560
+ return Promise.resolve(_this2.registerCollection(popovers)).then(function () {
4558
4561
  // If eventListeners are enabled, init event listeners.
4559
- if (_this3.settings.eventListeners) {
4562
+ if (_this2.settings.eventListeners) {
4560
4563
  // Pass false to initEventListeners() since registerCollection()
4561
4564
  // already adds event listeners to popovers.
4562
- _this3.initEventListeners(false);
4565
+ _this2.initEventListeners(false);
4563
4566
  }
4564
- return _this3;
4567
+ return _this2;
4565
4568
  });
4566
4569
  } catch (e) {
4567
4570
  return Promise.reject(e);
@@ -4569,33 +4572,33 @@ var Popover = /*#__PURE__*/function (_Collection) {
4569
4572
  };
4570
4573
  _proto.destroy = function destroy() {
4571
4574
  try {
4572
- var _this5 = this;
4575
+ var _this3 = this;
4573
4576
  // Clear stored trigger.
4574
- _this5.trigger = null;
4577
+ _this3.trigger = null;
4575
4578
 
4576
4579
  // Remove all entries from the collection.
4577
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
4580
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
4578
4581
  // If eventListeners are enabled, destroy event listeners.
4579
- if (_this5.settings.eventListeners) {
4582
+ if (_this3.settings.eventListeners) {
4580
4583
  // Pass false to destroyEventListeners() since deregisterCollection()
4581
4584
  // already removes event listeners from popovers.
4582
- _this5.destroyEventListeners(false);
4585
+ _this3.destroyEventListeners(false);
4583
4586
  }
4584
- return _this5;
4587
+ return _this3;
4585
4588
  });
4586
4589
  } catch (e) {
4587
4590
  return Promise.reject(e);
4588
4591
  }
4589
4592
  };
4590
4593
  _proto.initEventListeners = function initEventListeners(processCollection) {
4591
- var _this6 = this;
4594
+ var _this4 = this;
4592
4595
  if (processCollection === void 0) {
4593
4596
  processCollection = true;
4594
4597
  }
4595
4598
  if (processCollection) {
4596
4599
  // Loop through collection and setup event listeners.
4597
4600
  this.collection.forEach(function (popover) {
4598
- registerEventListeners.call(_this6, popover);
4601
+ registerEventListeners.call(_this4, popover);
4599
4602
  });
4600
4603
  }
4601
4604