@iamproperty/components 2.0.1 → 2.3.1

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.
Files changed (73) hide show
  1. package/README.md +12 -2
  2. package/assets/.DS_Store +0 -0
  3. package/assets/css/core.min.css +1 -1
  4. package/assets/css/core.min.css.map +1 -1
  5. package/assets/css/style.min.css +1 -1
  6. package/assets/css/style.min.css.map +1 -1
  7. package/assets/js/main.js +9 -0
  8. package/assets/js/modules/accordion.js +13 -10
  9. package/assets/js/modules/modal.js +90 -0
  10. package/assets/js/modules/youtubevideo.js +145 -0
  11. package/assets/js/scripts.bundle.js +195 -604
  12. package/assets/js/scripts.bundle.js.map +1 -1
  13. package/assets/js/scripts.bundle.min.js +3 -3
  14. package/assets/js/scripts.bundle.min.js.map +1 -1
  15. package/assets/sass/_components.scss +4 -0
  16. package/assets/sass/_corefiles.scss +3 -2
  17. package/assets/sass/_functions/utilities.scss +41 -1
  18. package/assets/sass/_functions/variables.scss +74 -21
  19. package/assets/sass/components/accordion.scss +80 -3
  20. package/assets/sass/components/charts.scss +562 -0
  21. package/assets/sass/components/header.scss +1 -1
  22. package/assets/sass/components/modal.scss +78 -3
  23. package/assets/sass/components/snapshot.scss +69 -0
  24. package/assets/sass/components/timeline.scss +93 -0
  25. package/assets/sass/elements/buttons.scss +1 -1
  26. package/assets/sass/elements/container.scss +104 -16
  27. package/assets/sass/elements/lists.scss +5 -0
  28. package/assets/sass/elements/tooltips.scss +71 -0
  29. package/assets/sass/elements/type.scss +22 -7
  30. package/assets/sass/foundations/brand.scss +10 -0
  31. package/assets/sass/foundations/circles.scss +18 -11
  32. package/assets/sass/foundations/media.scss +47 -0
  33. package/assets/sass/foundations/reboot.scss +24 -2
  34. package/assets/sass/foundations/root.scss +4 -1
  35. package/dist/components.common.js +651 -5130
  36. package/dist/components.common.js.map +1 -1
  37. package/dist/components.css +1 -1
  38. package/dist/components.css.map +1 -1
  39. package/dist/components.umd.js +651 -5130
  40. package/dist/components.umd.js.map +1 -1
  41. package/dist/components.umd.min.js +1 -1
  42. package/dist/components.umd.min.js.map +1 -1
  43. package/package.json +48 -46
  44. package/src/.DS_Store +0 -0
  45. package/src/components/Accordion/Accordion.vue +0 -18
  46. package/src/components/Accordion/AccordionItem.vue +43 -0
  47. package/src/components/Accordion/README.md +21 -8
  48. package/src/components/Card/Card.vue +13 -13
  49. package/src/components/Card/README.md +7 -7
  50. package/src/components/CardDeck/CardDeck.vue +11 -11
  51. package/src/components/CardDeck/README.md +6 -6
  52. package/src/components/Carousel/Carousel.vue +10 -10
  53. package/src/components/Carousel/README.md +1 -1
  54. package/src/components/Chart/Chart.vue +246 -0
  55. package/src/components/Chart/README.md +18 -0
  56. package/src/components/Header/Header.vue +2 -2
  57. package/src/components/Modal/Modal.vue +15 -4
  58. package/src/components/Modal/README.md +1 -0
  59. package/src/components/Nav/Nav.vue +1 -1
  60. package/src/components/Nav/README.md +3 -3
  61. package/src/components/PropertySearchbar/PropertySearchbar.vue +13 -13
  62. package/src/components/Snapshot/README.md +21 -0
  63. package/src/components/Snapshot/Snapshot.vue +33 -0
  64. package/src/components/Tabs/Tabs.vue +12 -8
  65. package/src/components/Timeline/README.md +18 -0
  66. package/src/components/Timeline/Timeline.vue +25 -0
  67. package/src/elements/Input/Input.vue +15 -15
  68. package/src/elements/Input/README.md +4 -4
  69. package/src/elements/Table/Table.vue +17 -3
  70. package/src/foundations/YoutubeVideo/README.md +11 -0
  71. package/src/foundations/YoutubeVideo/YoutubeVideo.vue +24 -0
  72. package/src/index.js +1 -0
  73. package/assets/sass/elements/media.scss +0 -3
@@ -1,85 +1,12 @@
1
1
  /*!
2
- * Bootstrap v2.0.0
3
- * Copyright 2011-2021 [object Object]
2
+ * Bootstrap v2.2.0
3
+ * Copyright 2011-2022 [object Object]
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (factory) {
7
7
  typeof define === 'function' && define.amd ? define(factory) :
8
8
  factory();
9
- }((function () { 'use strict';
10
-
11
- var global = require('../internals/global');
12
- var DOMIterables = require('../internals/dom-iterables');
13
- var forEach = require('../internals/array-for-each');
14
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
15
-
16
- for (var COLLECTION_NAME in DOMIterables) {
17
- var Collection = global[COLLECTION_NAME];
18
- var CollectionPrototype = Collection && Collection.prototype;
19
- // some Chrome versions have non-configurable methods on DOMTokenList
20
- if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
21
- createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
22
- } catch (error) {
23
- CollectionPrototype.forEach = forEach;
24
- }
25
- }
26
-
27
- var $$7 = require('../internals/export');
28
- var from = require('../internals/array-from');
29
- var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
30
-
31
- var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
32
- // eslint-disable-next-line es/no-array-from -- required for testing
33
- Array.from(iterable);
34
- });
35
-
36
- // `Array.from` method
37
- // https://tc39.es/ecma262/#sec-array.from
38
- $$7({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
39
- from: from
40
- });
41
-
42
- var charAt = require('../internals/string-multibyte').charAt;
43
- var toString$3 = require('../internals/to-string');
44
- var InternalStateModule = require('../internals/internal-state');
45
- var defineIterator = require('../internals/define-iterator');
46
-
47
- var STRING_ITERATOR = 'String Iterator';
48
- var setInternalState = InternalStateModule.set;
49
- var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
50
-
51
- // `String.prototype[@@iterator]` method
52
- // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
53
- defineIterator(String, 'String', function (iterated) {
54
- setInternalState(this, {
55
- type: STRING_ITERATOR,
56
- string: toString$3(iterated),
57
- index: 0
58
- });
59
- // `%StringIteratorPrototype%.next` method
60
- // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
61
- }, function next() {
62
- var state = getInternalState(this);
63
- var string = state.string;
64
- var index = state.index;
65
- var point;
66
- if (index >= string.length) return { value: undefined, done: true };
67
- point = charAt(string, index);
68
- state.index += point.length;
69
- return { value: point, done: false };
70
- });
71
-
72
- var $$6 = require('../internals/export');
73
- var $padStart = require('../internals/string-pad').start;
74
- var WEBKIT_BUG = require('../internals/string-pad-webkit-bug');
75
-
76
- // `String.prototype.padStart` method
77
- // https://tc39.es/ecma262/#sec-string.prototype.padstart
78
- $$6({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
79
- padStart: function padStart(maxLength /* , fillString = ' ' */) {
80
- return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
81
- }
82
- });
9
+ })((function () { 'use strict';
83
10
 
84
11
  /**
85
12
  * Global helper functions to help maintain and enhance framework elements.
@@ -90,7 +17,7 @@
90
17
  * Add global classes used by the CSS and later JavaScript.
91
18
  * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
92
19
  */
93
- var addBodyClasses = function addBodyClasses(body) {
20
+ var addBodyClasses = body => {
94
21
  body.classList.add("js-enabled");
95
22
 
96
23
  if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
@@ -105,9 +32,9 @@
105
32
  */
106
33
 
107
34
 
108
- var checkElements = function checkElements(element) {
35
+ var checkElements = element => {
109
36
  // Tables
110
- Array.from(element.querySelectorAll('table')).forEach(function (table, index) {
37
+ Array.from(element.querySelectorAll('table')).forEach((table, index) => {
111
38
  tableStacked(table);
112
39
  tableWrap(table);
113
40
  });
@@ -118,7 +45,7 @@
118
45
  */
119
46
 
120
47
 
121
- var tableWrap = function tableWrap(table) {
48
+ var tableWrap = table => {
122
49
  if (!table.parentNode.classList.contains('table__wrapper')) {
123
50
  var tableHTML = table.outerHTML;
124
51
  table.outerHTML = "<div class=\"table__wrapper\">".concat(tableHTML, "</div>");
@@ -130,12 +57,12 @@
130
57
  */
131
58
 
132
59
 
133
- var tableStacked = function tableStacked(table) {
60
+ var tableStacked = table => {
134
61
  var colHeadings = Array.from(table.querySelectorAll('thead th'));
135
62
  var colRows = Array.from(table.querySelectorAll('tbody tr'));
136
- colRows.forEach(function (row, index) {
63
+ colRows.forEach((row, index) => {
137
64
  var cells = Array.from(row.querySelectorAll('th, td'));
138
- cells.forEach(function (cell, cellIndex) {
65
+ cells.forEach((cell, cellIndex) => {
139
66
  var heading = colHeadings[cellIndex];
140
67
 
141
68
  if (typeof heading != "undefined") {
@@ -155,73 +82,10 @@
155
82
  !isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail
156
83
  };
157
84
 
158
- var zeroPad = function zeroPad(num, places) {
159
- return String(num).padStart(places, '0');
160
- };
161
-
162
- function _arrayWithHoles(arr) {
163
- if (Array.isArray(arr)) return arr;
164
- }
165
-
166
- function _iterableToArrayLimit(arr, i) {
167
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
168
-
169
- if (_i == null) return;
170
- var _arr = [];
171
- var _n = true;
172
- var _d = false;
173
-
174
- var _s, _e;
175
-
176
- try {
177
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
178
- _arr.push(_s.value);
85
+ var zeroPad = (num, places) => String(num).padStart(places, '0');
179
86
 
180
- if (i && _arr.length === i) break;
181
- }
182
- } catch (err) {
183
- _d = true;
184
- _e = err;
185
- } finally {
186
- try {
187
- if (!_n && _i["return"] != null) _i["return"]();
188
- } finally {
189
- if (_d) throw _e;
190
- }
191
- }
192
-
193
- return _arr;
194
- }
195
-
196
- function _arrayLikeToArray(arr, len) {
197
- if (len == null || len > arr.length) len = arr.length;
198
-
199
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
200
- arr2[i] = arr[i];
201
- }
202
-
203
- return arr2;
204
- }
205
-
206
- function _unsupportedIterableToArray(o, minLen) {
207
- if (!o) return;
208
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
209
- var n = Object.prototype.toString.call(o).slice(8, -1);
210
- if (n === "Object" && o.constructor) n = o.constructor.name;
211
- if (n === "Map" || n === "Set") return Array.from(o);
212
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
213
- }
214
-
215
- function _nonIterableRest() {
216
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
217
- }
218
-
219
- function _slicedToArray(arr, i) {
220
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
221
- }
222
-
223
- var navbar = function navbar(element) {
224
- Array.from(element.querySelectorAll('details')).forEach(function (detail, index) {
87
+ var navbar = element => {
88
+ Array.from(element.querySelectorAll('details')).forEach((detail, index) => {
225
89
  detail.addEventListener('mouseenter', function (e) {
226
90
  if (window.matchMedia('(min-width: 62em)').matches) detail.setAttribute('open', 'true');
227
91
  }, false);
@@ -229,10 +93,8 @@
229
93
  if (window.matchMedia('(min-width: 62em)').matches) detail.removeAttribute('open');
230
94
  }, false);
231
95
  });
232
- var observer = new IntersectionObserver(function (_ref) {
233
- var _ref2 = _slicedToArray(_ref, 1),
234
- e = _ref2[0];
235
-
96
+ var observer = new IntersectionObserver(_ref => {
97
+ var [e] = _ref;
236
98
  return e.target.classList.toggle("is-stuck", e.intersectionRatio < 1);
237
99
  }, {
238
100
  threshold: [1]
@@ -240,406 +102,8 @@
240
102
  observer.observe(element);
241
103
  };
242
104
 
243
- function _typeof(obj) {
244
- "@babel/helpers - typeof";
245
-
246
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
247
- _typeof = function _typeof(obj) {
248
- return typeof obj;
249
- };
250
- } else {
251
- _typeof = function _typeof(obj) {
252
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
253
- };
254
- }
255
-
256
- return _typeof(obj);
257
- }
258
-
259
- var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
260
- var redefine$1 = require('../internals/redefine');
261
- var toString$2 = require('../internals/object-to-string');
262
-
263
- // `Object.prototype.toString` method
264
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
265
- if (!TO_STRING_TAG_SUPPORT) {
266
- redefine$1(Object.prototype, 'toString', toString$2, { unsafe: true });
267
- }
268
-
269
- var redefine = require('../internals/redefine');
270
- var anObject$1 = require('../internals/an-object');
271
- var $toString = require('../internals/to-string');
272
- var fails$4 = require('../internals/fails');
273
- var flags = require('../internals/regexp-flags');
274
-
275
- var TO_STRING = 'toString';
276
- var RegExpPrototype = RegExp.prototype;
277
- var nativeToString = RegExpPrototype[TO_STRING];
278
-
279
- var NOT_GENERIC = fails$4(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
280
- // FF44- RegExp#toString has a wrong name
281
- var INCORRECT_NAME = nativeToString.name != TO_STRING;
282
-
283
- // `RegExp.prototype.toString` method
284
- // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
285
- if (NOT_GENERIC || INCORRECT_NAME) {
286
- redefine(RegExp.prototype, TO_STRING, function toString() {
287
- var R = anObject$1(this);
288
- var p = $toString(R.source);
289
- var rf = R.flags;
290
- var f = $toString(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
291
- return '/' + p + '/' + f;
292
- }, { unsafe: true });
293
- }
294
-
295
- var $$5 = require('../internals/export');
296
- var aFunction = require('../internals/a-function');
297
- var toObject$2 = require('../internals/to-object');
298
- var toLength$2 = require('../internals/to-length');
299
- var toString$1 = require('../internals/to-string');
300
- var fails$3 = require('../internals/fails');
301
- var internalSort = require('../internals/array-sort');
302
- var arrayMethodIsStrict$1 = require('../internals/array-method-is-strict');
303
- var FF = require('../internals/engine-ff-version');
304
- var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
305
- var V8 = require('../internals/engine-v8-version');
306
- var WEBKIT = require('../internals/engine-webkit-version');
307
-
308
- var test = [];
309
- var nativeSort = test.sort;
310
-
311
- // IE8-
312
- var FAILS_ON_UNDEFINED = fails$3(function () {
313
- test.sort(undefined);
314
- });
315
- // V8 bug
316
- var FAILS_ON_NULL = fails$3(function () {
317
- test.sort(null);
318
- });
319
- // Old WebKit
320
- var STRICT_METHOD$1 = arrayMethodIsStrict$1('sort');
321
-
322
- var STABLE_SORT = !fails$3(function () {
323
- // feature detection can be too slow, so check engines versions
324
- if (V8) return V8 < 70;
325
- if (FF && FF > 3) return;
326
- if (IE_OR_EDGE) return true;
327
- if (WEBKIT) return WEBKIT < 603;
328
-
329
- var result = '';
330
- var code, chr, value, index;
331
-
332
- // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
333
- for (code = 65; code < 76; code++) {
334
- chr = String.fromCharCode(code);
335
-
336
- switch (code) {
337
- case 66: case 69: case 70: case 72: value = 3; break;
338
- case 68: case 71: value = 4; break;
339
- default: value = 2;
340
- }
341
-
342
- for (index = 0; index < 47; index++) {
343
- test.push({ k: chr + index, v: value });
344
- }
345
- }
346
-
347
- test.sort(function (a, b) { return b.v - a.v; });
348
-
349
- for (index = 0; index < test.length; index++) {
350
- chr = test[index].k.charAt(0);
351
- if (result.charAt(result.length - 1) !== chr) result += chr;
352
- }
353
-
354
- return result !== 'DGBEFHACIJK';
355
- });
356
-
357
- var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$1 || !STABLE_SORT;
358
-
359
- var getSortCompare = function (comparefn) {
360
- return function (x, y) {
361
- if (y === undefined) return -1;
362
- if (x === undefined) return 1;
363
- if (comparefn !== undefined) return +comparefn(x, y) || 0;
364
- return toString$1(x) > toString$1(y) ? 1 : -1;
365
- };
366
- };
367
-
368
- // `Array.prototype.sort` method
369
- // https://tc39.es/ecma262/#sec-array.prototype.sort
370
- $$5({ target: 'Array', proto: true, forced: FORCED$1 }, {
371
- sort: function sort(comparefn) {
372
- if (comparefn !== undefined) aFunction(comparefn);
373
-
374
- var array = toObject$2(this);
375
-
376
- if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn);
377
-
378
- var items = [];
379
- var arrayLength = toLength$2(array.length);
380
- var itemsLength, index;
381
-
382
- for (index = 0; index < arrayLength; index++) {
383
- if (index in array) items.push(array[index]);
384
- }
385
-
386
- items = internalSort(items, getSortCompare(comparefn));
387
- itemsLength = items.length;
388
- index = 0;
389
-
390
- while (index < itemsLength) array[index] = items[index++];
391
- while (index < arrayLength) delete array[index++];
392
-
393
- return array;
394
- }
395
- });
396
-
397
- var $$4 = require('../internals/export');
398
- var fails$2 = require('../internals/fails');
399
- var isArray = require('../internals/is-array');
400
- var isObject = require('../internals/is-object');
401
- var toObject$1 = require('../internals/to-object');
402
- var toLength$1 = require('../internals/to-length');
403
- var createProperty = require('../internals/create-property');
404
- var arraySpeciesCreate = require('../internals/array-species-create');
405
- var arrayMethodHasSpeciesSupport$1 = require('../internals/array-method-has-species-support');
406
- var wellKnownSymbol$1 = require('../internals/well-known-symbol');
407
- var V8_VERSION = require('../internals/engine-v8-version');
408
-
409
- var IS_CONCAT_SPREADABLE = wellKnownSymbol$1('isConcatSpreadable');
410
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
411
- var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
412
-
413
- // We can't use this feature detection in V8 since it causes
414
- // deoptimization and serious performance degradation
415
- // https://github.com/zloirock/core-js/issues/679
416
- var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails$2(function () {
417
- var array = [];
418
- array[IS_CONCAT_SPREADABLE] = false;
419
- return array.concat()[0] !== array;
420
- });
421
-
422
- var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$1('concat');
423
-
424
- var isConcatSpreadable = function (O) {
425
- if (!isObject(O)) return false;
426
- var spreadable = O[IS_CONCAT_SPREADABLE];
427
- return spreadable !== undefined ? !!spreadable : isArray(O);
428
- };
429
-
430
- var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
431
-
432
- // `Array.prototype.concat` method
433
- // https://tc39.es/ecma262/#sec-array.prototype.concat
434
- // with adding support of @@isConcatSpreadable and @@species
435
- $$4({ target: 'Array', proto: true, forced: FORCED }, {
436
- // eslint-disable-next-line no-unused-vars -- required for `.length`
437
- concat: function concat(arg) {
438
- var O = toObject$1(this);
439
- var A = arraySpeciesCreate(O, 0);
440
- var n = 0;
441
- var i, k, length, len, E;
442
- for (i = -1, length = arguments.length; i < length; i++) {
443
- E = i === -1 ? O : arguments[i];
444
- if (isConcatSpreadable(E)) {
445
- len = toLength$1(E.length);
446
- if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
447
- for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
448
- } else {
449
- if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
450
- createProperty(A, n++, E);
451
- }
452
- }
453
- A.length = n;
454
- return A;
455
- }
456
- });
457
-
458
- var $$3 = require('../internals/export');
459
- var IndexedObject = require('../internals/indexed-object');
460
- var toIndexedObject = require('../internals/to-indexed-object');
461
- var arrayMethodIsStrict = require('../internals/array-method-is-strict');
462
-
463
- var nativeJoin = [].join;
464
-
465
- var ES3_STRINGS = IndexedObject != Object;
466
- var STRICT_METHOD = arrayMethodIsStrict('join', ',');
467
-
468
- // `Array.prototype.join` method
469
- // https://tc39.es/ecma262/#sec-array.prototype.join
470
- $$3({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
471
- join: function join(separator) {
472
- return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
473
- }
474
- });
475
-
476
- var $$2 = require('../internals/export');
477
- var $map = require('../internals/array-iteration').map;
478
- var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
479
-
480
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
481
-
482
- // `Array.prototype.map` method
483
- // https://tc39.es/ecma262/#sec-array.prototype.map
484
- // with adding support of @@species
485
- $$2({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
486
- map: function map(callbackfn /* , thisArg */) {
487
- return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
488
- }
489
- });
490
-
491
- var $$1 = require('../internals/export');
492
- var toObject = require('../internals/to-object');
493
- var nativeKeys = require('../internals/object-keys');
494
- var fails$1 = require('../internals/fails');
495
-
496
- var FAILS_ON_PRIMITIVES = fails$1(function () { nativeKeys(1); });
497
-
498
- // `Object.keys` method
499
- // https://tc39.es/ecma262/#sec-object.keys
500
- $$1({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
501
- keys: function keys(it) {
502
- return nativeKeys(toObject(it));
503
- }
504
- });
505
-
506
- var $ = require('../internals/export');
507
- var exec = require('../internals/regexp-exec');
508
-
509
- // `RegExp.prototype.exec` method
510
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
511
- $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
512
- exec: exec
513
- });
514
-
515
- var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
516
- var fails = require('../internals/fails');
517
- var anObject = require('../internals/an-object');
518
- var toInteger = require('../internals/to-integer');
519
- var toLength = require('../internals/to-length');
520
- var toString = require('../internals/to-string');
521
- var requireObjectCoercible = require('../internals/require-object-coercible');
522
- var advanceStringIndex = require('../internals/advance-string-index');
523
- var getSubstitution = require('../internals/get-substitution');
524
- var regExpExec = require('../internals/regexp-exec-abstract');
525
- var wellKnownSymbol = require('../internals/well-known-symbol');
526
-
527
- var REPLACE = wellKnownSymbol('replace');
528
- var max = Math.max;
529
- var min = Math.min;
530
-
531
- var maybeToString = function (it) {
532
- return it === undefined ? it : String(it);
533
- };
534
-
535
- // IE <= 11 replaces $0 with the whole match, as if it was $&
536
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
537
- var REPLACE_KEEPS_$0 = (function () {
538
- // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
539
- return 'a'.replace(/./, '$0') === '$0';
540
- })();
541
-
542
- // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
543
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
544
- if (/./[REPLACE]) {
545
- return /./[REPLACE]('a', '$0') === '';
546
- }
547
- return false;
548
- })();
549
-
550
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
551
- var re = /./;
552
- re.exec = function () {
553
- var result = [];
554
- result.groups = { a: '7' };
555
- return result;
556
- };
557
- return ''.replace(re, '$<a>') !== '7';
558
- });
559
-
560
- // @@replace logic
561
- fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
562
- var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
563
-
564
- return [
565
- // `String.prototype.replace` method
566
- // https://tc39.es/ecma262/#sec-string.prototype.replace
567
- function replace(searchValue, replaceValue) {
568
- var O = requireObjectCoercible(this);
569
- var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
570
- return replacer !== undefined
571
- ? replacer.call(searchValue, O, replaceValue)
572
- : nativeReplace.call(toString(O), searchValue, replaceValue);
573
- },
574
- // `RegExp.prototype[@@replace]` method
575
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
576
- function (string, replaceValue) {
577
- var rx = anObject(this);
578
- var S = toString(string);
579
-
580
- if (
581
- typeof replaceValue === 'string' &&
582
- replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 &&
583
- replaceValue.indexOf('$<') === -1
584
- ) {
585
- var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
586
- if (res.done) return res.value;
587
- }
588
-
589
- var functionalReplace = typeof replaceValue === 'function';
590
- if (!functionalReplace) replaceValue = toString(replaceValue);
591
-
592
- var global = rx.global;
593
- if (global) {
594
- var fullUnicode = rx.unicode;
595
- rx.lastIndex = 0;
596
- }
597
- var results = [];
598
- while (true) {
599
- var result = regExpExec(rx, S);
600
- if (result === null) break;
601
-
602
- results.push(result);
603
- if (!global) break;
604
-
605
- var matchStr = toString(result[0]);
606
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
607
- }
608
-
609
- var accumulatedResult = '';
610
- var nextSourcePosition = 0;
611
- for (var i = 0; i < results.length; i++) {
612
- result = results[i];
613
-
614
- var matched = toString(result[0]);
615
- var position = max(min(toInteger(result.index), S.length), 0);
616
- var captures = [];
617
- // NOTE: This is equivalent to
618
- // captures = result.slice(1).map(maybeToString)
619
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
620
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
621
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
622
- for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
623
- var namedCaptures = result.groups;
624
- if (functionalReplace) {
625
- var replacerArgs = [matched].concat(captures, position, S);
626
- if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
627
- var replacement = toString(replaceValue.apply(undefined, replacerArgs));
628
- } else {
629
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
630
- }
631
- if (position >= nextSourcePosition) {
632
- accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
633
- nextSourcePosition = position + matched.length;
634
- }
635
- }
636
- return accumulatedResult + S.slice(nextSourcePosition);
637
- }
638
- ];
639
- }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
640
-
641
105
  function table(tableElement) {
642
- if (_typeof(tableElement) != "object") return false;
106
+ if (typeof tableElement != "object") return false;
643
107
  var thead = tableElement.querySelector('thead');
644
108
  var tbody = tableElement.querySelector('tbody');
645
109
  var storedData = tbody.cloneNode(true);
@@ -653,7 +117,7 @@
653
117
  var sortTable = function sortTable(sortBy, sort) {
654
118
  // Create an array from the table rows, the index created is then used to sort the array
655
119
  var tableArr = [];
656
- Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRow, index) {
120
+ Array.from(tbody.querySelectorAll('tr')).forEach((tableRow, index) => {
657
121
  var rowIndex = tableRow.querySelector('td[data-label="' + sortBy + '"], th[data-label="' + sortBy + '"]').textContent;
658
122
  if (isNumeric(rowIndex)) rowIndex = zeroPad(rowIndex, 10);
659
123
  var dataRow = {
@@ -663,14 +127,12 @@
663
127
  tableArr.push(dataRow);
664
128
  }); // Sort array
665
129
 
666
- tableArr.sort(function (a, b) {
667
- return a.index > b.index ? 1 : -1;
668
- }); // Reverse if descending
130
+ tableArr.sort((a, b) => a.index > b.index ? 1 : -1); // Reverse if descending
669
131
 
670
132
  if (sort == "descending") tableArr = tableArr.reverse(); // Create a string to return and populate the tbody
671
133
 
672
134
  var strTbody = '';
673
- tableArr.forEach(function (tableRow, index) {
135
+ tableArr.forEach((tableRow, index) => {
674
136
  strTbody += tableRow.row.outerHTML;
675
137
  });
676
138
  tbody.innerHTML = strTbody; // Dispatch the sortable event
@@ -685,7 +147,7 @@
685
147
  // Get current sort order
686
148
  var sort = target.getAttribute('aria-sort') == "ascending" ? "descending" : "ascending"; // unset sort attributes
687
149
 
688
- Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
150
+ Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
689
151
  col.setAttribute('aria-sort', 'none');
690
152
  }); // Set the sort order attribute
691
153
 
@@ -695,7 +157,7 @@
695
157
  tableElement.setAttribute('data-sortBy', target.textContent); // Sort the table
696
158
 
697
159
  sortTable(target.textContent, sort);
698
- Array.from(tableElement.querySelectorAll('tr[draggable]')).forEach(function (tableRow, index) {
160
+ Array.from(tableElement.querySelectorAll('tr[draggable]')).forEach((tableRow, index) => {
699
161
  tableRow.removeAttribute('draggable');
700
162
  });
701
163
  break;
@@ -705,7 +167,7 @@
705
167
 
706
168
  if (tableElement.getAttribute('data-sortBy')) {
707
169
  var sort = tableElement.getAttribute('data-sort') == "ascending" ? "descending" : "ascending";
708
- Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
170
+ Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
709
171
  if (col.textContent == tableElement.getAttribute('data-sortBy')) {
710
172
  col.setAttribute('aria-sort', sort);
711
173
  col.click();
@@ -726,8 +188,8 @@
726
188
  var filterColumns = Array.from(tableElement.querySelectorAll('th[data-filterable]')); // Populate a list of searchable terms from the cells of the columns that could be used as a filter
727
189
 
728
190
  var searchableTerms = {};
729
- filterColumns.forEach(function (columnHeading, index) {
730
- Array.from(tableElement.querySelectorAll('td[data-label="' + columnHeading.textContent + '"]')).forEach(function (label, index) {
191
+ filterColumns.forEach((columnHeading, index) => {
192
+ Array.from(tableElement.querySelectorAll('td[data-label="' + columnHeading.textContent + '"]')).forEach((label, index) => {
731
193
  searchableTerms[label.textContent] = label.textContent;
732
194
  });
733
195
  }); // Create the form
@@ -736,11 +198,7 @@
736
198
 
737
199
  var checkboxClass = filterColumns.length == 1 ? "d-none" : "d-sm-flex"; // Hide controls when only one filter is chosen
738
200
 
739
- form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(function (term) {
740
- return "<option value=\"".concat(term, "\"></option>");
741
- }).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(function (column) {
742
- return "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>");
743
- }).join(""), "\n</div>"); // Add before the actual table
201
+ form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(column => "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>")).join(""), "\n</div>"); // Add before the actual table
744
202
 
745
203
  tableElement.prepend(form);
746
204
  };
@@ -748,10 +206,10 @@
748
206
  var filterTable = function filterTable(searchTerm) {
749
207
  // Create an array of rows that match the search term
750
208
  var tableArr = [];
751
- Array.from(storedData.querySelectorAll('tr')).forEach(function (tableRow, index) {
209
+ Array.from(storedData.querySelectorAll('tr')).forEach((tableRow, index) => {
752
210
  // We want one long search string per row including each filterable table cell
753
211
  var rowSearchString = '';
754
- Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach(function (label, index) {
212
+ Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach((label, index) => {
755
213
  rowSearchString += tableRow.querySelector('td[data-label="' + label.textContent + '"]').textContent + ' | ';
756
214
  }); // Check if the table row search string contains the search term
757
215
 
@@ -764,7 +222,7 @@
764
222
  }); // Create a string to return and populate the tbody
765
223
 
766
224
  var strTbody = '';
767
- tableArr.forEach(function (tableRow, index) {
225
+ tableArr.forEach((tableRow, index) => {
768
226
  strTbody += tableRow.row.outerHTML;
769
227
  });
770
228
  tbody.innerHTML = strTbody; // Dispatch the filter event.
@@ -775,21 +233,19 @@
775
233
  var createFilterList = function createFilterList() {
776
234
  // Check which options are checked
777
235
  var filterOptions = [];
778
- Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach(function (label, index) {
236
+ Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach((label, index) => {
779
237
  filterOptions.push(label.textContent);
780
238
  }); // Build up the list of searchable terms
781
239
 
782
240
  var searchableTerms = [];
783
- filterOptions.forEach(function (option, index) {
784
- Array.from(tableElement.querySelectorAll('td[data-label="' + option + '"]')).forEach(function (label, index) {
241
+ filterOptions.forEach((option, index) => {
242
+ Array.from(tableElement.querySelectorAll('td[data-label="' + option + '"]')).forEach((label, index) => {
785
243
  searchableTerms[label.textContent] = label.textContent;
786
244
  });
787
245
  }); // Rebuild the list
788
246
 
789
247
  var dataList = tableElement.querySelector('datalist');
790
- dataList.innerHTML = Object.keys(searchableTerms).map(function (term) {
791
- return "<option value=\"".concat(term, "\"></option>");
792
- }).join("");
248
+ dataList.innerHTML = Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join("");
793
249
  }; // On page load check if filters are needed
794
250
 
795
251
 
@@ -931,7 +387,7 @@
931
387
 
932
388
 
933
389
  var setReorderRows = function setReorderRows() {
934
- Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRow, index) {
390
+ Array.from(tbody.querySelectorAll('tr')).forEach((tableRow, index) => {
935
391
  // Create column if not already created
936
392
  if (tableRow.querySelector('[data-label="Order"]') == null) {
937
393
  var orderColumn = document.createElement('th');
@@ -960,7 +416,7 @@
960
416
  for (var target = e.target; target && target != this; target = target.parentNode) {
961
417
  if (target.matches('.table-order-reset')) {
962
418
  // unset sort attributes
963
- Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
419
+ Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
964
420
  col.setAttribute('aria-sort', 'none');
965
421
  }); // Save the sort options on the table element so that it can be re-sorted later
966
422
 
@@ -968,7 +424,7 @@
968
424
  tableElement.removeAttribute('data-sortBy'); // Sort the table
969
425
 
970
426
  sortTable('Order', 'ascending');
971
- Array.from(tableElement.querySelectorAll('tbody tr')).forEach(function (tableRow, index) {
427
+ Array.from(tableElement.querySelectorAll('tbody tr')).forEach((tableRow, index) => {
972
428
  tableRow.setAttribute('draggable', 'true');
973
429
  });
974
430
  break;
@@ -1009,7 +465,7 @@
1009
465
  draggedRow.parentNode.removeChild(draggedRow);
1010
466
  if (draggedRow.getAttribute('data-order') > target.getAttribute('data-order')) target.parentNode.insertBefore(draggedRow, target);else target.parentNode.insertBefore(draggedRow, target.nextElementSibling); // Re label the rows
1011
467
 
1012
- Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRowOrder, index) {
468
+ Array.from(tbody.querySelectorAll('tr')).forEach((tableRowOrder, index) => {
1013
469
  tableRowOrder.classList.remove('tr--dragging');
1014
470
  tableRowOrder.classList.remove('tr--dropable');
1015
471
  tableRowOrder.querySelector('th').innerHTML = index + 1;
@@ -1064,18 +520,20 @@
1064
520
 
1065
521
  function accordion(accordionElement) {
1066
522
  // Fetch all the details element.
1067
- var details = accordionElement.querySelectorAll("details"); // Add the onclick listeners.
1068
-
1069
- details.forEach(function (targetDetail) {
1070
- targetDetail.addEventListener("click", function () {
1071
- // Close all the details that are not targetDetail.
1072
- details.forEach(function (detail) {
1073
- if (detail !== targetDetail) {
1074
- detail.removeAttribute("open");
1075
- }
523
+ if (!accordionElement.classList.contains('accordion--keep-open')) {
524
+ var details = accordionElement.querySelectorAll(":scope > details"); // Add the onclick listeners.
525
+
526
+ details.forEach(targetDetail => {
527
+ targetDetail.addEventListener("click", () => {
528
+ // Close all the details that are not targetDetail.
529
+ details.forEach(detail => {
530
+ if (detail !== targetDetail) {
531
+ detail.removeAttribute("open");
532
+ }
533
+ });
1076
534
  });
1077
535
  });
1078
- });
536
+ }
1079
537
 
1080
538
  if (window.location.hash && document.querySelector(window.location.hash + ':not([open]) summary')) {
1081
539
  var detail = document.querySelector(window.location.hash + ' summary');
@@ -1166,7 +624,7 @@
1166
624
  var scrollLeft = carouselInner.scrollLeft;
1167
625
  var targetSlide = Math.round(scrollLeft / scrollWidth * itemCount) + 1;
1168
626
  var lastItemOffset = carouselElement.querySelector('.carousel__item:last-child').offsetLeft;
1169
- Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach(function (link, index) {
627
+ Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach((link, index) => {
1170
628
  link.classList.remove('active');
1171
629
  });
1172
630
  carouselElement.querySelector('.control-' + targetSlide).classList.add('active'); // Disable the previous button
@@ -1181,7 +639,7 @@
1181
639
  for (var target = e.target; target && target != this; target = target.parentNode) {
1182
640
  if (target.matches('.carousel__controls a')) {
1183
641
  e.preventDefault();
1184
- Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach(function (link, index) {
642
+ Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach((link, index) => {
1185
643
  link.classList.remove('active');
1186
644
  });
1187
645
  target.classList.add('active');
@@ -1222,17 +680,17 @@
1222
680
  var min = parseInt(inputWrapper.querySelector('[data-min] select,[data-min] input').value);
1223
681
  var max = parseInt(inputWrapper.querySelector('[data-max] select,[data-max] input').value); // Set attributes for input fields
1224
682
 
1225
- Array.from(inputWrapper.querySelectorAll('[data-min] input')).forEach(function (input, index) {
683
+ Array.from(inputWrapper.querySelectorAll('[data-min] input')).forEach((input, index) => {
1226
684
  input.setAttribute('max', max);
1227
685
  });
1228
- Array.from(inputWrapper.querySelectorAll('[data-max] input')).forEach(function (input, index) {
686
+ Array.from(inputWrapper.querySelectorAll('[data-max] input')).forEach((input, index) => {
1229
687
  input.setAttribute('min', min);
1230
688
  }); // Hide select options if they are higher or lower than the min and max values
1231
689
 
1232
- Array.from(inputWrapper.querySelectorAll('[data-min] select option')).forEach(function (option, index) {
690
+ Array.from(inputWrapper.querySelectorAll('[data-min] select option')).forEach((option, index) => {
1233
691
  if (parseInt(option.getAttribute('value')) > max) option.classList.add('d-none');else option.classList.remove('d-none');
1234
692
  });
1235
- Array.from(inputWrapper.querySelectorAll('[data-max] select option')).forEach(function (option, index) {
693
+ Array.from(inputWrapper.querySelectorAll('[data-max] select option')).forEach((option, index) => {
1236
694
  if (parseInt(option.getAttribute('value')) < min) option.classList.add('d-none');else option.classList.remove('d-none');
1237
695
  });
1238
696
  }, false);
@@ -1241,40 +699,173 @@
1241
699
 
1242
700
  function form(formElement) {
1243
701
  // Check for input range groups
1244
- Array.from(formElement.querySelectorAll('[data-input-range]')).forEach(function (arrayElement, index) {
702
+ Array.from(formElement.querySelectorAll('[data-input-range]')).forEach((arrayElement, index) => {
1245
703
  inputRange(arrayElement);
1246
704
  });
1247
705
  }
1248
706
 
707
+ /**
708
+ * Integrate YouTube videos as a way of hosting videos without the overhead and worry surrounding hosting vides. i.e. file sizes, performance and accessibility.
709
+ */
710
+ class youtubeVideo {
711
+ /** @param {HTMLElement} embed dom element */
712
+ constructor(embed) {
713
+ var createEmbed = this.createEmbed; // If the scripts is already loaded then lets just create the embed
714
+
715
+ if (document.body.classList.contains('youtubeLoaded')) {
716
+ embed.addEventListener('click', function (e) {
717
+ // loop parent nodes from the target to the delegation node
718
+ for (var target = e.target; target && target != this; target = target.parentNode) {
719
+ if (target.matches('a:not([data-modal-youtube]')) {
720
+ e.preventDefault();
721
+ createEmbed(embed, target);
722
+ break;
723
+ }
724
+ }
725
+ }, false);
726
+ } else {
727
+ this.loadScripts(embed, this.createEmbed);
728
+ }
729
+ }
730
+ /**
731
+ * Load the YouTube scripts before trying to create the embed
732
+ * @param {HTMLElement} embed dom element
733
+ * @param {Function} createEmbed function to create the embed after script loaded.
734
+ */
735
+
736
+
737
+ loadScripts(embed, createEmbed) {
738
+ return new Promise((resolve, reject) => {
739
+ var image = new Image();
740
+
741
+ image.onload = function () {
742
+ // This code loads the IFrame Player API code asynchronously.
743
+ var tag = document.createElement('script');
744
+ tag.src = "https://www.youtube.com/iframe_api";
745
+ var firstScriptTag = document.getElementsByTagName('script')[0];
746
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
747
+ document.body.classList.add('youtubeLoaded');
748
+ resolve(true); // script has loaded, you can now use it safely
749
+
750
+ tag.onload = () => {
751
+ embed.addEventListener('click', function (e) {
752
+ // loop parent nodes from the target to the delegation node
753
+ for (var target = e.target; target && target != this; target = target.parentNode) {
754
+ if (target.matches('a:not([data-modal-youtube]')) {
755
+ e.preventDefault();
756
+ createEmbed(embed, target);
757
+ break;
758
+ }
759
+ }
760
+ }, false);
761
+ };
762
+ };
763
+
764
+ image.onerror = function () {
765
+ reject(false);
766
+ };
767
+
768
+ image.src = "https://youtube.com/favicon.ico";
769
+ });
770
+ }
771
+ /**
772
+ * Create the YouTube embed after the user has clicked on it.
773
+ * @param {HTMLElement} embed dom element
774
+ */
775
+
776
+
777
+ createEmbed(embed, target) {
778
+ // If there is more than one video lets make sure there is only one playing at a time.
779
+ if (typeof window.player != "undefined" && typeof window.player.pauseVideo == "function") window.player.pauseVideo();
780
+ var video_id = target.getAttribute('data-id');
781
+ var link_id = target.getAttribute('id'); // create an id to pass t the script if one isn't present
782
+
783
+ if (typeof link_id == 'undefined' || link_id == null) {
784
+ var randLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26));
785
+ link_id = randLetter + Date.now();
786
+ target.setAttribute('id', link_id);
787
+ } // This function creates an <iframe> (and YouTube player) after the API code downloads.
788
+
789
+
790
+ function onYouTubeIframeAPIReady() {
791
+ window.player = new YT.Player(link_id, {
792
+ height: '100%',
793
+ width: '100%',
794
+ videoId: video_id,
795
+ playerVars: {
796
+ 'modestbranding': 1,
797
+ 'playsinline': 1,
798
+ 'rel': 0,
799
+ 'showinfo': 0
800
+ },
801
+ events: {
802
+ 'onReady': onPlayerReady,
803
+ 'onStateChange': onPlayerStateChange
804
+ }
805
+ });
806
+ }
807
+
808
+ onYouTubeIframeAPIReady(); // The API will call this function when the video player is ready.
809
+
810
+ function onPlayerReady(event) {
811
+ // Play the video straight away
812
+ event.target.playVideo();
813
+ } // The API calls this function when the player's state changes.
814
+ // The function indicates that when playing a video (state=1)
815
+
816
+
817
+ var done = false;
818
+
819
+ function onPlayerStateChange(event) {
820
+ if (event.data == YT.PlayerState.PLAYING && !done) {
821
+ var link = document.getElementById(link_id);
822
+ link.classList.add('player-ready');
823
+ done = true;
824
+ }
825
+ }
826
+ }
827
+
828
+ }
829
+
830
+ // Bootstrap modules
831
+
1249
832
  document.addEventListener("DOMContentLoaded", function () {
1250
833
  addBodyClasses(document.body);
1251
834
  checkElements(document.body);
1252
835
  console.log('test.js'); // ANav
1253
836
 
1254
- Array.from(document.querySelectorAll('.nav')).forEach(function (arrayElement, index) {
837
+ Array.from(document.querySelectorAll('.nav')).forEach((arrayElement, index) => {
1255
838
  navbar(arrayElement);
1256
839
  }); // Advanced tables
1257
840
 
1258
- Array.from(document.querySelectorAll('.table__wrapper')).forEach(function (arrayElement, index) {
841
+ Array.from(document.querySelectorAll('.table__wrapper')).forEach((arrayElement, index) => {
1259
842
  table(arrayElement);
1260
843
  }); // Accordions
1261
844
 
1262
- Array.from(document.querySelectorAll('.accordion')).forEach(function (arrayElement, index) {
845
+ Array.from(document.querySelectorAll('.accordion')).forEach((arrayElement, index) => {
1263
846
  accordion(arrayElement);
1264
847
  }); // Testimonial
1265
848
 
1266
- Array.from(document.querySelectorAll('.testimonial')).forEach(function (arrayElement, index) {
849
+ Array.from(document.querySelectorAll('.testimonial')).forEach((arrayElement, index) => {
1267
850
  testimonial(arrayElement);
1268
851
  }); // Carousel
1269
852
 
1270
- Array.from(document.querySelectorAll('.carousel')).forEach(function (arrayElement, index) {
853
+ Array.from(document.querySelectorAll('.carousel')).forEach((arrayElement, index) => {
1271
854
  carousel(arrayElement);
1272
855
  }); // Form
1273
856
 
1274
- Array.from(document.querySelectorAll('form')).forEach(function (arrayElement, index) {
857
+ Array.from(document.querySelectorAll('form')).forEach((arrayElement, index) => {
1275
858
  form(arrayElement);
859
+ }); // Modal
860
+
861
+ Array.from(document.querySelectorAll('.modal')).forEach((arrayElement, index) => {
862
+ modal(arrayElement);
863
+ }); // YouTube videos
864
+
865
+ Array.from(document.querySelectorAll('.youtube-embed')).forEach((arrayElement, index) => {
866
+ new youtubeVideo(arrayElement);
1276
867
  });
1277
868
  });
1278
869
 
1279
- })));
870
+ }));
1280
871
  //# sourceMappingURL=scripts.bundle.js.map