PageSourceSearch

https://www.colibrirealestate.com/wp-content/mu-plugins/wp-common-…/cl2-blocks-view.js?ver=2026-10-01-11-09

js colibrirealestate.com collected 2026-10-03 20:23:32 UTC 155,704 bytes, 4,531 lines download raw bytes

1/******/ (() => { // webpackBootstrap
2/******/ 	"use strict";
3/******/ 	// The require scope
4/******/ 	var __webpack_require__ = {};
5/******/ 	
6/************************************************************************/
7/******/ 	/* webpack/runtime/global */
8/******/ 	(() => {
9/******/ 		__webpack_require__.g = (function() {
10/******/ 			if (typeof globalThis === 'object') return globalThis;
11/******/ 			try {
12/******/ 				return this || new Function('return this')();
13/******/ 			} catch (e) {
14/******/ 				if (typeof window === 'object') return window;
15/******/ 			}
16/******/ 		})();
17/******/ 	})();
18/******/ 	
19/************************************************************************/
20
21;// ./src/Gutenberg/Components/BootstrapUtil/bootstrap-util.js
22/**
23 * --------------------------------------------------------------------------
24 * Bootstrap (v4.6.2): util.js
25 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
26 * --------------------------------------------------------------------------
27 */
28
29/**
30 * Private TransitionEnd Helpers
31 */
32
33const TRANSITION_END = 'transitionend';
34const MAX_UID = 1000000;
35const MILLISECONDS_MULTIPLIER = 1000;
36
37// Shoutout AngusCroll (https://goo.gl/pxwQGp)
38function toType(obj) {
39  if (obj === null || typeof obj === 'undefined') {
40    return `${obj}`;
41  }
42  return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
43}
44function getSpecialTransitionEndEvent() {
45  return {
46    bindType: TRANSITION_END,
47    delegateType: TRANSITION_END,
48    handle(event) {
49      if (event.target === this) {
50        return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
51      }
52      return undefined;
53    }
54  };
55}
56function emulateNativeTransitionEnd(element, duration) {
57  let called = false;
58  const transitionEndHandler = () => {
59    called = true;
60    element.removeEventListener(TRANSITION_END, transitionEndHandler);
61  };
62  element.addEventListener(TRANSITION_END, transitionEndHandler, {
63    once: true
64  });
65  setTimeout(() => {
66    if (!called) {
67      Util.triggerTransitionEnd(element);
68    }
69  }, duration);
70}
71function transitionEndEmulator(duration) {
72  emulateNativeTransitionEnd(this, duration);
73  return this;
74}
75function setTransitionEndSupport() {
76  const jQueryRef = window.jQuery;
77  if (!jQueryRef || !jQueryRef.fn || !jQueryRef.event || !jQueryRef.event.special) {
78    return;
79  }
80  jQueryRef.fn.emulateTransitionEnd = transitionEndEmulator;
81  jQueryRef.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
82}
83
84/**
85 * Public Util API
86 */
87
88const Util = {
89  TRANSITION_END: 'bsTransitionEnd',
90  getUID(prefix) {
91    do {
92      // eslint-disable-next-line no-bitwise
93      prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
94    } while (document.getElementById(prefix));
95    return prefix;
96  },
97  getSelectorFromElement(element) {
98    let selector = element.getAttribute('data-target');
99    if (!selector || selector === '#') {
100      const hrefAttr = element.getAttribute('href');
101      selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
102    }
103    try {
104      return document.querySelector(selector) ? selector : null;
105    } catch (_) {
106      return null;
107    }
108  },
109  getTransitionDurationFromElement(element) {
110    if (!element) {
111      return 0;
112    }
113    const {
114      transitionDuration,
115      transitionDelay
116    } = window.getComputedStyle(element);
117    const floatTransitionDuration = parseFloat(transitionDuration);
118    const floatTransitionDelay = parseFloat(transitionDelay);
119
120    // Return 0 if element or transition duration is not found
121    if (!floatTransitionDuration && !floatTransitionDelay) {
122      return 0;
123    }
124
125    // If multiple durations are defined, take the first
126    transitionDuration = transitionDuration.split(',')[0];
127    transitionDelay = transitionDelay.split(',')[0];
128    return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
129  },
130  reflow(element) {
131    return element.offsetHeight;
132  },
133  triggerTransitionEnd(element) {
134    element.dispatchEvent(new Event(TRANSITION_END));
135  },
136  supportsTransitionEnd() {
137    return Boolean(TRANSITION_END);
138  },
139  isElement(obj) {
140    return (obj[0] || obj).nodeType;
141  },
142  typeCheckConfig(componentName, config, configTypes) {
143    for (const property in configTypes) {
144      if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
145        const expectedTypes = configTypes[property];
146        const value = config[property];
147        const valueType = value && Util.isElement(value) ? 'element' : toType(value);
148        if (!new RegExp(expectedTypes).test(valueType)) {
149          throw new Error(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`);
150        }
151      }
152    }
153  },
154  findShadowRoot(element) {
155    if (!document.documentElement.attachShadow) {
156      return null;
157    }
158
159    // Can find the shadow root otherwise it'll return the document
160    if (typeof element.getRootNode === 'function') {
161      const root = element.getRootNode();
162      return root instanceof ShadowRoot ? root : null;
163    }
164    if (element instanceof ShadowRoot) {
165      return element;
166    }
167
168    // when we don't find a shadow root
169    if (!element.parentNode) {
170      return null;
171    }
172    return Util.findShadowRoot(element.parentNode);
173  },
174  jQueryDetection() {
175    const jQueryRef = window.jQuery;
176    if (typeof jQueryRef === 'undefined') {
177      return false;
178    }
179    const version = jQueryRef.fn.jquery.split(' ')[0].split('.');
180    const minMajor = 1;
181    const ltMajor = 2;
182    const minMinor = 9;
183    const minPatch = 1;
184    const maxMajor = 4;
185    if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
186      throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
187    }
188    return true;
189  }
190};
191try {
192  Util.jQueryDetection();
193} catch (_) {
194  // Keep compatibility by failing soft when incompatible jQuery is present.
195}
196setTransitionEndSupport();
197/* harmony default export */ const bootstrap_util = (Util);
198;// ./src/Gutenberg/Components/BootstrapModal/bootstrap-modal.js
199/**
200 * --------------------------------------------------------------------------
201 * Bootstrap (v4.6.2): modal.js
202 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
203 * --------------------------------------------------------------------------
204 */
205
206
207
208/**
209 * Constants
210 */
211
212const NAME = 'modal';
213const VERSION = '4.6.2';
214const DATA_KEY = 'bs.modal';
215const EVENT_KEY = `.${DATA_KEY}`;
216const DATA_API_KEY = '.data-api';
217const ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
218
219const CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
220const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
221const CLASS_NAME_BACKDROP = 'modal-backdrop';
222const CLASS_NAME_OPEN = 'modal-open';
223const CLASS_NAME_FADE = 'fade';
224const CLASS_NAME_SHOW = 'show';
225const CLASS_NAME_STATIC = 'modal-static';
226const EVENT_HIDE = `hide${EVENT_KEY}`;
227const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`;
228const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
229const EVENT_SHOW = `show${EVENT_KEY}`;
230const EVENT_SHOWN = `shown${EVENT_KEY}`;
231const EVENT_FOCUSIN = (/* unused pure expression or super */ null && (`focusin${EVENT_KEY}`));
232const EVENT_RESIZE = (/* unused pure expression or super */ null && (`resize${EVENT_KEY}`));
233const EVENT_CLICK_DISMISS = (/* unused pure expression or super */ null && (`click.dismiss${EVENT_KEY}`));
234const EVENT_KEYDOWN_DISMISS = (/* unused pure expression or super */ null && (`keydown.dismiss${EVENT_KEY}`));
235const EVENT_MOUSEUP_DISMISS = (/* unused pure expression or super */ null && (`mouseup.dismiss${EVENT_KEY}`));
236const EVENT_MOUSEDOWN_DISMISS = (/* unused pure expression or super */ null && (`mousedown.dismiss${EVENT_KEY}`));
237const EVENT_CLICK_DATA_API = (/* unused pure expression or super */ null && (`click${EVENT_KEY}${DATA_API_KEY}`));
238const bootstrap_modal_TRANSITION_END = 'transitionend';
239const NATIVE_EVENT_FOCUSIN = 'focusin';
240const NATIVE_EVENT_RESIZE = 'resize';
241const NATIVE_EVENT_KEYDOWN = 'keydown';
242const NATIVE_EVENT_CLICK = 'click';
243const NATIVE_EVENT_MOUSEDOWN = 'mousedown';
244const NATIVE_EVENT_MOUSEUP = 'mouseup';
245const SELECTOR_DIALOG = '.modal-dialog';
246const SELECTOR_MODAL_BODY = '.modal-body';
247const SELECTOR_DATA_TOGGLE = '[data-toggle="modal"]';
248const SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
249const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
250const SELECTOR_STICKY_CONTENT = '.sticky-top';
251const Default = {
252  backdrop: true,
253  keyboard: true,
254  focus: true,
255  show: true
256};
257const DefaultType = {
258  backdrop: '(boolean|string)',
259  keyboard: 'boolean',
260  focus: 'boolean',
261  show: 'boolean'
262};
263
264/**
265 * Class definition
266 */
267
268class Modal {
269  static _instances = new WeakMap();
270  constructor(element, config) {
271    this._config = this._getConfig(config);
272    this._element = element;
273    this._dialog = element.querySelector(SELECTOR_DIALOG);
274    this._backdrop = null;
275    this._isShown = false;
276    this._isBodyOverflowing = false;
277    this._ignoreBackdropClick = false;
278    this._isTransitioning = false;
279    this._scrollbarWidth = 0;
280    this._scrollbarPaddingMap = new Map();
281    this._scrollbarMarginMap = new Map();
282    this._bodyOriginalPaddingRight = '';
283    this._focusinHandler = null;
284    this._keydownDismissHandler = null;
285    this._resizeHandler = null;
286    this._dismissClickHandler = null;
287    this._dialogMouseDownHandler = null;
288    this._dialogMouseUpHandler = null;
289    this._backdropClickHandler = null;
290    Modal._instances.set(this._element, this);
291  }
292
293  // Getters
294  static get VERSION() {
295    return VERSION;
296  }
297  static get Default() {
298    return Default;
299  }
300
301  // Public
302  toggle(relatedTarget) {
303    return this._isShown ? this.hide() : this.show(relatedTarget);
304  }
305  show(relatedTarget) {
306    if (this._isShown || this._isTransitioning) {
307      return;
308    }
309    const showEvent = Modal._triggerEvent(this._element, EVENT_SHOW, {
310      relatedTarget
311    });
312    if (showEvent.defaultPrevented) {
313      return;
314    }
315    this._isShown = true;
316    if (this._element.classList.contains(CLASS_NAME_FADE)) {
317      this._isTransitioning = true;
318    }
319    this._checkScrollbar();
320    this._setScrollbar();
321    this._adjustDialog();
322    this._setEscapeEvent();
323    this._setResizeEvent();
324    this._dismissClickHandler = event => {
325      const dismissTarget = event.target.closest(SELECTOR_DATA_DISMISS);
326      if (dismissTarget && this._element.contains(dismissTarget)) {
327        this.hide(event);
328      }
329    };
330    this._element.addEventListener(NATIVE_EVENT_CLICK, this._dismissClickHandler);
331    this._dialogMouseDownHandler = () => {
332      this._dialogMouseUpHandler = event => {
333        if (event.target === this._element) {
334          this._ignoreBackdropClick = true;
335        }
336        this._element.removeEventListener(NATIVE_EVENT_MOUSEUP, this._dialogMouseUpHandler);
337        this._dialogMouseUpHandler = null;
338      };
339      this._element.addEventListener(NATIVE_EVENT_MOUSEUP, this._dialogMouseUpHandler);
340    };
341    this._dialog.addEventListener(NATIVE_EVENT_MOUSEDOWN, this._dialogMouseDownHandler);
342    this._showBackdrop(() => this._showElement(relatedTarget));
343  }
344  hide(event) {
345    if (event) {
346      event.preventDefault();
347    }
348    if (!this._isShown || this._isTransitioning) {
349      return;
350    }
351    const hideEvent = Modal._triggerEvent(this._element, EVENT_HIDE);
352    if (!this._isShown || hideEvent.defaultPrevented) {
353      return;
354    }
355    this._isShown = false;
356    const transition = this._element.classList.contains(CLASS_NAME_FADE);
357    if (transition) {
358      this._isTransitioning = true;
359    }
360    this._setEscapeEvent();
361    this._setResizeEvent();
362    this._removeFocusinHandler();
363    this._element.classList.remove(CLASS_NAME_SHOW);
364    if (this._dismissClickHandler) {
365      this._element.removeEventListener(NATIVE_EVENT_CLICK, this._dismissClickHandler);
366      this._dismissClickHandler = null;
367    }
368    if (this._dialogMouseDownHandler) {
369      this._dialog.removeEventListener(NATIVE_EVENT_MOUSEDOWN, this._dialogMouseDownHandler);
370      this._dialogMouseDownHandler = null;
371    }
372    if (this._dialogMouseUpHandler) {
373      this._element.removeEventListener(NATIVE_EVENT_MOUSEUP, this._dialogMouseUpHandler);
374      this._dialogMouseUpHandler = null;
375    }
376    if (this._backdropClickHandler) {
377      this._element.removeEventListener(NATIVE_EVENT_CLICK, this._backdropClickHandler);
378      this._backdropClickHandler = null;
379    }
380    if (transition) {
381      const transitionDuration = bootstrap_util.getTransitionDurationFromElement(this._element);
382      Modal._queueCallback(() => this._hideModal(), this._element, transitionDuration);
383    } else {
384      this._hideModal();
385    }
386  }
387  dispose() {
388    this._removeFocusinHandler();
389    if (this._keydownDismissHandler) {
390      this._element.removeEventListener(NATIVE_EVENT_KEYDOWN, this._keydownDismissHandler);
391      this._keydownDismissHandler = null;
392    }
393    if (this._resizeHandler) {
394      window.removeEventListener(NATIVE_EVENT_RESIZE, this._resizeHandler);
395      this._resizeHandler = null;
396    }
397    if (this._dismissClickHandler) {
398      this._element.removeEventListener(NATIVE_EVENT_CLICK, this._dismissClickHandler);
399      this._dismissClickHandler = null;
400    }
401    if (this._dialogMouseDownHandler) {
402      this._dialog.removeEventListener(NATIVE_EVENT_MOUSEDOWN, this._dialogMouseDownHandler);
403      this._dialogMouseDownHandler = null;
404    }
405    if (this._dialogMouseUpHandler) {
406      this._element.removeEventListener(NATIVE_EVENT_MOUSEUP, this._dialogMouseUpHandler);
407      this._dialogMouseUpHandler = null;
408    }
409    if (this._backdropClickHandler) {
410      this._element.removeEventListener(NATIVE_EVENT_CLICK, this._backdropClickHandler);
411      this._backdropClickHandler = null;
412    }
413    Modal._instances.delete(this._element);
414    this._config = null;
415    this._element = null;
416    this._dialog = null;
417    this._backdrop = null;
418    this._isShown = null;
419    this._isBodyOverflowing = null;
420    this._ignoreBackdropClick = null;
421    this._isTransitioning = null;
422    this._scrollbarWidth = null;
423  }
424  handleUpdate() {
425    this._adjustDialog();
426  }
427
428  // Private
429  _getConfig(config) {
430    config = {
431      ...Default,
432      ...config
433    };
434    bootstrap_util.typeCheckConfig(NAME, config, DefaultType);
435    return config;
436  }
437  _triggerBackdropTransition() {
438    const hideEventPrevented = Modal._triggerEvent(this._element, EVENT_HIDE_PREVENTED);
439    if (hideEventPrevented.defaultPrevented) {
440      return;
441    }
442    const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
443    if (!isModalOverflowing) {
444      this._element.style.overflowY = 'hidden';
445    }
446    this._element.classList.add(CLASS_NAME_STATIC);
447    const modalTransitionDuration = bootstrap_util.getTransitionDurationFromElement(this._dialog);
448    Modal._queueCallback(() => {
449      this._element.classList.remove(CLASS_NAME_STATIC);
450      if (!isModalOverflowing) {
451        Modal._queueCallback(() => {
452          this._element.style.overflowY = '';
453        }, this._element, modalTransitionDuration);
454      }
455    }, this._element, modalTransitionDuration);
456    this._element.focus();
457  }
458  _showElement(relatedTarget) {
459    const transition = this._element.classList.contains(CLASS_NAME_FADE);
460    const modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
461    if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
462      // Don't move modal's DOM position
463      document.body.appendChild(this._element);
464    }
465    this._element.style.display = 'block';
466    this._element.inert = false;
467    this._element.removeAttribute('inert');
468    this._element.removeAttribute('aria-hidden');
469    this._element.setAttribute('aria-modal', true);
470    this._element.setAttribute('role', 'dialog');
471    if (this._dialog.classList.contains(CLASS_NAME_SCROLLABLE) && modalBody) {
472      modalBody.scrollTop = 0;
473    } else {
474      this._element.scrollTop = 0;
475    }
476    if (transition) {
477      bootstrap_util.reflow(this._element);
478    }
479    this._element.classList.add(CLASS_NAME_SHOW);
480    if (this._config.focus) {
481      this._enforceFocus();
482    }
483    const transitionComplete = () => {
484      if (this._config.focus) {
485        this._element.focus();
486      }
487      this._isTransitioning = false;
488      Modal._triggerEvent(this._element, EVENT_SHOWN, {
489        relatedTarget
490      });
491    };
492    if (transition) {
493      const transitionDuration = bootstrap_util.getTransitionDurationFromElement(this._dialog);
494      Modal._queueCallback(transitionComplete, this._dialog, transitionDuration);
495    } else {
496      transitionComplete();
497    }
498  }
499  _enforceFocus() {
500    this._removeFocusinHandler();
501    this._focusinHandler = event => {
502      if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
503        this._element.focus();
504      }
505    };
506    document.addEventListener(NATIVE_EVENT_FOCUSIN, this._focusinHandler);
507  }
508  _removeFocusinHandler() {
509    if (!this._focusinHandler) {
510      return;
511    }
512    document.removeEventListener(NATIVE_EVENT_FOCUSIN, this._focusinHandler);
513    this._focusinHandler = null;
514  }
515  _setEscapeEvent() {
516    if (this._isShown) {
517      if (this._keydownDismissHandler) {
518        this._element.removeEventListener(NATIVE_EVENT_KEYDOWN, this._keydownDismissHandler);
519      }
520      this._keydownDismissHandler = event => {
521        if (this._config.keyboard && event.keyCode === ESCAPE_KEYCODE) {
522          event.preventDefault();
523          this.hide();
524        } else if (!this._config.keyboard && event.keyCode === ESCAPE_KEYCODE) {
525          this._triggerBackdropTransition();
526        }
527      };
528      this._element.addEventListener(NATIVE_EVENT_KEYDOWN, this._keydownDismissHandler);
529    } else if (!this._isShown) {
530      if (this._keydownDismissHandler) {
531        this._element.removeEventListener(NATIVE_EVENT_KEYDOWN, this._keydownDismissHandler);
532        this._keydownDismissHandler = null;
533      }
534    }
535  }
536  _setResizeEvent() {
537    if (this._isShown) {
538      if (this._resizeHandler) {
539        window.removeEventListener(NATIVE_EVENT_RESIZE, this._resizeHandler);
540      }
541      this._resizeHandler = event => this.handleUpdate(event);
542      window.addEventListener(NATIVE_EVENT_RESIZE, this._resizeHandler);
543    } else {
544      if (this._resizeHandler) {
545        window.removeEventListener(NATIVE_EVENT_RESIZE, this._resizeHandler);
546        this._resizeHandler = null;
547      }
548    }
549  }
550  _hideModal() {
551    const active = document.activeElement;
552    if (active && (active === this._element || this._element.contains(active))) {
553      active.blur();
554    }
555    this._element.style.display = 'none';
556    this._element.inert = true;
557    this._element.setAttribute('aria-hidden', true);
558    this._element.removeAttribute('aria-modal');
559    this._element.removeAttribute('role');
560    this._isTransitioning = false;
561    this._showBackdrop(() => {
562      document.body.classList.remove(CLASS_NAME_OPEN);
563      this._resetAdjustments();
564      this._resetScrollbar();
565      Modal._triggerEvent(this._element, EVENT_HIDDEN);
566    });
567  }
568  _removeBackdrop() {
569    if (this._backdrop) {
570      this._backdrop.remove();
571      this._backdrop = null;
572    }
573  }
574  _showBackdrop(callback) {
575    const animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
576    if (this._isShown && this._config.backdrop) {
577      this._backdrop = document.createElement('div');
578      this._backdrop.className = CLASS_NAME_BACKDROP;
579      if (animate) {
580        this._backdrop.classList.add(animate);
581      }
582      document.body.appendChild(this._backdrop);
583      if (this._backdropClickHandler) {
584        this._element.removeEventListener(NATIVE_EVENT_CLICK, this._backdropClickHandler);
585      }
586      this._backdropClickHandler = event => {
587        if (this._ignoreBackdropClick) {
588          this._ignoreBackdropClick = false;
589          return;
590        }
591        if (event.target !== event.currentTarget) {
592          return;
593        }
594        if (this._config.backdrop === 'static') {
595          this._triggerBackdropTransition();
596        } else {
597          this.hide();
598        }
599      };
600      this._element.addEventListener(NATIVE_EVENT_CLICK, this._backdropClickHandler);
601      if (animate) {
602        bootstrap_util.reflow(this._backdrop);
603      }
604      this._backdrop.classList.add(CLASS_NAME_SHOW);
605      if (!callback) {
606        return;
607      }
608      if (!animate) {
609        callback();
610        return;
611      }
612      const backdropTransitionDuration = bootstrap_util.getTransitionDurationFromElement(this._backdrop);
613      Modal._queueCallback(callback, this._backdrop, backdropTransitionDuration);
614    } else if (!this._isShown && this._backdrop) {
615      this._backdrop.classList.remove(CLASS_NAME_SHOW);
616      const callbackRemove = () => {
617        this._removeBackdrop();
618        if (callback) {
619          callback();
620        }
621      };
622      if (this._element.classList.contains(CLASS_NAME_FADE)) {
623        const backdropTransitionDuration = bootstrap_util.getTransitionDurationFromElement(this._backdrop);
624        Modal._queueCallback(callbackRemove, this._backdrop, backdropTransitionDuration);
625      } else {
626        callbackRemove();
627      }
628    } else if (callback) {
629      callback();
630    }
631  }
632
633  // ----------------------------------------------------------------------
634  // the following methods are used to handle overflowing modals
635  // todo (fat): these should probably be refactored out of modal.js
636  // ----------------------------------------------------------------------
637
638  _adjustDialog() {
639    const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
640    if (!this._isBodyOverflowing && isModalOverflowing) {
641      this._element.style.paddingLeft = `${this._scrollbarWidth}px`;
642    }
643    if (this._isBodyOverflowing && !isModalOverflowing) {
644      this._element.style.paddingRight = `${this._scrollbarWidth}px`;
645    }
646  }
647  _resetAdjustments() {
648    this._element.style.paddingLeft = '';
649    this._element.style.paddingRight = '';
650  }
651  _checkScrollbar() {
652    const viewportWidth = window.innerWidth;
653    const documentWidth = document.documentElement.clientWidth;
654    this._isBodyOverflowing = viewportWidth > documentWidth;
655
656    // Fallback for layouts where clientWidth is not reliable.
657    if (!this._isBodyOverflowing) {
658      const rect = document.body.getBoundingClientRect();
659      this._isBodyOverflowing = Math.round(rect.left + rect.right) < viewportWidth;
660    }
661    this._scrollbarWidth = this._getScrollbarWidth();
662  }
663  _setScrollbar() {
664    if (this._isBodyOverflowing) {
665      // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
666      //   while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
667      const fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
668      const stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT));
669
670      // Adjust fixed content padding
671      fixedContent.forEach(element => {
672        const actualPadding = element.style.paddingRight;
673        const calculatedPadding = window.getComputedStyle(element).paddingRight;
674        this._scrollbarPaddingMap.set(element, actualPadding);
675        element.style.paddingRight = `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`;
676      });
677
678      // Adjust sticky content margin
679      stickyContent.forEach(element => {
680        const actualMargin = element.style.marginRight;
681        const calculatedMargin = window.getComputedStyle(element).marginRight;
682        this._scrollbarMarginMap.set(element, actualMargin);
683        element.style.marginRight = `${parseFloat(calculatedMargin) - this._scrollbarWidth}px`;
684      });
685
686      // Adjust body padding
687      this._bodyOriginalPaddingRight = document.body.style.paddingRight;
688      const calculatedPadding = window.getComputedStyle(document.body).paddingRight;
689      document.body.style.paddingRight = `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`;
690    }
691    document.body.classList.add(CLASS_NAME_OPEN);
692  }
693  _resetScrollbar() {
694    // Restore fixed content padding
695    const fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
696    fixedContent.forEach(element => {
697      const padding = this._scrollbarPaddingMap.get(element);
698      element.style.paddingRight = typeof padding === 'string' ? padding : '';
699    });
700    this._scrollbarPaddingMap.clear();
701
702    // Restore sticky content
703    const elements = [].slice.call(document.querySelectorAll(`${SELECTOR_STICKY_CONTENT}`));
704    elements.forEach(element => {
705      const margin = this._scrollbarMarginMap.get(element);
706      if (typeof margin !== 'undefined') {
707        element.style.marginRight = margin;
708      }
709    });
710    this._scrollbarMarginMap.clear();
711
712    // Restore body padding
713    document.body.style.paddingRight = this._bodyOriginalPaddingRight || '';
714    this._bodyOriginalPaddingRight = '';
715  }
716  _getScrollbarWidth() {
717    // thx d.walsh
718    const scrollDiv = document.createElement('div');
719    scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
720    document.body.appendChild(scrollDiv);
721    const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
722    document.body.removeChild(scrollDiv);
723    return scrollbarWidth;
724  }
725
726  // Static
727  static _queueCallback(callback, element, transitionDuration) {
728    let called = false;
729    const duration = transitionDuration || 0;
730    const handler = event => {
731      if (event.target !== element) {
732        return;
733      }
734      called = true;
735      element.removeEventListener(bootstrap_modal_TRANSITION_END, handler);
736      callback();
737    };
738    element.addEventListener(bootstrap_modal_TRANSITION_END, handler);
739    window.setTimeout(() => {
740      if (!called) {
741        bootstrap_util.triggerTransitionEnd(element);
742      }
743    }, duration + 5);
744  }
745  static _triggerEvent(element, eventName, extra = {}) {
746    const event = new CustomEvent(eventName, {
747      bubbles: true,
748      cancelable: true,
749      detail: extra
750    });
751    if (typeof extra.relatedTarget !== 'undefined') {
752      Object.defineProperty(event, 'relatedTarget', {
753        configurable: true,
754        enumerable: true,
755        value: extra.relatedTarget
756      });
757    }
758    element.dispatchEvent(event);
759    const jQueryRef = window.jQuery;
760    if (typeof jQueryRef !== 'undefined') {
761      const jqEvent = jQueryRef.Event(eventName, extra);
762      jQueryRef(element).trigger(jqEvent);
763      if (jqEvent.isDefaultPrevented()) {
764        event.preventDefault();
765      }
766    }
767    return event;
768  }
769  static _getDataAttributes(element) {
770    if (!element) {
771      return {};
772    }
773    const data = {};
774    if (typeof element.dataset.backdrop !== 'undefined') {
775      data.backdrop = element.dataset.backdrop === 'true' ? true : element.dataset.backdrop === 'false' ? false : element.dataset.backdrop;
776    }
777    if (typeof element.dataset.keyboard !== 'undefined') {
778      data.keyboard = element.dataset.keyboard === 'true';
779    }
780    if (typeof element.dataset.focus !== 'undefined') {
781      data.focus = element.dataset.focus === 'true';
782    }
783    if (typeof element.dataset.show !== 'undefined') {
784      data.show = element.dataset.show === 'true';
785    }
786    return data;
787  }
788  static getInstance(element) {
789    return this._instances.get(element) || null;
790  }
791  static getOrCreateInstance(element, config = {}) {
792    return this.getInstance(element) || new this(element, config);
793  }
794  static interface(elements, config, relatedTarget) {
795    elements.forEach(element => {
796      let data = Modal.getInstance(element);
797      const _config = {
798        ...Default,
799        ...Modal._getDataAttributes(element),
800        ...(typeof config === 'object' && config ? config : {})
801      };
802      if (!data) {
803        data = new Modal(element, _config);
804      }
805      if (typeof config === 'string') {
806        if (typeof data[config] === 'undefined') {
807          throw new TypeError(`No method named "${config}"`);
808        }
809        data[config](relatedTarget);
810      } else if (_config.show) {
811        data.show(relatedTarget);
812      }
813    });
814  }
815}
816
817/**
818 * Data API implementation
819 */
820
821document.addEventListener(NATIVE_EVENT_CLICK, function (event) {
822  const trigger = event.target.closest(SELECTOR_DATA_TOGGLE);
823  if (!trigger) {
824    return;
825  }
826  let target;
827  const selector = bootstrap_util.getSelectorFromElement(trigger);
828  if (selector) {
829    target = document.querySelector(selector);
830  }
831  if (!target) {
832    return;
833  }
834  const config = Modal.getInstance(target) ? 'toggle' : {
835    ...Modal._getDataAttributes(target),
836    ...Modal._getDataAttributes(trigger)
837  };
838  if (trigger.tagName === 'A' || trigger.tagName === 'AREA') {
839    event.preventDefault();
840  }
841  target.addEventListener(EVENT_SHOW, showEvent => {
842    if (showEvent.defaultPrevented) {
843      // Only register focus restorer if modal will actually get shown
844      return;
845    }
846    target.addEventListener(EVENT_HIDDEN, () => {
847      const isVisible = trigger.offsetParent !== null || trigger.getClientRects().length > 0;
848      if (isVisible) {
849        trigger.focus();
850      }
851    }, {
852      once: true
853    });
854  }, {
855    once: true
856  });
857  Modal.interface([target], config, trigger);
858});
859
860/**
861 * Optional jQuery bridge
862 */
863if (typeof window.jQuery !== 'undefined') {
864  const $ = window.jQuery;
865  const JQUERY_NO_CONFLICT = $.fn[NAME];
866  $.fn[NAME] = function (config, relatedTarget) {
867    return Modal.interface([].slice.call(this), config, relatedTarget);
868  };
869  $.fn[NAME].Constructor = Modal;
870  $.fn[NAME].noConflict = () => {
871    $.fn[NAME] = JQUERY_NO_CONFLICT;
872    return $.fn[NAME];
873  };
874}
875/* harmony default export */ const bootstrap_modal = ((/* unused pure expression or super */ null && (Modal)));
876;// ./src/Gutenberg/Components/BootstrapCollapse/bootstrap-collapse.js
877/**
878 * --------------------------------------------------------------------------
879 * Bootstrap (v4.6.2): collapse.js
880 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
881 * --------------------------------------------------------------------------
882 */
883
884
885
886/**
887 * Constants
888 */
889
890const bootstrap_collapse_NAME = 'collapse';
891const bootstrap_collapse_VERSION = '4.6.2';
892const bootstrap_collapse_DATA_KEY = 'bs.collapse';
893const bootstrap_collapse_EVENT_KEY = `.${bootstrap_collapse_DATA_KEY}`;
894const bootstrap_collapse_DATA_API_KEY = '.data-api';
895const bootstrap_collapse_CLASS_NAME_SHOW = 'show';
896const CLASS_NAME_COLLAPSE = 'collapse';
897const CLASS_NAME_COLLAPSING = 'collapsing';
898const CLASS_NAME_COLLAPSED = 'collapsed';
899const DIMENSION_WIDTH = 'width';
900const DIMENSION_HEIGHT = 'height';
901const bootstrap_collapse_EVENT_SHOW = `show${bootstrap_collapse_EVENT_KEY}`;
902const bootstrap_collapse_EVENT_SHOWN = `shown${bootstrap_collapse_EVENT_KEY}`;
903const bootstrap_collapse_EVENT_HIDE = `hide${bootstrap_collapse_EVENT_KEY}`;
904const bootstrap_collapse_EVENT_HIDDEN = `hidden${bootstrap_collapse_EVENT_KEY}`;
905const bootstrap_collapse_EVENT_CLICK_DATA_API = (/* unused pure expression or super */ null && (`click${bootstrap_collapse_EVENT_KEY}${bootstrap_collapse_DATA_API_KEY}`));
906const bootstrap_collapse_TRANSITION_END = 'transitionend';
907const SELECTOR_ACTIVES = '.show, .collapsing';
908const bootstrap_collapse_SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]';
909const bootstrap_collapse_Default = {
910  toggle: true,
911  parent: ''
912};
913const bootstrap_collapse_DefaultType = {
914  toggle: 'boolean',
915  parent: '(string|element)'
916};
917
918/**
919 * Class definition
920 */
921
922class Collapse {
923  static _instances = new WeakMap();
924  constructor(element, config) {
925    this._isTransitioning = false;
926    this._element = element;
927    this._config = this._getConfig(config);
928    this._triggerArray = [].slice.call(document.querySelectorAll(`[data-toggle="collapse"][href="#${element.id}"],` + `[data-toggle="collapse"][data-target="#${element.id}"]`));
929    const toggleList = [].slice.call(document.querySelectorAll(bootstrap_collapse_SELECTOR_DATA_TOGGLE));
930    for (let i = 0, len = toggleList.length; i < len; i++) {
931      const elem = toggleList[i];
932      const selector = bootstrap_util.getSelectorFromElement(elem);
933      const filterElement = [].slice.call(document.querySelectorAll(selector)).filter(foundElem => foundElem === element);
934      if (selector !== null && filterElement.length > 0) {
935        this._selector = selector;
936        this._triggerArray.push(elem);
937      }
938    }
939    this._parent = this._config.parent ? this._getParent() : null;
940    if (!this._config.parent) {
941      this._addAriaAndCollapsedClass(this._element, this._triggerArray);
942    }
943    if (this._config.toggle) {
944      this.toggle();
945    }
946    Collapse._instances.set(this._element, this);
947  }
948
949  // Getters
950  static get VERSION() {
951    return bootstrap_collapse_VERSION;
952  }
953  static get Default() {
954    return bootstrap_collapse_Default;
955  }
956
957  // Public
958  toggle() {
959    if (this._element.classList.contains(bootstrap_collapse_CLASS_NAME_SHOW)) {
960      this.hide();
961    } else {
962      this.show();
963    }
964  }
965  show() {
966    if (this._isTransitioning || this._element.classList.contains(bootstrap_collapse_CLASS_NAME_SHOW)) {
967      return;
968    }
969    let actives;
970    let activesData;
971    if (this._parent) {
972      actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(elem => {
973        if (typeof this._config.parent === 'string') {
974          return elem.getAttribute('data-parent') === this._config.parent;
975        }
976        return elem.classList.contains(CLASS_NAME_COLLAPSE);
977      });
978      if (actives.length === 0) {
979        actives = null;
980      }
981    }
982    if (actives) {
983      const activeElements = this._selector ? actives.filter(element => element !== this._element) : actives;
984      activesData = activeElements.map(element => Collapse.getInstance(element)).find(Boolean);
985      if (activesData && activesData._isTransitioning) {
986        return;
987      }
988    }
989    const startEvent = Collapse._triggerEvent(this._element, bootstrap_collapse_EVENT_SHOW);
990    if (startEvent.defaultPrevented) {
991      return;
992    }
993    if (actives) {
994      const activeElements = this._selector ? actives.filter(element => element !== this._element) : actives;
995      activeElements.forEach(element => {
996        const instance = Collapse.getOrCreateInstance(element, {
997          toggle: false
998        });
999        instance.hide();
1000      });
1001      if (!activesData) {
1002        actives.forEach(element => {
1003          Collapse._instances.delete(element);
1004        });
1005      }
1006    }
1007    const dimension = this._getDimension();
1008    this._element.classList.remove(CLASS_NAME_COLLAPSE);
1009    this._element.classList.add(CLASS_NAME_COLLAPSING);
1010    this._element.style[dimension] = 0;
1011    if (this._triggerArray.length) {
1012      this._triggerArray.forEach(trigger => {
1013        trigger.classList.remove(CLASS_NAME_COLLAPSED);
1014        trigger.setAttribute('aria-expanded', true);
1015      });
1016    }
1017    this.setTransitioning(true);
1018    const complete = () => {
1019      this._element.classList.remove(CLASS_NAME_COLLAPSING);
1020      this._element.classList.add(CLASS_NAME_COLLAPSE, bootstrap_collapse_CLASS_NAME_SHOW);
1021      this._element.style[dimension] = '';
1022      this.setTransitioning(false);
1023      Collapse._triggerEvent(this._element, bootstrap_collapse_EVENT_SHOWN);
1024    };
1025    const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
1026    const scrollSize = `scroll${capitalizedDimension}`;
1027    const transitionDuration = bootstrap_util.getTransitionDurationFromElement(this._element);
1028    Collapse._queueCallback(complete, this._element, transitionDuration);
1029    this._element.style[dimension] = `${this._element[scrollSize]}px`;
1030  }
1031  hide() {
1032    if (this._isTransitioning || !this._element.classList.contains(bootstrap_collapse_CLASS_NAME_SHOW)) {
1033      return;
1034    }
1035    const startEvent = Collapse._triggerEvent(this._element, bootstrap_collapse_EVENT_HIDE);
1036    if (startEvent.defaultPrevented) {
1037      return;
1038    }
1039    const dimension = this._getDimension();
1040    this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
1041    bootstrap_util.reflow(this._element);
1042    this._element.classList.add(CLASS_NAME_COLLAPSING);
1043    this._element.classList.remove(CLASS_NAME_COLLAPSE, bootstrap_collapse_CLASS_NAME_SHOW);
1044    const triggerArrayLength = this._triggerArray.length;
1045    if (triggerArrayLength > 0) {
1046      for (let i = 0; i < triggerArrayLength; i++) {
1047        const trigger = this._triggerArray[i];
1048        const selector = bootstrap_util.getSelectorFromElement(trigger);
1049        if (selector !== null) {
1050          const elems = [].slice.call(document.querySelectorAll(selector));
1051          const hasShown = elems.some(element => element.classList.contains(bootstrap_collapse_CLASS_NAME_SHOW));
1052          if (!hasShown) {
1053            trigger.classList.add(CLASS_NAME_COLLAPSED);
1054            trigger.setAttribute('aria-expanded', false);
1055          }
1056        }
1057      }
1058    }
1059    this.setTransitioning(true);
1060    const complete = () => {
1061      this.setTransitioning(false);
1062      this._element.classList.remove(CLASS_NAME_COLLAPSING);
1063      this._element.classList.add(CLASS_NAME_COLLAPSE);
1064      Collapse._triggerEvent(this._element, bootstrap_collapse_EVENT_HIDDEN);
1065    };
1066    this._element.style[dimension] = '';
1067    const transitionDuration = bootstrap_util.getTransitionDurationFromElement(this._element);
1068    Collapse._queueCallback(complete, this._element, transitionDuration);
1069  }
1070  setTransitioning(isTransitioning) {
1071    this._isTransitioning = isTransitioning;
1072  }
1073  dispose() {
1074    Collapse._instances.delete(this._element);
1075    this._config = null;
1076    this._parent = null;
1077    this._element = null;
1078    this._triggerArray = null;
1079    this._isTransitioning = null;
1080  }
1081
1082  // Private
1083  _getConfig(config) {
1084    config = {
1085      ...bootstrap_collapse_Default,
1086      ...config
1087    };
1088    config.toggle = Boolean(config.toggle); // Coerce string values
1089    bootstrap_util.typeCheckConfig(bootstrap_collapse_NAME, config, bootstrap_collapse_DefaultType);
1090    return config;
1091  }
1092  _getDimension() {
1093    const hasWidth = this._element.classList.contains(DIMENSION_WIDTH);
1094    return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
1095  }
1096  _getParent() {
1097    let parent;
1098    if (bootstrap_util.isElement(this._config.parent)) {
1099      parent = this._config.parent;
1100
1101      // It's a jQuery object
1102      if (typeof this._config.parent.jquery !== 'undefined') {
1103        parent = this._config.parent[0];
1104      }
1105    } else {
1106      parent = document.querySelector(this._config.parent);
1107    }
1108    const selector = `[data-toggle="collapse"][data-parent="${this._config.parent}"]`;
1109    const children = [].slice.call(parent.querySelectorAll(selector));
1110    children.forEach(element => {
1111      this._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
1112    });
1113    return parent;
1114  }
1115  _addAriaAndCollapsedClass(element, triggerArray) {
1116    const isOpen = element.classList.contains(bootstrap_collapse_CLASS_NAME_SHOW);
1117    if (triggerArray.length) {
1118      triggerArray.forEach(trigger => {
1119        trigger.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
1120        trigger.setAttribute('aria-expanded', isOpen);
1121      });
1122    }
1123  }
1124
1125  // Static
1126  static getInstance(element) {
1127    return Collapse._instances.get(element) || null;
1128  }
1129  static getOrCreateInstance(element, config = {}) {
1130    return this.getInstance(element) || new this(element, config);
1131  }
1132  static _triggerEvent(element, eventName) {
1133    const event = new CustomEvent(eventName, {
1134      bubbles: true,
1135      cancelable: true
1136    });
1137    element.dispatchEvent(event);
1138    const jQueryRef = window.jQuery;
1139    if (typeof jQueryRef !== 'undefined') {
1140      const jqEvent = jQueryRef.Event(eventName);
1141      jQueryRef(element).trigger(jqEvent);
1142      if (jqEvent.isDefaultPrevented()) {
1143        event.preventDefault();
1144      }
1145    }
1146    return event;
1147  }
1148  static _queueCallback(callback, element, transitionDuration) {
1149    let called = false;
1150    const duration = transitionDuration || 0;
1151    const handler = event => {
1152      if (event.target !== element) {
1153        return;
1154      }
1155      called = true;
1156      element.removeEventListener(bootstrap_collapse_TRANSITION_END, handler);
1157      callback();
1158    };
1159    element.addEventListener(bootstrap_collapse_TRANSITION_END, handler);
1160    window.setTimeout(() => {
1161      if (!called) {
1162        bootstrap_util.triggerTransitionEnd(element);
1163      }
1164    }, duration + 5);
1165  }
1166  static _getTargetFromElement(element) {
1167    const selector = bootstrap_util.getSelectorFromElement(element);
1168    return selector ? document.querySelector(selector) : null;
1169  }
1170  static _getDataAttributes(element) {
1171    const data = {};
1172    if (typeof element.dataset.toggle !== 'undefined') {
1173      data.toggle = element.dataset.toggle !== 'false';
1174    }
1175    if (typeof element.dataset.parent !== 'undefined') {
1176      data.parent = element.dataset.parent;
1177    }
1178    return data;
1179  }
1180  static interface(elements, config) {
1181    elements.forEach(element => {
1182      let data = Collapse.getInstance(element);
1183      const elementData = Collapse._getDataAttributes(element);
1184      const _config = {
1185        ...bootstrap_collapse_Default,
1186        ...elementData,
1187        ...(typeof config === 'object' && config ? config : {})
1188      };
1189      if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
1190        _config.toggle = false;
1191      }
1192      if (!data) {
1193        data = new Collapse(element, _config);
1194      }
1195      if (typeof config === 'string') {
1196        if (typeof data[config] === 'undefined') {
1197          throw new TypeError(`No method named "${config}"`);
1198        }
1199        data[config]();
1200      }
1201    });
1202  }
1203}
1204
1205/**
1206 * Data API implementation
1207 */
1208
1209document.addEventListener('click', function (event) {
1210  const trigger = event.target.closest(bootstrap_collapse_SELECTOR_DATA_TOGGLE);
1211  if (!trigger) {
1212    return;
1213  }
1214
1215  // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
1216  if (trigger.tagName === 'A') {
1217    event.preventDefault();
1218  }
1219  const selector = bootstrap_util.getSelectorFromElement(trigger);
1220  if (!selector) {
1221    return;
1222  }
1223  const selectors = [].slice.call(document.querySelectorAll(selector));
1224  selectors.forEach(target => {
1225    const data = Collapse.getInstance(target);
1226    const config = data ? 'toggle' : Collapse._getDataAttributes(trigger);
1227    Collapse.interface([target], config);
1228  });
1229});
1230
1231/**
1232 * Optional jQuery bridge
1233 */
1234if (typeof window.jQuery !== 'undefined') {
1235  const $ = window.jQuery;
1236  const JQUERY_NO_CONFLICT = $.fn[bootstrap_collapse_NAME];
1237  $.fn[bootstrap_collapse_NAME] = function (config) {
1238    return Collapse.interface([].slice.call(this), config);
1239  };
1240  $.fn[bootstrap_collapse_NAME].Constructor = Collapse;
1241  $.fn[bootstrap_collapse_NAME].noConflict = () => {
1242    $.fn[bootstrap_collapse_NAME] = JQUERY_NO_CONFLICT;
1243    return $.fn[bootstrap_collapse_NAME];
1244  };
1245}
1246/* harmony default export */ const bootstrap_collapse = ((/* unused pure expression or super */ null && (Collapse)));
1247;// ./node_modules/popper.js/dist/esm/popper.js
1248/**!
1249 * @fileOverview Kickass library to create and place poppers near their reference elements.
1250 * @version 1.16.1
1251 * @license
1252 * Copyright (c) 2016 Federico Zivolo and contributors
1253 *
1254 * Permission is hereby granted, free of charge, to any person obtaining a copy
1255 * of this software and associated documentation files (the "Software"), to deal
1256 * in the Software without restriction, including without limitation the rights
1257 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1258 * copies of the Software, and to permit persons to whom the Software is
1259 * furnished to do so, subject to the following conditions:
1260 *
1261 * The above copyright notice and this permission notice shall be included in all
1262 * copies or substantial portions of the Software.
1263 *
1264 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1265 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1266 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1267 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1268 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1269 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1270 * SOFTWARE.
1271 */
1272var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
1273
1274var timeoutDuration = function () {
1275  var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
1276  for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
1277    if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
1278      return 1;
1279    }
1280  }
1281  return 0;
1282}();
1283
1284function microtaskDebounce(fn) {
1285  var called = false;
vendor: 3,141 bytes, lines 1286-1411
1286  return function () {
1287    if (called) {
1288      return;
1289    }
1290    called = true;
1291    window.Promise.resolve().then(function () {
1292      called = false;
1293      fn();
1294    });
1295  };
1296}
1297
1298function taskDebounce(fn) {
1299  var scheduled = false;
1300  return function () {
1301    if (!scheduled) {
1302      scheduled = true;
1303      setTimeout(function () {
1304        scheduled = false;
1305        fn();
1306      }, timeoutDuration);
1307    }
1308  };
1309}
1310
1311var supportsMicroTasks = isBrowser && window.Promise;
1312
1313/**
1314* Create a debounced version of a method, that's asynchronously deferred
1315* but called in the minimum time possible.
1316*
1317* @method
1318* @memberof Popper.Utils
1319* @argument {Function} fn
1320* @returns {Function}
1321*/
1322var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
1323
1324/**
1325 * Check if the given variable is a function
1326 * @method
1327 * @memberof Popper.Utils
1328 * @argument {Any} functionToCheck - variable to check
1329 * @returns {Boolean} answer to: is a function?
1330 */
1331function isFunction(functionToCheck) {
1332  var getType = {};
1333  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
1334}
1335
1336/**
1337 * Get CSS computed property of the given element
1338 * @method
1339 * @memberof Popper.Utils
1340 * @argument {Eement} element
1341 * @argument {String} property
1342 */
1343function getStyleComputedProperty(element, property) {
1344  if (element.nodeType !== 1) {
1345    return [];
1346  }
1347  // NOTE: 1 DOM access here
1348  var window = element.ownerDocument.defaultView;
1349  var css = window.getComputedStyle(element, null);
1350  return property ? css[property] : css;
1351}
1352
1353/**
1354 * Returns the parentNode or the host of the element
1355 * @method
1356 * @memberof Popper.Utils
1357 * @argument {Element} element
1358 * @returns {Element} parent
1359 */
1360function getParentNode(element) {
1361  if (element.nodeName === 'HTML') {
1362    return element;
1363  }
1364  return element.parentNode || element.host;
1365}
1366
1367/**
1368 * Returns the scrolling parent of the given element
1369 * @method
1370 * @memberof Popper.Utils
1371 * @argument {Element} element
1372 * @returns {Element} scroll parent
1373 */
1374function getScrollParent(element) {
1375  // Return body, `getScroll` will take care to get the correct `scrollTop` from it
1376  if (!element) {
1377    return document.body;
1378  }
1379
1380  switch (element.nodeName) {
1381    case 'HTML':
1382    case 'BODY':
1383      return element.ownerDocument.body;
1384    case '#document':
1385      return element.body;
1386  }
1387
1388  // Firefox want us to check `-x` and `-y` variations as well
1389
1390  var _getStyleComputedProp = getStyleComputedProperty(element),
1391      overflow = _getStyleComputedProp.overflow,
1392      overflowX = _getStyleComputedProp.overflowX,
1393      overflowY = _getStyleComputedProp.overflowY;
1394
1395  if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
1396    return element;
1397  }
1398
1399  return getScrollParent(getParentNode(element));
1400}
1401
1402/**
1403 * Returns the reference node of the reference object, or the reference object itself.
1404 * @method
1405 * @memberof Popper.Utils
1406 * @param {Element|Object} reference - the reference element (the popper will be relative to this)
1407 * @returns {Element} parent
1408 */
1409function getReferenceNode(reference) {
1410  return reference && reference.referenceNode ? reference.referenceNode : reference;
1411}
vendor: 3,047 bytes, lines 1411-1517
1411
1412
1413var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
1414var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
1415
1416/**
1417 * Determines if the browser is Internet Explorer
1418 * @method
1419 * @memberof Popper.Utils
1420 * @param {Number} version to check
1421 * @returns {Boolean} isIE
1422 */
1423function isIE(version) {
1424  if (version === 11) {
1425    return isIE11;
1426  }
1427  if (version === 10) {
1428    return isIE10;
1429  }
1430  return isIE11 || isIE10;
1431}
1432
1433/**
1434 * Returns the offset parent of the given element
1435 * @method
1436 * @memberof Popper.Utils
1437 * @argument {Element} element
1438 * @returns {Element} offset parent
1439 */
1440function getOffsetParent(element) {
1441  if (!element) {
1442    return document.documentElement;
1443  }
1444
1445  var noOffsetParent = isIE(10) ? document.body : null;
1446
1447  // NOTE: 1 DOM access here
1448  var offsetParent = element.offsetParent || null;
1449  // Skip hidden elements which don't have an offsetParent
1450  while (offsetParent === noOffsetParent && element.nextElementSibling) {
1451    offsetParent = (element = element.nextElementSibling).offsetParent;
1452  }
1453
1454  var nodeName = offsetParent && offsetParent.nodeName;
1455
1456  if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
1457    return element ? element.ownerDocument.documentElement : document.documentElement;
1458  }
1459
1460  // .offsetParent will return the closest TH, TD or TABLE in case
1461  // no offsetParent is present, I hate this job...
1462  if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
1463    return getOffsetParent(offsetParent);
1464  }
1465
1466  return offsetParent;
1467}
1468
1469function isOffsetContainer(element) {
1470  var nodeName = element.nodeName;
1471
1472  if (nodeName === 'BODY') {
1473    return false;
1474  }
1475  return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
1476}
1477
1478/**
1479 * Finds the root node (document, shadowDOM root) of the given element
1480 * @method
1481 * @memberof Popper.Utils
1482 * @argument {Element} node
1483 * @returns {Element} root node
1484 */
1485function getRoot(node) {
1486  if (node.parentNode !== null) {
1487    return getRoot(node.parentNode);
1488  }
1489
1490  return node;
1491}
1492
1493/**
1494 * Finds the offset parent common to the two provided nodes
1495 * @method
1496 * @memberof Popper.Utils
1497 * @argument {Element} element1
1498 * @argument {Element} element2
1499 * @returns {Element} common offset parent
1500 */
1501function findCommonOffsetParent(element1, element2) {
1502  // This check is needed to avoid errors in case one of the elements isn't defined for any reason
1503  if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
1504    return document.documentElement;
1505  }
1506
1507  // Here we make sure to give as "start" the element that comes first in the DOM
1508  var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
1509  var start = order ? element1 : element2;
1510  var end = order ? element2 : element1;
1511
1512  // Get common ancestor container
1513  var range = document.createRange();
1514  range.setStart(start, 0);
1515  range.setEnd(end, 0);
1516  var commonAncestorContainer = range.commonAncestorContainer;
1517
vendor: 5,354 bytes, lines 1518-1695
1518  // Both nodes are inside #document
1519
1520  if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
1521    if (isOffsetContainer(commonAncestorContainer)) {
1522      return commonAncestorContainer;
1523    }
1524
1525    return getOffsetParent(commonAncestorContainer);
1526  }
1527
1528  // one of the nodes is inside shadowDOM, find which one
1529  var element1root = getRoot(element1);
1530  if (element1root.host) {
1531    return findCommonOffsetParent(element1root.host, element2);
1532  } else {
1533    return findCommonOffsetParent(element1, getRoot(element2).host);
1534  }
1535}
1536
1537/**
1538 * Gets the scroll value of the given element in the given side (top and left)
1539 * @method
1540 * @memberof Popper.Utils
1541 * @argument {Element} element
1542 * @argument {String} side `top` or `left`
1543 * @returns {number} amount of scrolled pixels
1544 */
1545function getScroll(element) {
1546  var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
1547
1548  var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
1549  var nodeName = element.nodeName;
1550
1551  if (nodeName === 'BODY' || nodeName === 'HTML') {
1552    var html = element.ownerDocument.documentElement;
1553    var scrollingElement = element.ownerDocument.scrollingElement || html;
1554    return scrollingElement[upperSide];
1555  }
1556
1557  return element[upperSide];
1558}
1559
1560/*
1561 * Sum or subtract the element scroll values (left and top) from a given rect object
1562 * @method
1563 * @memberof Popper.Utils
1564 * @param {Object} rect - Rect object you want to change
1565 * @param {HTMLElement} element - The element from the function reads the scroll values
1566 * @param {Boolean} subtract - set to true if you want to subtract the scroll values
1567 * @return {Object} rect - The modifier rect object
1568 */
1569function includeScroll(rect, element) {
1570  var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1571
1572  var scrollTop = getScroll(element, 'top');
1573  var scrollLeft = getScroll(element, 'left');
1574  var modifier = subtract ? -1 : 1;
1575  rect.top += scrollTop * modifier;
1576  rect.bottom += scrollTop * modifier;
1577  rect.left += scrollLeft * modifier;
1578  rect.right += scrollLeft * modifier;
1579  return rect;
1580}
1581
1582/*
1583 * Helper to detect borders of a given element
1584 * @method
1585 * @memberof Popper.Utils
1586 * @param {CSSStyleDeclaration} styles
1587 * Result of `getStyleComputedProperty` on the given element
1588 * @param {String} axis - `x` or `y`
1589 * @return {number} borders - The borders size of the given axis
1590 */
1591
1592function getBordersSize(styles, axis) {
1593  var sideA = axis === 'x' ? 'Left' : 'Top';
1594  var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
1595
1596  return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
1597}
1598
1599function getSize(axis, body, html, computedStyle) {
1600  return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
1601}
1602
1603function getWindowSizes(document) {
1604  var body = document.body;
1605  var html = document.documentElement;
1606  var computedStyle = isIE(10) && getComputedStyle(html);
1607
1608  return {
1609    height: getSize('Height', body, html, computedStyle),
1610    width: getSize('Width', body, html, computedStyle)
1611  };
1612}
1613
1614var classCallCheck = function (instance, Constructor) {
1615  if (!(instance instanceof Constructor)) {
1616    throw new TypeError("Cannot call a class as a function");
1617  }
1618};
1619
1620var createClass = function () {
1621  function defineProperties(target, props) {
1622    for (var i = 0; i < props.length; i++) {
1623      var descriptor = props[i];
1624      descriptor.enumerable = descriptor.enumerable || false;
1625      descriptor.configurable = true;
1626      if ("value" in descriptor) descriptor.writable = true;
1627      Object.defineProperty(target, descriptor.key, descriptor);
1628    }
1629  }
1630
1631  return function (Constructor, protoProps, staticProps) {
1632    if (protoProps) defineProperties(Constructor.prototype, protoProps);
1633    if (staticProps) defineProperties(Constructor, staticProps);
1634    return Constructor;
1635  };
1636}();
1637
1638
1639
1640
1641
1642var defineProperty = function (obj, key, value) {
1643  if (key in obj) {
1644    Object.defineProperty(obj, key, {
1645      value: value,
1646      enumerable: true,
1647      configurable: true,
1648      writable: true
1649    });
1650  } else {
1651    obj[key] = value;
1652  }
1653
1654  return obj;
1655};
1656
1657var _extends = Object.assign || function (target) {
1658  for (var i = 1; i < arguments.length; i++) {
1659    var source = arguments[i];
1660
1661    for (var key in source) {
1662      if (Object.prototype.hasOwnProperty.call(source, key)) {
1663        target[key] = source[key];
1664      }
1665    }
1666  }
1667
1668  return target;
1669};
1670
1671/**
1672 * Given element offsets, generate an output similar to getBoundingClientRect
1673 * @method
1674 * @memberof Popper.Utils
1675 * @argument {Object} offsets
1676 * @returns {Object} ClientRect like output
1677 */
1678function getClientRect(offsets) {
1679  return _extends({}, offsets, {
1680    right: offsets.left + offsets.width,
1681    bottom: offsets.top + offsets.height
1682  });
1683}
1684
1685/**
1686 * Get bounding client rect of given element
1687 * @method
1688 * @memberof Popper.Utils
1689 * @param {HTMLElement} element
1690 * @return {Object} client rect
1691 */
1692function getBoundingClientRect(element) {
1693  var rect = {};
1694
1695  // IE10 10 FIX: Please, don't ask, the element isn't
vendor: 4,625 bytes, lines 1696-1825
1696  // considered in DOM in some circumstances...
1697  // This isn't reproducible in IE10 compatibility mode of IE11
1698  try {
1699    if (isIE(10)) {
1700      rect = element.getBoundingClientRect();
1701      var scrollTop = getScroll(element, 'top');
1702      var scrollLeft = getScroll(element, 'left');
1703      rect.top += scrollTop;
1704      rect.left += scrollLeft;
1705      rect.bottom += scrollTop;
1706      rect.right += scrollLeft;
1707    } else {
1708      rect = element.getBoundingClientRect();
1709    }
1710  } catch (e) {}
1711
1712  var result = {
1713    left: rect.left,
1714    top: rect.top,
1715    width: rect.right - rect.left,
1716    height: rect.bottom - rect.top
1717  };
1718
1719  // subtract scrollbar size from sizes
1720  var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
1721  var width = sizes.width || element.clientWidth || result.width;
1722  var height = sizes.height || element.clientHeight || result.height;
1723
1724  var horizScrollbar = element.offsetWidth - width;
1725  var vertScrollbar = element.offsetHeight - height;
1726
1727  // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
1728  // we make this check conditional for performance reasons
1729  if (horizScrollbar || vertScrollbar) {
1730    var styles = getStyleComputedProperty(element);
1731    horizScrollbar -= getBordersSize(styles, 'x');
1732    vertScrollbar -= getBordersSize(styles, 'y');
1733
1734    result.width -= horizScrollbar;
1735    result.height -= vertScrollbar;
1736  }
1737
1738  return getClientRect(result);
1739}
1740
1741function getOffsetRectRelativeToArbitraryNode(children, parent) {
1742  var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1743
1744  var isIE10 = isIE(10);
1745  var isHTML = parent.nodeName === 'HTML';
1746  var childrenRect = getBoundingClientRect(children);
1747  var parentRect = getBoundingClientRect(parent);
1748  var scrollParent = getScrollParent(children);
1749
1750  var styles = getStyleComputedProperty(parent);
1751  var borderTopWidth = parseFloat(styles.borderTopWidth);
1752  var borderLeftWidth = parseFloat(styles.borderLeftWidth);
1753
1754  // In cases where the parent is fixed, we must ignore negative scroll in offset calc
1755  if (fixedPosition && isHTML) {
1756    parentRect.top = Math.max(parentRect.top, 0);
1757    parentRect.left = Math.max(parentRect.left, 0);
1758  }
1759  var offsets = getClientRect({
1760    top: childrenRect.top - parentRect.top - borderTopWidth,
1761    left: childrenRect.left - parentRect.left - borderLeftWidth,
1762    width: childrenRect.width,
1763    height: childrenRect.height
1764  });
1765  offsets.marginTop = 0;
1766  offsets.marginLeft = 0;
1767
1768  // Subtract margins of documentElement in case it's being used as parent
1769  // we do this only on HTML because it's the only element that behaves
1770  // differently when margins are applied to it. The margins are included in
1771  // the box of the documentElement, in the other cases not.
1772  if (!isIE10 && isHTML) {
1773    var marginTop = parseFloat(styles.marginTop);
1774    var marginLeft = parseFloat(styles.marginLeft);
1775
1776    offsets.top -= borderTopWidth - marginTop;
1777    offsets.bottom -= borderTopWidth - marginTop;
1778    offsets.left -= borderLeftWidth - marginLeft;
1779    offsets.right -= borderLeftWidth - marginLeft;
1780
1781    // Attach marginTop and marginLeft because in some circumstances we may need them
1782    offsets.marginTop = marginTop;
1783    offsets.marginLeft = marginLeft;
1784  }
1785
1786  if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
1787    offsets = includeScroll(offsets, parent);
1788  }
1789
1790  return offsets;
1791}
1792
1793function getViewportOffsetRectRelativeToArtbitraryNode(element) {
1794  var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1795
1796  var html = element.ownerDocument.documentElement;
1797  var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
1798  var width = Math.max(html.clientWidth, window.innerWidth || 0);
1799  var height = Math.max(html.clientHeight, window.innerHeight || 0);
1800
1801  var scrollTop = !excludeScroll ? getScroll(html) : 0;
1802  var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
1803
1804  var offset = {
1805    top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
1806    left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
1807    width: width,
1808    height: height
1809  };
1810
1811  return getClientRect(offset);
1812}
1813
1814/**
1815 * Check if the given element is fixed or is inside a fixed parent
1816 * @method
1817 * @memberof Popper.Utils
1818 * @argument {Element} element
1819 * @argument {Element} customContainer
1820 * @returns {Boolean} answer to "isFixed?"
1821 */
1822function isFixed(element) {
1823  var nodeName = element.nodeName;
1824  if (nodeName === 'BODY' || nodeName === 'HTML') {
1825    return false;
vendor: 16,186 bytes, lines 1826-2335
1826  }
1827  if (getStyleComputedProperty(element, 'position') === 'fixed') {
1828    return true;
1829  }
1830  var parentNode = getParentNode(element);
1831  if (!parentNode) {
1832    return false;
1833  }
1834  return isFixed(parentNode);
1835}
1836
1837/**
1838 * Finds the first parent of an element that has a transformed property defined
1839 * @method
1840 * @memberof Popper.Utils
1841 * @argument {Element} element
1842 * @returns {Element} first transformed parent or documentElement
1843 */
1844
1845function getFixedPositionOffsetParent(element) {
1846  // This check is needed to avoid errors in case one of the elements isn't defined for any reason
1847  if (!element || !element.parentElement || isIE()) {
1848    return document.documentElement;
1849  }
1850  var el = element.parentElement;
1851  while (el && getStyleComputedProperty(el, 'transform') === 'none') {
1852    el = el.parentElement;
1853  }
1854  return el || document.documentElement;
1855}
1856
1857/**
1858 * Computed the boundaries limits and return them
1859 * @method
1860 * @memberof Popper.Utils
1861 * @param {HTMLElement} popper
1862 * @param {HTMLElement} reference
1863 * @param {number} padding
1864 * @param {HTMLElement} boundariesElement - Element used to define the boundaries
1865 * @param {Boolean} fixedPosition - Is in fixed position mode
1866 * @returns {Object} Coordinates of the boundaries
1867 */
1868function getBoundaries(popper, reference, padding, boundariesElement) {
1869  var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1870
1871  // NOTE: 1 DOM access here
1872
1873  var boundaries = { top: 0, left: 0 };
1874  var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
1875
1876  // Handle viewport case
1877  if (boundariesElement === 'viewport') {
1878    boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
1879  } else {
1880    // Handle other cases based on DOM element used as boundaries
1881    var boundariesNode = void 0;
1882    if (boundariesElement === 'scrollParent') {
1883      boundariesNode = getScrollParent(getParentNode(reference));
1884      if (boundariesNode.nodeName === 'BODY') {
1885        boundariesNode = popper.ownerDocument.documentElement;
1886      }
1887    } else if (boundariesElement === 'window') {
1888      boundariesNode = popper.ownerDocument.documentElement;
1889    } else {
1890      boundariesNode = boundariesElement;
1891    }
1892
1893    var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
1894
1895    // In case of HTML, we need a different computation
1896    if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
1897      var _getWindowSizes = getWindowSizes(popper.ownerDocument),
1898          height = _getWindowSizes.height,
1899          width = _getWindowSizes.width;
1900
1901      boundaries.top += offsets.top - offsets.marginTop;
1902      boundaries.bottom = height + offsets.top;
1903      boundaries.left += offsets.left - offsets.marginLeft;
1904      boundaries.right = width + offsets.left;
1905    } else {
1906      // for all the other DOM elements, this one is good
1907      boundaries = offsets;
1908    }
1909  }
1910
1911  // Add paddings
1912  padding = padding || 0;
1913  var isPaddingNumber = typeof padding === 'number';
1914  boundaries.left += isPaddingNumber ? padding : padding.left || 0;
1915  boundaries.top += isPaddingNumber ? padding : padding.top || 0;
1916  boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
1917  boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
1918
1919  return boundaries;
1920}
1921
1922function getArea(_ref) {
1923  var width = _ref.width,
1924      height = _ref.height;
1925
1926  return width * height;
1927}
1928
1929/**
1930 * Utility used to transform the `auto` placement to the placement with more
1931 * available space.
1932 * @method
1933 * @memberof Popper.Utils
1934 * @argument {Object} data - The data object generated by update method
1935 * @argument {Object} options - Modifiers configuration and options
1936 * @returns {Object} The data object, properly modified
1937 */
1938function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
1939  var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1940
1941  if (placement.indexOf('auto') === -1) {
1942    return placement;
1943  }
1944
1945  var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
1946
1947  var rects = {
1948    top: {
1949      width: boundaries.width,
1950      height: refRect.top - boundaries.top
1951    },
1952    right: {
1953      width: boundaries.right - refRect.right,
1954      height: boundaries.height
1955    },
1956    bottom: {
1957      width: boundaries.width,
1958      height: boundaries.bottom - refRect.bottom
1959    },
1960    left: {
1961      width: refRect.left - boundaries.left,
1962      height: boundaries.height
1963    }
1964  };
1965
1966  var sortedAreas = Object.keys(rects).map(function (key) {
1967    return _extends({
1968      key: key
1969    }, rects[key], {
1970      area: getArea(rects[key])
1971    });
1972  }).sort(function (a, b) {
1973    return b.area - a.area;
1974  });
1975
1976  var filteredAreas = sortedAreas.filter(function (_ref2) {
1977    var width = _ref2.width,
1978        height = _ref2.height;
1979    return width >= popper.clientWidth && height >= popper.clientHeight;
1980  });
1981
1982  var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
1983
1984  var variation = placement.split('-')[1];
1985
1986  return computedPlacement + (variation ? '-' + variation : '');
1987}
1988
1989/**
1990 * Get offsets to the reference element
1991 * @method
1992 * @memberof Popper.Utils
1993 * @param {Object} state
1994 * @param {Element} popper - the popper element
1995 * @param {Element} reference - the reference element (the popper will be relative to this)
1996 * @param {Element} fixedPosition - is in fixed position mode
1997 * @returns {Object} An object containing the offsets which will be applied to the popper
1998 */
1999function getReferenceOffsets(state, popper, reference) {
2000  var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
2001
2002  var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
2003  return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
2004}
2005
2006/**
2007 * Get the outer sizes of the given element (offset size + margins)
2008 * @method
2009 * @memberof Popper.Utils
2010 * @argument {Element} element
2011 * @returns {Object} object containing width and height properties
2012 */
2013function getOuterSizes(element) {
2014  var window = element.ownerDocument.defaultView;
2015  var styles = window.getComputedStyle(element);
2016  var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
2017  var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
2018  var result = {
2019    width: element.offsetWidth + y,
2020    height: element.offsetHeight + x
2021  };
2022  return result;
2023}
2024
2025/**
2026 * Get the opposite placement of the given one
2027 * @method
2028 * @memberof Popper.Utils
2029 * @argument {String} placement
2030 * @returns {String} flipped placement
2031 */
2032function getOppositePlacement(placement) {
2033  var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
2034  return placement.replace(/left|right|bottom|top/g, function (matched) {
2035    return hash[matched];
2036  });
2037}
2038
2039/**
2040 * Get offsets to the popper
2041 * @method
2042 * @memberof Popper.Utils
2043 * @param {Object} position - CSS position the Popper will get applied
2044 * @param {HTMLElement} popper - the popper element
2045 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
2046 * @param {String} placement - one of the valid placement options
2047 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
2048 */
2049function getPopperOffsets(popper, referenceOffsets, placement) {
2050  placement = placement.split('-')[0];
2051
2052  // Get popper node sizes
2053  var popperRect = getOuterSizes(popper);
2054
2055  // Add position, width and height to our offsets object
2056  var popperOffsets = {
2057    width: popperRect.width,
2058    height: popperRect.height
2059  };
2060
2061  // depending by the popper placement we have to compute its offsets slightly differently
2062  var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
2063  var mainSide = isHoriz ? 'top' : 'left';
2064  var secondarySide = isHoriz ? 'left' : 'top';
2065  var measurement = isHoriz ? 'height' : 'width';
2066  var secondaryMeasurement = !isHoriz ? 'height' : 'width';
2067
2068  popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
2069  if (placement === secondarySide) {
2070    popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
2071  } else {
2072    popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
2073  }
2074
2075  return popperOffsets;
2076}
2077
2078/**
2079 * Mimics the `find` method of Array
2080 * @method
2081 * @memberof Popper.Utils
2082 * @argument {Array} arr
2083 * @argument prop
2084 * @argument value
2085 * @returns index or -1
2086 */
2087function find(arr, check) {
2088  // use native find if supported
2089  if (Array.prototype.find) {
2090    return arr.find(check);
2091  }
2092
2093  // use `filter` to obtain the same behavior of `find`
2094  return arr.filter(check)[0];
2095}
2096
2097/**
2098 * Return the index of the matching object
2099 * @method
2100 * @memberof Popper.Utils
2101 * @argument {Array} arr
2102 * @argument prop
2103 * @argument value
2104 * @returns index or -1
2105 */
2106function findIndex(arr, prop, value) {
2107  // use native findIndex if supported
2108  if (Array.prototype.findIndex) {
2109    return arr.findIndex(function (cur) {
2110      return cur[prop] === value;
2111    });
2112  }
2113
2114  // use `find` + `indexOf` if `findIndex` isn't supported
2115  var match = find(arr, function (obj) {
2116    return obj[prop] === value;
2117  });
2118  return arr.indexOf(match);
2119}
2120
2121/**
2122 * Loop trough the list of modifiers and run them in order,
2123 * each of them will then edit the data object.
2124 * @method
2125 * @memberof Popper.Utils
2126 * @param {dataObject} data
2127 * @param {Array} modifiers
2128 * @param {String} ends - Optional modifier name used as stopper
2129 * @returns {dataObject}
2130 */
2131function runModifiers(modifiers, data, ends) {
2132  var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
2133
2134  modifiersToRun.forEach(function (modifier) {
2135    if (modifier['function']) {
2136      // eslint-disable-line dot-notation
2137      console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
2138    }
2139    var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
2140    if (modifier.enabled && isFunction(fn)) {
2141      // Add properties to offsets to make them a complete clientRect object
2142      // we do this before each modifier to make sure the previous one doesn't
2143      // mess with these values
2144      data.offsets.popper = getClientRect(data.offsets.popper);
2145      data.offsets.reference = getClientRect(data.offsets.reference);
2146
2147      data = fn(data, modifier);
2148    }
2149  });
2150
2151  return data;
2152}
2153
2154/**
2155 * Updates the position of the popper, computing the new offsets and applying
2156 * the new style.<br />
2157 * Prefer `scheduleUpdate` over `update` because of performance reasons.
2158 * @method
2159 * @memberof Popper
2160 */
2161function update() {
2162  // if popper is destroyed, don't perform any further update
2163  if (this.state.isDestroyed) {
2164    return;
2165  }
2166
2167  var data = {
2168    instance: this,
2169    styles: {},
2170    arrowStyles: {},
2171    attributes: {},
2172    flipped: false,
2173    offsets: {}
2174  };
2175
2176  // compute reference element offsets
2177  data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
2178
2179  // compute auto placement, store placement inside the data object,
2180  // modifiers will be able to edit `placement` if needed
2181  // and refer to originalPlacement to know the original value
2182  data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
2183
2184  // store the computed placement inside `originalPlacement`
2185  data.originalPlacement = data.placement;
2186
2187  data.positionFixed = this.options.positionFixed;
2188
2189  // compute the popper offsets
2190  data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
2191
2192  data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
2193
2194  // run the modifiers
2195  data = runModifiers(this.modifiers, data);
2196
2197  // the first `update` will call `onCreate` callback
2198  // the other ones will call `onUpdate` callback
2199  if (!this.state.isCreated) {
2200    this.state.isCreated = true;
2201    this.options.onCreate(data);
2202  } else {
2203    this.options.onUpdate(data);
2204  }
2205}
2206
2207/**
2208 * Helper used to know if the given modifier is enabled.
2209 * @method
2210 * @memberof Popper.Utils
2211 * @returns {Boolean}
2212 */
2213function isModifierEnabled(modifiers, modifierName) {
2214  return modifiers.some(function (_ref) {
2215    var name = _ref.name,
2216        enabled = _ref.enabled;
2217    return enabled && name === modifierName;
2218  });
2219}
2220
2221/**
2222 * Get the prefixed supported property name
2223 * @method
2224 * @memberof Popper.Utils
2225 * @argument {String} property (camelCase)
2226 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
2227 */
2228function getSupportedPropertyName(property) {
2229  var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
2230  var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
2231
2232  for (var i = 0; i < prefixes.length; i++) {
2233    var prefix = prefixes[i];
2234    var toCheck = prefix ? '' + prefix + upperProp : property;
2235    if (typeof document.body.style[toCheck] !== 'undefined') {
2236      return toCheck;
2237    }
2238  }
2239  return null;
2240}
2241
2242/**
2243 * Destroys the popper.
2244 * @method
2245 * @memberof Popper
2246 */
2247function destroy() {
2248  this.state.isDestroyed = true;
2249
2250  // touch DOM only if `applyStyle` modifier is enabled
2251  if (isModifierEnabled(this.modifiers, 'applyStyle')) {
2252    this.popper.removeAttribute('x-placement');
2253    this.popper.style.position = '';
2254    this.popper.style.top = '';
2255    this.popper.style.left = '';
2256    this.popper.style.right = '';
2257    this.popper.style.bottom = '';
2258    this.popper.style.willChange = '';
2259    this.popper.style[getSupportedPropertyName('transform')] = '';
2260  }
2261
2262  this.disableEventListeners();
2263
2264  // remove the popper if user explicitly asked for the deletion on destroy
2265  // do not use `remove` because IE11 doesn't support it
2266  if (this.options.removeOnDestroy) {
2267    this.popper.parentNode.removeChild(this.popper);
2268  }
2269  return this;
2270}
2271
2272/**
2273 * Get the window associated with the element
2274 * @argument {Element} element
2275 * @returns {Window}
2276 */
2277function getWindow(element) {
2278  var ownerDocument = element.ownerDocument;
2279  return ownerDocument ? ownerDocument.defaultView : window;
2280}
2281
2282function attachToScrollParents(scrollParent, event, callback, scrollParents) {
2283  var isBody = scrollParent.nodeName === 'BODY';
2284  var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
2285  target.addEventListener(event, callback, { passive: true });
2286
2287  if (!isBody) {
2288    attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
2289  }
2290  scrollParents.push(target);
2291}
2292
2293/**
2294 * Setup needed event listeners used to update the popper position
2295 * @method
2296 * @memberof Popper.Utils
2297 * @private
2298 */
2299function setupEventListeners(reference, options, state, updateBound) {
2300  // Resize event listener on window
2301  state.updateBound = updateBound;
2302  getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
2303
2304  // Scroll event listener on scroll parents
2305  var scrollElement = getScrollParent(reference);
2306  attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
2307  state.scrollElement = scrollElement;
2308  state.eventsEnabled = true;
2309
2310  return state;
2311}
2312
2313/**
2314 * It will add resize/scroll events and start recalculating
2315 * position of the popper element when they are triggered.
2316 * @method
2317 * @memberof Popper
2318 */
2319function enableEventListeners() {
2320  if (!this.state.eventsEnabled) {
2321    this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
2322  }
2323}
2324
2325/**
2326 * Remove event listeners used to update the popper position
2327 * @method
2328 * @memberof Popper.Utils
2329 * @private
2330 */
2331function removeEventListeners(reference, state) {
2332  // Remove resize event listener on window
2333  getWindow(reference).removeEventListener('resize', state.updateBound);
2334
2335  // Remove scroll event listener on scroll parents
vendor: 12,824 bytes, lines 2336-2697
2336  state.scrollParents.forEach(function (target) {
2337    target.removeEventListener('scroll', state.updateBound);
2338  });
2339
2340  // Reset state
2341  state.updateBound = null;
2342  state.scrollParents = [];
2343  state.scrollElement = null;
2344  state.eventsEnabled = false;
2345  return state;
2346}
2347
2348/**
2349 * It will remove resize/scroll events and won't recalculate popper position
2350 * when they are triggered. It also won't trigger `onUpdate` callback anymore,
2351 * unless you call `update` method manually.
2352 * @method
2353 * @memberof Popper
2354 */
2355function disableEventListeners() {
2356  if (this.state.eventsEnabled) {
2357    cancelAnimationFrame(this.scheduleUpdate);
2358    this.state = removeEventListeners(this.reference, this.state);
2359  }
2360}
2361
2362/**
2363 * Tells if a given input is a number
2364 * @method
2365 * @memberof Popper.Utils
2366 * @param {*} input to check
2367 * @return {Boolean}
2368 */
2369function isNumeric(n) {
2370  return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
2371}
2372
2373/**
2374 * Set the style to the given popper
2375 * @method
2376 * @memberof Popper.Utils
2377 * @argument {Element} element - Element to apply the style to
2378 * @argument {Object} styles
2379 * Object with a list of properties and values which will be applied to the element
2380 */
2381function setStyles(element, styles) {
2382  Object.keys(styles).forEach(function (prop) {
2383    var unit = '';
2384    // add unit if the value is numeric and is one of the following
2385    if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
2386      unit = 'px';
2387    }
2388    element.style[prop] = styles[prop] + unit;
2389  });
2390}
2391
2392/**
2393 * Set the attributes to the given popper
2394 * @method
2395 * @memberof Popper.Utils
2396 * @argument {Element} element - Element to apply the attributes to
2397 * @argument {Object} styles
2398 * Object with a list of properties and values which will be applied to the element
2399 */
2400function setAttributes(element, attributes) {
2401  Object.keys(attributes).forEach(function (prop) {
2402    var value = attributes[prop];
2403    if (value !== false) {
2404      element.setAttribute(prop, attributes[prop]);
2405    } else {
2406      element.removeAttribute(prop);
2407    }
2408  });
2409}
2410
2411/**
2412 * @function
2413 * @memberof Modifiers
2414 * @argument {Object} data - The data object generated by `update` method
2415 * @argument {Object} data.styles - List of style properties - values to apply to popper element
2416 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
2417 * @argument {Object} options - Modifiers configuration and options
2418 * @returns {Object} The same data object
2419 */
2420function applyStyle(data) {
2421  // any property present in `data.styles` will be applied to the popper,
2422  // in this way we can make the 3rd party modifiers add custom styles to it
2423  // Be aware, modifiers could override the properties defined in the previous
2424  // lines of this modifier!
2425  setStyles(data.instance.popper, data.styles);
2426
2427  // any property present in `data.attributes` will be applied to the popper,
2428  // they will be set as HTML attributes of the element
2429  setAttributes(data.instance.popper, data.attributes);
2430
2431  // if arrowElement is defined and arrowStyles has some properties
2432  if (data.arrowElement && Object.keys(data.arrowStyles).length) {
2433    setStyles(data.arrowElement, data.arrowStyles);
2434  }
2435
2436  return data;
2437}
2438
2439/**
2440 * Set the x-placement attribute before everything else because it could be used
2441 * to add margins to the popper margins needs to be calculated to get the
2442 * correct popper offsets.
2443 * @method
2444 * @memberof Popper.modifiers
2445 * @param {HTMLElement} reference - The reference element used to position the popper
2446 * @param {HTMLElement} popper - The HTML element used as popper
2447 * @param {Object} options - Popper.js options
2448 */
2449function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
2450  // compute reference element offsets
2451  var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
2452
2453  // compute auto placement, store placement inside the data object,
2454  // modifiers will be able to edit `placement` if needed
2455  // and refer to originalPlacement to know the original value
2456  var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
2457
2458  popper.setAttribute('x-placement', placement);
2459
2460  // Apply `position` to popper before anything else because
2461  // without the position applied we can't guarantee correct computations
2462  setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
2463
2464  return options;
2465}
2466
2467/**
2468 * @function
2469 * @memberof Popper.Utils
2470 * @argument {Object} data - The data object generated by `update` method
2471 * @argument {Boolean} shouldRound - If the offsets should be rounded at all
2472 * @returns {Object} The popper's position offsets rounded
2473 *
2474 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
2475 * good as it can be within reason.
2476 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
2477 *
2478 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
2479 * as well on High DPI screens).
2480 *
2481 * Firefox prefers no rounding for positioning and does not have blurriness on
2482 * high DPI screens.
2483 *
2484 * Only horizontal placement and left/right values need to be considered.
2485 */
2486function getRoundedOffsets(data, shouldRound) {
2487  var _data$offsets = data.offsets,
2488      popper = _data$offsets.popper,
2489      reference = _data$offsets.reference;
2490  var round = Math.round,
2491      floor = Math.floor;
2492
2493  var noRound = function noRound(v) {
2494    return v;
2495  };
2496
2497  var referenceWidth = round(reference.width);
2498  var popperWidth = round(popper.width);
2499
2500  var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
2501  var isVariation = data.placement.indexOf('-') !== -1;
2502  var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
2503  var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
2504
2505  var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
2506  var verticalToInteger = !shouldRound ? noRound : round;
2507
2508  return {
2509    left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
2510    top: verticalToInteger(popper.top),
2511    bottom: verticalToInteger(popper.bottom),
2512    right: horizontalToInteger(popper.right)
2513  };
2514}
2515
2516var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
2517
2518/**
2519 * @function
2520 * @memberof Modifiers
2521 * @argument {Object} data - The data object generated by `update` method
2522 * @argument {Object} options - Modifiers configuration and options
2523 * @returns {Object} The data object, properly modified
2524 */
2525function computeStyle(data, options) {
2526  var x = options.x,
2527      y = options.y;
2528  var popper = data.offsets.popper;
2529
2530  // Remove this legacy support in Popper.js v2
2531
2532  var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
2533    return modifier.name === 'applyStyle';
2534  }).gpuAcceleration;
2535  if (legacyGpuAccelerationOption !== undefined) {
2536    console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
2537  }
2538  var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
2539
2540  var offsetParent = getOffsetParent(data.instance.popper);
2541  var offsetParentRect = getBoundingClientRect(offsetParent);
2542
2543  // Styles
2544  var styles = {
2545    position: popper.position
2546  };
2547
2548  var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
2549
2550  var sideA = x === 'bottom' ? 'top' : 'bottom';
2551  var sideB = y === 'right' ? 'left' : 'right';
2552
2553  // if gpuAcceleration is set to `true` and transform is supported,
2554  //  we use `translate3d` to apply the position to the popper we
2555  // automatically use the supported prefixed version if needed
2556  var prefixedProperty = getSupportedPropertyName('transform');
2557
2558  // now, let's make a step back and look at this code closely (wtf?)
2559  // If the content of the popper grows once it's been positioned, it
2560  // may happen that the popper gets misplaced because of the new content
2561  // overflowing its reference element
2562  // To avoid this problem, we provide two options (x and y), which allow
2563  // the consumer to define the offset origin.
2564  // If we position a popper on top of a reference element, we can set
2565  // `x` to `top` to make the popper grow towards its top instead of
2566  // its bottom.
2567  var left = void 0,
2568      top = void 0;
2569  if (sideA === 'bottom') {
2570    // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
2571    // and not the bottom of the html element
2572    if (offsetParent.nodeName === 'HTML') {
2573      top = -offsetParent.clientHeight + offsets.bottom;
2574    } else {
2575      top = -offsetParentRect.height + offsets.bottom;
2576    }
2577  } else {
2578    top = offsets.top;
2579  }
2580  if (sideB === 'right') {
2581    if (offsetParent.nodeName === 'HTML') {
2582      left = -offsetParent.clientWidth + offsets.right;
2583    } else {
2584      left = -offsetParentRect.width + offsets.right;
2585    }
2586  } else {
2587    left = offsets.left;
2588  }
2589  if (gpuAcceleration && prefixedProperty) {
2590    styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
2591    styles[sideA] = 0;
2592    styles[sideB] = 0;
2593    styles.willChange = 'transform';
2594  } else {
2595    // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
2596    var invertTop = sideA === 'bottom' ? -1 : 1;
2597    var invertLeft = sideB === 'right' ? -1 : 1;
2598    styles[sideA] = top * invertTop;
2599    styles[sideB] = left * invertLeft;
2600    styles.willChange = sideA + ', ' + sideB;
2601  }
2602
2603  // Attributes
2604  var attributes = {
2605    'x-placement': data.placement
2606  };
2607
2608  // Update `data` attributes, styles and arrowStyles
2609  data.attributes = _extends({}, attributes, data.attributes);
2610  data.styles = _extends({}, styles, data.styles);
2611  data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
2612
2613  return data;
2614}
2615
2616/**
2617 * Helper used to know if the given modifier depends from another one.<br />
2618 * It checks if the needed modifier is listed and enabled.
2619 * @method
2620 * @memberof Popper.Utils
2621 * @param {Array} modifiers - list of modifiers
2622 * @param {String} requestingName - name of requesting modifier
2623 * @param {String} requestedName - name of requested modifier
2624 * @returns {Boolean}
2625 */
2626function isModifierRequired(modifiers, requestingName, requestedName) {
2627  var requesting = find(modifiers, function (_ref) {
2628    var name = _ref.name;
2629    return name === requestingName;
2630  });
2631
2632  var isRequired = !!requesting && modifiers.some(function (modifier) {
2633    return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
2634  });
2635
2636  if (!isRequired) {
2637    var _requesting = '`' + requestingName + '`';
2638    var requested = '`' + requestedName + '`';
2639    console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
2640  }
2641  return isRequired;
2642}
2643
2644/**
2645 * @function
2646 * @memberof Modifiers
2647 * @argument {Object} data - The data object generated by update method
2648 * @argument {Object} options - Modifiers configuration and options
2649 * @returns {Object} The data object, properly modified
2650 */
2651function arrow(data, options) {
2652  var _data$offsets$arrow;
2653
2654  // arrow depends on keepTogether in order to work
2655  if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
2656    return data;
2657  }
2658
2659  var arrowElement = options.element;
2660
2661  // if arrowElement is a string, suppose it's a CSS selector
2662  if (typeof arrowElement === 'string') {
2663    arrowElement = data.instance.popper.querySelector(arrowElement);
2664
2665    // if arrowElement is not found, don't run the modifier
2666    if (!arrowElement) {
2667      return data;
2668    }
2669  } else {
2670    // if the arrowElement isn't a query selector we must check that the
2671    // provided DOM node is child of its popper node
2672    if (!data.instance.popper.contains(arrowElement)) {
2673      console.warn('WARNING: `arrow.element` must be child of its popper element!');
2674      return data;
2675    }
2676  }
2677
2678  var placement = data.placement.split('-')[0];
2679  var _data$offsets = data.offsets,
2680      popper = _data$offsets.popper,
2681      reference = _data$offsets.reference;
2682
2683  var isVertical = ['left', 'right'].indexOf(placement) !== -1;
2684
2685  var len = isVertical ? 'height' : 'width';
2686  var sideCapitalized = isVertical ? 'Top' : 'Left';
2687  var side = sideCapitalized.toLowerCase();
2688  var altSide = isVertical ? 'left' : 'top';
2689  var opSide = isVertical ? 'bottom' : 'right';
2690  var arrowElementSize = getOuterSizes(arrowElement)[len];
2691
2692  //
2693  // extends keepTogether behavior making sure the popper and its
2694  // reference have enough pixels in conjunction
2695  //
2696
2697  // top/left side
vendor: 5,392 bytes, lines 2698-2853
2698  if (reference[opSide] - arrowElementSize < popper[side]) {
2699    data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
2700  }
2701  // bottom/right side
2702  if (reference[side] + arrowElementSize > popper[opSide]) {
2703    data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
2704  }
2705  data.offsets.popper = getClientRect(data.offsets.popper);
2706
2707  // compute center of the popper
2708  var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
2709
2710  // Compute the sideValue using the updated popper offsets
2711  // take popper margin in account because we don't have this info available
2712  var css = getStyleComputedProperty(data.instance.popper);
2713  var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
2714  var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
2715  var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
2716
2717  // prevent arrowElement from being placed not contiguously to its popper
2718  sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
2719
2720  data.arrowElement = arrowElement;
2721  data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
2722
2723  return data;
2724}
2725
2726/**
2727 * Get the opposite placement variation of the given one
2728 * @method
2729 * @memberof Popper.Utils
2730 * @argument {String} placement variation
2731 * @returns {String} flipped placement variation
2732 */
2733function getOppositeVariation(variation) {
2734  if (variation === 'end') {
2735    return 'start';
2736  } else if (variation === 'start') {
2737    return 'end';
2738  }
2739  return variation;
2740}
2741
2742/**
2743 * List of accepted placements to use as values of the `placement` option.<br />
2744 * Valid placements are:
2745 * - `auto`
2746 * - `top`
2747 * - `right`
2748 * - `bottom`
2749 * - `left`
2750 *
2751 * Each placement can have a variation from this list:
2752 * - `-start`
2753 * - `-end`
2754 *
2755 * Variations are interpreted easily if you think of them as the left to right
2756 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
2757 * is right.<br />
2758 * Vertically (`left` and `right`), `start` is top and `end` is bottom.
2759 *
2760 * Some valid examples are:
2761 * - `top-end` (on top of reference, right aligned)
2762 * - `right-start` (on right of reference, top aligned)
2763 * - `bottom` (on bottom, centered)
2764 * - `auto-end` (on the side with more space available, alignment depends by placement)
2765 *
2766 * @static
2767 * @type {Array}
2768 * @enum {String}
2769 * @readonly
2770 * @method placements
2771 * @memberof Popper
2772 */
2773var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
2774
2775// Get rid of `auto` `auto-start` and `auto-end`
2776var validPlacements = placements.slice(3);
2777
2778/**
2779 * Given an initial placement, returns all the subsequent placements
2780 * clockwise (or counter-clockwise).
2781 *
2782 * @method
2783 * @memberof Popper.Utils
2784 * @argument {String} placement - A valid placement (it accepts variations)
2785 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
2786 * @returns {Array} placements including their variations
2787 */
2788function clockwise(placement) {
2789  var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2790
2791  var index = validPlacements.indexOf(placement);
2792  var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
2793  return counter ? arr.reverse() : arr;
2794}
2795
2796var BEHAVIORS = {
2797  FLIP: 'flip',
2798  CLOCKWISE: 'clockwise',
2799  COUNTERCLOCKWISE: 'counterclockwise'
2800};
2801
2802/**
2803 * @function
2804 * @memberof Modifiers
2805 * @argument {Object} data - The data object generated by update method
2806 * @argument {Object} options - Modifiers configuration and options
2807 * @returns {Object} The data object, properly modified
2808 */
2809function flip(data, options) {
2810  // if `inner` modifier is enabled, we can't use the `flip` modifier
2811  if (isModifierEnabled(data.instance.modifiers, 'inner')) {
2812    return data;
2813  }
2814
2815  if (data.flipped && data.placement === data.originalPlacement) {
2816    // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
2817    return data;
2818  }
2819
2820  var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
2821
2822  var placement = data.placement.split('-')[0];
2823  var placementOpposite = getOppositePlacement(placement);
2824  var variation = data.placement.split('-')[1] || '';
2825
2826  var flipOrder = [];
2827
2828  switch (options.behavior) {
2829    case BEHAVIORS.FLIP:
2830      flipOrder = [placement, placementOpposite];
2831      break;
2832    case BEHAVIORS.CLOCKWISE:
2833      flipOrder = clockwise(placement);
2834      break;
2835    case BEHAVIORS.COUNTERCLOCKWISE:
2836      flipOrder = clockwise(placement, true);
2837      break;
2838    default:
2839      flipOrder = options.behavior;
2840  }
2841
2842  flipOrder.forEach(function (step, index) {
2843    if (placement !== step || flipOrder.length === index + 1) {
2844      return data;
2845    }
2846
2847    placement = data.placement.split('-')[0];
2848    placementOpposite = getOppositePlacement(placement);
2849
2850    var popperOffsets = data.offsets.popper;
2851    var refOffsets = data.offsets.reference;
2852
2853    // using floor because the reference offsets may contain decimals we are not going to consider here
vendor: 36,050 bytes, lines 2854-3858
2854    var floor = Math.floor;
2855    var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
2856
2857    var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
2858    var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
2859    var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
2860    var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
2861
2862    var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
2863
2864    // flip the variation if required
2865    var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
2866
2867    // flips variation if reference element overflows boundaries
2868    var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
2869
2870    // flips variation if popper content overflows boundaries
2871    var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
2872
2873    var flippedVariation = flippedVariationByRef || flippedVariationByContent;
2874
2875    if (overlapsRef || overflowsBoundaries || flippedVariation) {
2876      // this boolean to detect any flip loop
2877      data.flipped = true;
2878
2879      if (overlapsRef || overflowsBoundaries) {
2880        placement = flipOrder[index + 1];
2881      }
2882
2883      if (flippedVariation) {
2884        variation = getOppositeVariation(variation);
2885      }
2886
2887      data.placement = placement + (variation ? '-' + variation : '');
2888
2889      // this object contains `position`, we want to preserve it along with
2890      // any additional property we may add in the future
2891      data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
2892
2893      data = runModifiers(data.instance.modifiers, data, 'flip');
2894    }
2895  });
2896  return data;
2897}
2898
2899/**
2900 * @function
2901 * @memberof Modifiers
2902 * @argument {Object} data - The data object generated by update method
2903 * @argument {Object} options - Modifiers configuration and options
2904 * @returns {Object} The data object, properly modified
2905 */
2906function keepTogether(data) {
2907  var _data$offsets = data.offsets,
2908      popper = _data$offsets.popper,
2909      reference = _data$offsets.reference;
2910
2911  var placement = data.placement.split('-')[0];
2912  var floor = Math.floor;
2913  var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
2914  var side = isVertical ? 'right' : 'bottom';
2915  var opSide = isVertical ? 'left' : 'top';
2916  var measurement = isVertical ? 'width' : 'height';
2917
2918  if (popper[side] < floor(reference[opSide])) {
2919    data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
2920  }
2921  if (popper[opSide] > floor(reference[side])) {
2922    data.offsets.popper[opSide] = floor(reference[side]);
2923  }
2924
2925  return data;
2926}
2927
2928/**
2929 * Converts a string containing value + unit into a px value number
2930 * @function
2931 * @memberof {modifiers~offset}
2932 * @private
2933 * @argument {String} str - Value + unit string
2934 * @argument {String} measurement - `height` or `width`
2935 * @argument {Object} popperOffsets
2936 * @argument {Object} referenceOffsets
2937 * @returns {Number|String}
2938 * Value in pixels, or original string if no values were extracted
2939 */
2940function toValue(str, measurement, popperOffsets, referenceOffsets) {
2941  // separate value from unit
2942  var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
2943  var value = +split[1];
2944  var unit = split[2];
2945
2946  // If it's not a number it's an operator, I guess
2947  if (!value) {
2948    return str;
2949  }
2950
2951  if (unit.indexOf('%') === 0) {
2952    var element = void 0;
2953    switch (unit) {
2954      case '%p':
2955        element = popperOffsets;
2956        break;
2957      case '%':
2958      case '%r':
2959      default:
2960        element = referenceOffsets;
2961    }
2962
2963    var rect = getClientRect(element);
2964    return rect[measurement] / 100 * value;
2965  } else if (unit === 'vh' || unit === 'vw') {
2966    // if is a vh or vw, we calculate the size based on the viewport
2967    var size = void 0;
2968    if (unit === 'vh') {
2969      size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
2970    } else {
2971      size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
2972    }
2973    return size / 100 * value;
2974  } else {
2975    // if is an explicit pixel unit, we get rid of the unit and keep the value
2976    // if is an implicit unit, it's px, and we return just the value
2977    return value;
2978  }
2979}
2980
2981/**
2982 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
2983 * @function
2984 * @memberof {modifiers~offset}
2985 * @private
2986 * @argument {String} offset
2987 * @argument {Object} popperOffsets
2988 * @argument {Object} referenceOffsets
2989 * @argument {String} basePlacement
2990 * @returns {Array} a two cells array with x and y offsets in numbers
2991 */
2992function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
2993  var offsets = [0, 0];
2994
2995  // Use height if placement is left or right and index is 0 otherwise use width
2996  // in this way the first offset will use an axis and the second one
2997  // will use the other one
2998  var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
2999
3000  // Split the offset string to obtain a list of values and operands
3001  // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
3002  var fragments = offset.split(/(\+|\-)/).map(function (frag) {
3003    return frag.trim();
3004  });
3005
3006  // Detect if the offset string contains a pair of values or a single one
3007  // they could be separated by comma or space
3008  var divider = fragments.indexOf(find(fragments, function (frag) {
3009    return frag.search(/,|\s/) !== -1;
3010  }));
3011
3012  if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
3013    console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
3014  }
3015
3016  // If divider is found, we divide the list of values and operands to divide
3017  // them by ofset X and Y.
3018  var splitRegex = /\s*,\s*|\s+/;
3019  var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
3020
3021  // Convert the values with units to absolute pixels to allow our computations
3022  ops = ops.map(function (op, index) {
3023    // Most of the units rely on the orientation of the popper
3024    var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
3025    var mergeWithPrevious = false;
3026    return op
3027    // This aggregates any `+` or `-` sign that aren't considered operators
3028    // e.g.: 10 + +5 => [10, +, +5]
3029    .reduce(function (a, b) {
3030      if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
3031        a[a.length - 1] = b;
3032        mergeWithPrevious = true;
3033        return a;
3034      } else if (mergeWithPrevious) {
3035        a[a.length - 1] += b;
3036        mergeWithPrevious = false;
3037        return a;
3038      } else {
3039        return a.concat(b);
3040      }
3041    }, [])
3042    // Here we convert the string values into number values (in px)
3043    .map(function (str) {
3044      return toValue(str, measurement, popperOffsets, referenceOffsets);
3045    });
3046  });
3047
3048  // Loop trough the offsets arrays and execute the operations
3049  ops.forEach(function (op, index) {
3050    op.forEach(function (frag, index2) {
3051      if (isNumeric(frag)) {
3052        offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
3053      }
3054    });
3055  });
3056  return offsets;
3057}
3058
3059/**
3060 * @function
3061 * @memberof Modifiers
3062 * @argument {Object} data - The data object generated by update method
3063 * @argument {Object} options - Modifiers configuration and options
3064 * @argument {Number|String} options.offset=0
3065 * The offset value as described in the modifier description
3066 * @returns {Object} The data object, properly modified
3067 */
3068function offset(data, _ref) {
3069  var offset = _ref.offset;
3070  var placement = data.placement,
3071      _data$offsets = data.offsets,
3072      popper = _data$offsets.popper,
3073      reference = _data$offsets.reference;
3074
3075  var basePlacement = placement.split('-')[0];
3076
3077  var offsets = void 0;
3078  if (isNumeric(+offset)) {
3079    offsets = [+offset, 0];
3080  } else {
3081    offsets = parseOffset(offset, popper, reference, basePlacement);
3082  }
3083
3084  if (basePlacement === 'left') {
3085    popper.top += offsets[0];
3086    popper.left -= offsets[1];
3087  } else if (basePlacement === 'right') {
3088    popper.top += offsets[0];
3089    popper.left += offsets[1];
3090  } else if (basePlacement === 'top') {
3091    popper.left += offsets[0];
3092    popper.top -= offsets[1];
3093  } else if (basePlacement === 'bottom') {
3094    popper.left += offsets[0];
3095    popper.top += offsets[1];
3096  }
3097
3098  data.popper = popper;
3099  return data;
3100}
3101
3102/**
3103 * @function
3104 * @memberof Modifiers
3105 * @argument {Object} data - The data object generated by `update` method
3106 * @argument {Object} options - Modifiers configuration and options
3107 * @returns {Object} The data object, properly modified
3108 */
3109function preventOverflow(data, options) {
3110  var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
3111
3112  // If offsetParent is the reference element, we really want to
3113  // go one step up and use the next offsetParent as reference to
3114  // avoid to make this modifier completely useless and look like broken
3115  if (data.instance.reference === boundariesElement) {
3116    boundariesElement = getOffsetParent(boundariesElement);
3117  }
3118
3119  // NOTE: DOM access here
3120  // resets the popper's position so that the document size can be calculated excluding
3121  // the size of the popper element itself
3122  var transformProp = getSupportedPropertyName('transform');
3123  var popperStyles = data.instance.popper.style; // assignment to help minification
3124  var top = popperStyles.top,
3125      left = popperStyles.left,
3126      transform = popperStyles[transformProp];
3127
3128  popperStyles.top = '';
3129  popperStyles.left = '';
3130  popperStyles[transformProp] = '';
3131
3132  var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
3133
3134  // NOTE: DOM access here
3135  // restores the original style properties after the offsets have been computed
3136  popperStyles.top = top;
3137  popperStyles.left = left;
3138  popperStyles[transformProp] = transform;
3139
3140  options.boundaries = boundaries;
3141
3142  var order = options.priority;
3143  var popper = data.offsets.popper;
3144
3145  var check = {
3146    primary: function primary(placement) {
3147      var value = popper[placement];
3148      if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
3149        value = Math.max(popper[placement], boundaries[placement]);
3150      }
3151      return defineProperty({}, placement, value);
3152    },
3153    secondary: function secondary(placement) {
3154      var mainSide = placement === 'right' ? 'left' : 'top';
3155      var value = popper[mainSide];
3156      if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
3157        value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
3158      }
3159      return defineProperty({}, mainSide, value);
3160    }
3161  };
3162
3163  order.forEach(function (placement) {
3164    var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
3165    popper = _extends({}, popper, check[side](placement));
3166  });
3167
3168  data.offsets.popper = popper;
3169
3170  return data;
3171}
3172
3173/**
3174 * @function
3175 * @memberof Modifiers
3176 * @argument {Object} data - The data object generated by `update` method
3177 * @argument {Object} options - Modifiers configuration and options
3178 * @returns {Object} The data object, properly modified
3179 */
3180function shift(data) {
3181  var placement = data.placement;
3182  var basePlacement = placement.split('-')[0];
3183  var shiftvariation = placement.split('-')[1];
3184
3185  // if shift shiftvariation is specified, run the modifier
3186  if (shiftvariation) {
3187    var _data$offsets = data.offsets,
3188        reference = _data$offsets.reference,
3189        popper = _data$offsets.popper;
3190
3191    var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
3192    var side = isVertical ? 'left' : 'top';
3193    var measurement = isVertical ? 'width' : 'height';
3194
3195    var shiftOffsets = {
3196      start: defineProperty({}, side, reference[side]),
3197      end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
3198    };
3199
3200    data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
3201  }
3202
3203  return data;
3204}
3205
3206/**
3207 * @function
3208 * @memberof Modifiers
3209 * @argument {Object} data - The data object generated by update method
3210 * @argument {Object} options - Modifiers configuration and options
3211 * @returns {Object} The data object, properly modified
3212 */
3213function hide(data) {
3214  if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
3215    return data;
3216  }
3217
3218  var refRect = data.offsets.reference;
3219  var bound = find(data.instance.modifiers, function (modifier) {
3220    return modifier.name === 'preventOverflow';
3221  }).boundaries;
3222
3223  if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
3224    // Avoid unnecessary DOM access if visibility hasn't changed
3225    if (data.hide === true) {
3226      return data;
3227    }
3228
3229    data.hide = true;
3230    data.attributes['x-out-of-boundaries'] = '';
3231  } else {
3232    // Avoid unnecessary DOM access if visibility hasn't changed
3233    if (data.hide === false) {
3234      return data;
3235    }
3236
3237    data.hide = false;
3238    data.attributes['x-out-of-boundaries'] = false;
3239  }
3240
3241  return data;
3242}
3243
3244/**
3245 * @function
3246 * @memberof Modifiers
3247 * @argument {Object} data - The data object generated by `update` method
3248 * @argument {Object} options - Modifiers configuration and options
3249 * @returns {Object} The data object, properly modified
3250 */
3251function inner(data) {
3252  var placement = data.placement;
3253  var basePlacement = placement.split('-')[0];
3254  var _data$offsets = data.offsets,
3255      popper = _data$offsets.popper,
3256      reference = _data$offsets.reference;
3257
3258  var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
3259
3260  var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
3261
3262  popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
3263
3264  data.placement = getOppositePlacement(placement);
3265  data.offsets.popper = getClientRect(popper);
3266
3267  return data;
3268}
3269
3270/**
3271 * Modifier function, each modifier can have a function of this type assigned
3272 * to its `fn` property.<br />
3273 * These functions will be called on each update, this means that you must
3274 * make sure they are performant enough to avoid performance bottlenecks.
3275 *
3276 * @function ModifierFn
3277 * @argument {dataObject} data - The data object generated by `update` method
3278 * @argument {Object} options - Modifiers configuration and options
3279 * @returns {dataObject} The data object, properly modified
3280 */
3281
3282/**
3283 * Modifiers are plugins used to alter the behavior of your poppers.<br />
3284 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
3285 * needed by the library.
3286 *
3287 * Usually you don't want to override the `order`, `fn` and `onLoad` props.
3288 * All the other properties are configurations that could be tweaked.
3289 * @namespace modifiers
3290 */
3291var modifiers = {
3292  /**
3293   * Modifier used to shift the popper on the start or end of its reference
3294   * element.<br />
3295   * It will read the variation of the `placement` property.<br />
3296   * It can be one either `-end` or `-start`.
3297   * @memberof modifiers
3298   * @inner
3299   */
3300  shift: {
3301    /** @prop {number} order=100 - Index used to define the order of execution */
3302    order: 100,
3303    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3304    enabled: true,
3305    /** @prop {ModifierFn} */
3306    fn: shift
3307  },
3308
3309  /**
3310   * The `offset` modifier can shift your popper on both its axis.
3311   *
3312   * It accepts the following units:
3313   * - `px` or unit-less, interpreted as pixels
3314   * - `%` or `%r`, percentage relative to the length of the reference element
3315   * - `%p`, percentage relative to the length of the popper element
3316   * - `vw`, CSS viewport width unit
3317   * - `vh`, CSS viewport height unit
3318   *
3319   * For length is intended the main axis relative to the placement of the popper.<br />
3320   * This means that if the placement is `top` or `bottom`, the length will be the
3321   * `width`. In case of `left` or `right`, it will be the `height`.
3322   *
3323   * You can provide a single value (as `Number` or `String`), or a pair of values
3324   * as `String` divided by a comma or one (or more) white spaces.<br />
3325   * The latter is a deprecated method because it leads to confusion and will be
3326   * removed in v2.<br />
3327   * Additionally, it accepts additions and subtractions between different units.
3328   * Note that multiplications and divisions aren't supported.
3329   *
3330   * Valid examples are:
3331   * ```
3332   * 10
3333   * '10%'
3334   * '10, 10'
3335   * '10%, 10'
3336   * '10 + 10%'
3337   * '10 - 5vh + 3%'
3338   * '-10px + 5vh, 5px - 6%'
3339   * ```
3340   * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
3341   * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
3342   * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
3343   *
3344   * @memberof modifiers
3345   * @inner
3346   */
3347  offset: {
3348    /** @prop {number} order=200 - Index used to define the order of execution */
3349    order: 200,
3350    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3351    enabled: true,
3352    /** @prop {ModifierFn} */
3353    fn: offset,
3354    /** @prop {Number|String} offset=0
3355     * The offset value as described in the modifier description
3356     */
3357    offset: 0
3358  },
3359
3360  /**
3361   * Modifier used to prevent the popper from being positioned outside the boundary.
3362   *
3363   * A scenario exists where the reference itself is not within the boundaries.<br />
3364   * We can say it has "escaped the boundaries" — or just "escaped".<br />
3365   * In this case we need to decide whether the popper should either:
3366   *
3367   * - detach from the reference and remain "trapped" in the boundaries, or
3368   * - if it should ignore the boundary and "escape with its reference"
3369   *
3370   * When `escapeWithReference` is set to`true` and reference is completely
3371   * outside its boundaries, the popper will overflow (or completely leave)
3372   * the boundaries in order to remain attached to the edge of the reference.
3373   *
3374   * @memberof modifiers
3375   * @inner
3376   */
3377  preventOverflow: {
3378    /** @prop {number} order=300 - Index used to define the order of execution */
3379    order: 300,
3380    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3381    enabled: true,
3382    /** @prop {ModifierFn} */
3383    fn: preventOverflow,
3384    /**
3385     * @prop {Array} [priority=['left','right','top','bottom']]
3386     * Popper will try to prevent overflow following these priorities by default,
3387     * then, it could overflow on the left and on top of the `boundariesElement`
3388     */
3389    priority: ['left', 'right', 'top', 'bottom'],
3390    /**
3391     * @prop {number} padding=5
3392     * Amount of pixel used to define a minimum distance between the boundaries
3393     * and the popper. This makes sure the popper always has a little padding
3394     * between the edges of its container
3395     */
3396    padding: 5,
3397    /**
3398     * @prop {String|HTMLElement} boundariesElement='scrollParent'
3399     * Boundaries used by the modifier. Can be `scrollParent`, `window`,
3400     * `viewport` or any DOM element.
3401     */
3402    boundariesElement: 'scrollParent'
3403  },
3404
3405  /**
3406   * Modifier used to make sure the reference and its popper stay near each other
3407   * without leaving any gap between the two. Especially useful when the arrow is
3408   * enabled and you want to ensure that it points to its reference element.
3409   * It cares only about the first axis. You can still have poppers with margin
3410   * between the popper and its reference element.
3411   * @memberof modifiers
3412   * @inner
3413   */
3414  keepTogether: {
3415    /** @prop {number} order=400 - Index used to define the order of execution */
3416    order: 400,
3417    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3418    enabled: true,
3419    /** @prop {ModifierFn} */
3420    fn: keepTogether
3421  },
3422
3423  /**
3424   * This modifier is used to move the `arrowElement` of the popper to make
3425   * sure it is positioned between the reference element and its popper element.
3426   * It will read the outer size of the `arrowElement` node to detect how many
3427   * pixels of conjunction are needed.
3428   *
3429   * It has no effect if no `arrowElement` is provided.
3430   * @memberof modifiers
3431   * @inner
3432   */
3433  arrow: {
3434    /** @prop {number} order=500 - Index used to define the order of execution */
3435    order: 500,
3436    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3437    enabled: true,
3438    /** @prop {ModifierFn} */
3439    fn: arrow,
3440    /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
3441    element: '[x-arrow]'
3442  },
3443
3444  /**
3445   * Modifier used to flip the popper's placement when it starts to overlap its
3446   * reference element.
3447   *
3448   * Requires the `preventOverflow` modifier before it in order to work.
3449   *
3450   * **NOTE:** this modifier will interrupt the current update cycle and will
3451   * restart it if it detects the need to flip the placement.
3452   * @memberof modifiers
3453   * @inner
3454   */
3455  flip: {
3456    /** @prop {number} order=600 - Index used to define the order of execution */
3457    order: 600,
3458    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3459    enabled: true,
3460    /** @prop {ModifierFn} */
3461    fn: flip,
3462    /**
3463     * @prop {String|Array} behavior='flip'
3464     * The behavior used to change the popper's placement. It can be one of
3465     * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
3466     * placements (with optional variations)
3467     */
3468    behavior: 'flip',
3469    /**
3470     * @prop {number} padding=5
3471     * The popper will flip if it hits the edges of the `boundariesElement`
3472     */
3473    padding: 5,
3474    /**
3475     * @prop {String|HTMLElement} boundariesElement='viewport'
3476     * The element which will define the boundaries of the popper position.
3477     * The popper will never be placed outside of the defined boundaries
3478     * (except if `keepTogether` is enabled)
3479     */
3480    boundariesElement: 'viewport',
3481    /**
3482     * @prop {Boolean} flipVariations=false
3483     * The popper will switch placement variation between `-start` and `-end` when
3484     * the reference element overlaps its boundaries.
3485     *
3486     * The original placement should have a set variation.
3487     */
3488    flipVariations: false,
3489    /**
3490     * @prop {Boolean} flipVariationsByContent=false
3491     * The popper will switch placement variation between `-start` and `-end` when
3492     * the popper element overlaps its reference boundaries.
3493     *
3494     * The original placement should have a set variation.
3495     */
3496    flipVariationsByContent: false
3497  },
3498
3499  /**
3500   * Modifier used to make the popper flow toward the inner of the reference element.
3501   * By default, when this modifier is disabled, the popper will be placed outside
3502   * the reference element.
3503   * @memberof modifiers
3504   * @inner
3505   */
3506  inner: {
3507    /** @prop {number} order=700 - Index used to define the order of execution */
3508    order: 700,
3509    /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
3510    enabled: false,
3511    /** @prop {ModifierFn} */
3512    fn: inner
3513  },
3514
3515  /**
3516   * Modifier used to hide the popper when its reference element is outside of the
3517   * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
3518   * be used to hide with a CSS selector the popper when its reference is
3519   * out of boundaries.
3520   *
3521   * Requires the `preventOverflow` modifier before it in order to work.
3522   * @memberof modifiers
3523   * @inner
3524   */
3525  hide: {
3526    /** @prop {number} order=800 - Index used to define the order of execution */
3527    order: 800,
3528    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3529    enabled: true,
3530    /** @prop {ModifierFn} */
3531    fn: hide
3532  },
3533
3534  /**
3535   * Computes the style that will be applied to the popper element to gets
3536   * properly positioned.
3537   *
3538   * Note that this modifier will not touch the DOM, it just prepares the styles
3539   * so that `applyStyle` modifier can apply it. This separation is useful
3540   * in case you need to replace `applyStyle` with a custom implementation.
3541   *
3542   * This modifier has `850` as `order` value to maintain backward compatibility
3543   * with previous versions of Popper.js. Expect the modifiers ordering method
3544   * to change in future major versions of the library.
3545   *
3546   * @memberof modifiers
3547   * @inner
3548   */
3549  computeStyle: {
3550    /** @prop {number} order=850 - Index used to define the order of execution */
3551    order: 850,
3552    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3553    enabled: true,
3554    /** @prop {ModifierFn} */
3555    fn: computeStyle,
3556    /**
3557     * @prop {Boolean} gpuAcceleration=true
3558     * If true, it uses the CSS 3D transformation to position the popper.
3559     * Otherwise, it will use the `top` and `left` properties
3560     */
3561    gpuAcceleration: true,
3562    /**
3563     * @prop {string} [x='bottom']
3564     * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
3565     * Change this if your popper should grow in a direction different from `bottom`
3566     */
3567    x: 'bottom',
3568    /**
3569     * @prop {string} [x='left']
3570     * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
3571     * Change this if your popper should grow in a direction different from `right`
3572     */
3573    y: 'right'
3574  },
3575
3576  /**
3577   * Applies the computed styles to the popper element.
3578   *
3579   * All the DOM manipulations are limited to this modifier. This is useful in case
3580   * you want to integrate Popper.js inside a framework or view library and you
3581   * want to delegate all the DOM manipulations to it.
3582   *
3583   * Note that if you disable this modifier, you must make sure the popper element
3584   * has its position set to `absolute` before Popper.js can do its work!
3585   *
3586   * Just disable this modifier and define your own to achieve the desired effect.
3587   *
3588   * @memberof modifiers
3589   * @inner
3590   */
3591  applyStyle: {
3592    /** @prop {number} order=900 - Index used to define the order of execution */
3593    order: 900,
3594    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
3595    enabled: true,
3596    /** @prop {ModifierFn} */
3597    fn: applyStyle,
3598    /** @prop {Function} */
3599    onLoad: applyStyleOnLoad,
3600    /**
3601     * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
3602     * @prop {Boolean} gpuAcceleration=true
3603     * If true, it uses the CSS 3D transformation to position the popper.
3604     * Otherwise, it will use the `top` and `left` properties
3605     */
3606    gpuAcceleration: undefined
3607  }
3608};
3609
3610/**
3611 * The `dataObject` is an object containing all the information used by Popper.js.
3612 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
3613 * @name dataObject
3614 * @property {Object} data.instance The Popper.js instance
3615 * @property {String} data.placement Placement applied to popper
3616 * @property {String} data.originalPlacement Placement originally defined on init
3617 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
3618 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
3619 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
3620 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
3621 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
3622 * @property {Object} data.boundaries Offsets of the popper boundaries
3623 * @property {Object} data.offsets The measurements of popper, reference and arrow elements
3624 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
3625 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
3626 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
3627 */
3628
3629/**
3630 * Default options provided to Popper.js constructor.<br />
3631 * These can be overridden using the `options` argument of Popper.js.<br />
3632 * To override an option, simply pass an object with the same
3633 * structure of the `options` object, as the 3rd argument. For example:
3634 * ```
3635 * new Popper(ref, pop, {
3636 *   modifiers: {
3637 *     preventOverflow: { enabled: false }
3638 *   }
3639 * })
3640 * ```
3641 * @type {Object}
3642 * @static
3643 * @memberof Popper
3644 */
3645var Defaults = {
3646  /**
3647   * Popper's placement.
3648   * @prop {Popper.placements} placement='bottom'
3649   */
3650  placement: 'bottom',
3651
3652  /**
3653   * Set this to true if you want popper to position it self in 'fixed' mode
3654   * @prop {Boolean} positionFixed=false
3655   */
3656  positionFixed: false,
3657
3658  /**
3659   * Whether events (resize, scroll) are initially enabled.
3660   * @prop {Boolean} eventsEnabled=true
3661   */
3662  eventsEnabled: true,
3663
3664  /**
3665   * Set to true if you want to automatically remove the popper when
3666   * you call the `destroy` method.
3667   * @prop {Boolean} removeOnDestroy=false
3668   */
3669  removeOnDestroy: false,
3670
3671  /**
3672   * Callback called when the popper is created.<br />
3673   * By default, it is set to no-op.<br />
3674   * Access Popper.js instance with `data.instance`.
3675   * @prop {onCreate}
3676   */
3677  onCreate: function onCreate() {},
3678
3679  /**
3680   * Callback called when the popper is updated. This callback is not called
3681   * on the initialization/creation of the popper, but only on subsequent
3682   * updates.<br />
3683   * By default, it is set to no-op.<br />
3684   * Access Popper.js instance with `data.instance`.
3685   * @prop {onUpdate}
3686   */
3687  onUpdate: function onUpdate() {},
3688
3689  /**
3690   * List of modifiers used to modify the offsets before they are applied to the popper.
3691   * They provide most of the functionalities of Popper.js.
3692   * @prop {modifiers}
3693   */
3694  modifiers: modifiers
3695};
3696
3697/**
3698 * @callback onCreate
3699 * @param {dataObject} data
3700 */
3701
3702/**
3703 * @callback onUpdate
3704 * @param {dataObject} data
3705 */
3706
3707// Utils
3708// Methods
3709var Popper = function () {
3710  /**
3711   * Creates a new Popper.js instance.
3712   * @class Popper
3713   * @param {Element|referenceObject} reference - The reference element used to position the popper
3714   * @param {Element} popper - The HTML / XML element used as the popper
3715   * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
3716   * @return {Object} instance - The generated Popper.js instance
3717   */
3718  function Popper(reference, popper) {
3719    var _this = this;
3720
3721    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3722    classCallCheck(this, Popper);
3723
3724    this.scheduleUpdate = function () {
3725      return requestAnimationFrame(_this.update);
3726    };
3727
3728    // make update() debounced, so that it only runs at most once-per-tick
3729    this.update = debounce(this.update.bind(this));
3730
3731    // with {} we create a new object with the options inside it
3732    this.options = _extends({}, Popper.Defaults, options);
3733
3734    // init state
3735    this.state = {
3736      isDestroyed: false,
3737      isCreated: false,
3738      scrollParents: []
3739    };
3740
3741    // get reference and popper elements (allow jQuery wrappers)
3742    this.reference = reference && reference.jquery ? reference[0] : reference;
3743    this.popper = popper && popper.jquery ? popper[0] : popper;
3744
3745    // Deep merge modifiers options
3746    this.options.modifiers = {};
3747    Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
3748      _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
3749    });
3750
3751    // Refactoring modifiers' list (Object => Array)
3752    this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
3753      return _extends({
3754        name: name
3755      }, _this.options.modifiers[name]);
3756    })
3757    // sort the modifiers by order
3758    .sort(function (a, b) {
3759      return a.order - b.order;
3760    });
3761
3762    // modifiers have the ability to execute arbitrary code when Popper.js get inited
3763    // such code is executed in the same order of its modifier
3764    // they could add new properties to their options configuration
3765    // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
3766    this.modifiers.forEach(function (modifierOptions) {
3767      if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
3768        modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
3769      }
3770    });
3771
3772    // fire the first update to position the popper in the right place
3773    this.update();
3774
3775    var eventsEnabled = this.options.eventsEnabled;
3776    if (eventsEnabled) {
3777      // setup event listeners, they will take care of update the position in specific situations
3778      this.enableEventListeners();
3779    }
3780
3781    this.state.eventsEnabled = eventsEnabled;
3782  }
3783
3784  // We can't use class properties because they don't get listed in the
3785  // class prototype and break stuff like Sinon stubs
3786
3787
3788  createClass(Popper, [{
3789    key: 'update',
3790    value: function update$$1() {
3791      return update.call(this);
3792    }
3793  }, {
3794    key: 'destroy',
3795    value: function destroy$$1() {
3796      return destroy.call(this);
3797    }
3798  }, {
3799    key: 'enableEventListeners',
3800    value: function enableEventListeners$$1() {
3801      return enableEventListeners.call(this);
3802    }
3803  }, {
3804    key: 'disableEventListeners',
3805    value: function disableEventListeners$$1() {
3806      return disableEventListeners.call(this);
3807    }
3808
3809    /**
3810     * Schedules an update. It will run on the next UI update available.
3811     * @method scheduleUpdate
3812     * @memberof Popper
3813     */
3814
3815
3816    /**
3817     * Collection of utilities useful when writing custom modifiers.
3818     * Starting from version 1.7, this method is available only if you
3819     * include `popper-utils.js` before `popper.js`.
3820     *
3821     * **DEPRECATION**: This way to access PopperUtils is deprecated
3822     * and will be removed in v2! Use the PopperUtils module directly instead.
3823     * Due to the high instability of the methods contained in Utils, we can't
3824     * guarantee them to follow semver. Use them at your own risk!
3825     * @static
3826     * @private
3827     * @type {Object}
3828     * @deprecated since version 1.8
3829     * @member Utils
3830     * @memberof Popper
3831     */
3832
3833  }]);
3834  return Popper;
3835}();
3836
3837/**
3838 * The `referenceObject` is an object that provides an interface compatible with Popper.js
3839 * and lets you use it as replacement of a real DOM node.<br />
3840 * You can use this method to position a popper relatively to a set of coordinates
3841 * in case you don't have a DOM node to use as reference.
3842 *
3843 * ```
3844 * new Popper(referenceObject, popperNode);
3845 * ```
3846 *
3847 * NB: This feature isn't supported in Internet Explorer 10.
3848 * @name referenceObject
3849 * @property {Function} data.getBoundingClientRect
3850 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
3851 * @property {number} data.clientWidth
3852 * An ES6 getter that will return the width of the virtual reference element.
3853 * @property {number} data.clientHeight
3854 * An ES6 getter that will return the height of the virtual reference element.
3855 */
3856
3857
3858Popper.Utils = (typeof window !== 'undefined' ? window : 
3858__webpack_require__.g).PopperUtils;
3859Popper.placements = placements;
3860Popper.Defaults = Defaults;
3861
3862/* harmony default export */ const popper = (Popper);
3863//# sourceMappingURL=popper.js.map
3864
3865;// ./src/Gutenberg/Components/BootstrapDropdown/bootstrap-dropdown.js
3866/**
3867 * --------------------------------------------------------------------------
3868 * Bootstrap (v4.6.2): dropdown.js
3869 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3870 * --------------------------------------------------------------------------
3871 */
3872
3873
3874
3875
3876/**
3877 * Constants
3878 */
3879
3880const bootstrap_dropdown_NAME = 'dropdown';
3881const bootstrap_dropdown_VERSION = '4.6.2';
3882const bootstrap_dropdown_DATA_KEY = 'bs.dropdown';
3883const bootstrap_dropdown_EVENT_KEY = `.${bootstrap_dropdown_DATA_KEY}`;
3884const bootstrap_dropdown_DATA_API_KEY = '.data-api';
3885const bootstrap_dropdown_ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
3886const SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
3887const TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
3888const ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
3889const ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
3890const RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
3891const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEYCODE}|${ARROW_DOWN_KEYCODE}|${bootstrap_dropdown_ESCAPE_KEYCODE}`);
3892const CLASS_NAME_DISABLED = 'disabled';
3893const bootstrap_dropdown_CLASS_NAME_SHOW = 'show';
3894const CLASS_NAME_DROPUP = 'dropup';
3895const CLASS_NAME_DROPRIGHT = 'dropright';
3896const CLASS_NAME_DROPLEFT = 'dropleft';
3897const CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
3898const CLASS_NAME_POSITION_STATIC = 'position-static';
3899const bootstrap_dropdown_EVENT_HIDE = `hide${bootstrap_dropdown_EVENT_KEY}`;
3900const bootstrap_dropdown_EVENT_HIDDEN = `hidden${bootstrap_dropdown_EVENT_KEY}`;
3901const bootstrap_dropdown_EVENT_SHOW = `show${bootstrap_dropdown_EVENT_KEY}`;
3902const bootstrap_dropdown_EVENT_SHOWN = `shown${bootstrap_dropdown_EVENT_KEY}`;
3903const EVENT_CLICK = (/* unused pure expression or super */ null && (`click${bootstrap_dropdown_EVENT_KEY}`));
3904const bootstrap_dropdown_EVENT_CLICK_DATA_API = (/* unused pure expression or super */ null && (`click${bootstrap_dropdown_EVENT_KEY}${bootstrap_dropdown_DATA_API_KEY}`));
3905const EVENT_KEYDOWN_DATA_API = (/* unused pure expression or super */ null && (`keydown${bootstrap_dropdown_EVENT_KEY}${bootstrap_dropdown_DATA_API_KEY}`));
3906const EVENT_KEYUP_DATA_API = (/* unused pure expression or super */ null && (`keyup${bootstrap_dropdown_EVENT_KEY}${bootstrap_dropdown_DATA_API_KEY}`));
3907const bootstrap_dropdown_SELECTOR_DATA_TOGGLE = '[data-toggle="dropdown"]';
3908const SELECTOR_FORM_CHILD = '.dropdown form';
3909const SELECTOR_MENU = '.dropdown-menu';
3910const SELECTOR_NAVBAR_NAV = '.navbar-nav';
3911const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
3912const PLACEMENT_TOP = 'top-start';
3913const PLACEMENT_TOPEND = 'top-end';
3914const PLACEMENT_BOTTOM = 'bottom-start';
3915const PLACEMENT_BOTTOMEND = 'bottom-end';
3916const PLACEMENT_RIGHT = 'right-start';
3917const PLACEMENT_LEFT = 'left-start';
3918const bootstrap_dropdown_Default = {
3919  offset: 0,
3920  flip: true,
3921  boundary: 'scrollParent',
3922  reference: 'toggle',
3923  display: 'dynamic',
3924  popperConfig: null
3925};
3926const bootstrap_dropdown_DefaultType = {
3927  offset: '(number|string|function)',
3928  flip: 'boolean',
3929  boundary: '(string|element)',
3930  reference: '(string|element)',
3931  display: 'string',
3932  popperConfig: '(null|object)'
3933};
3934
3935/**
3936 * Class definition
3937 */
3938
3939class Dropdown {
3940  static _instances = new WeakMap();
3941  static _touchMouseOverListeners = new Map();
3942  constructor(element, config) {
3943    this._element = element;
3944    this._popper = null;
3945    this._config = this._getConfig(config);
3946    this._menu = this._getMenuElement();
3947    this._inNavbar = this._detectNavbar();
3948    this._clickHandler = null;
3949    this._addEventListeners();
3950    Dropdown._instances.set(this._element, this);
3951  }
3952
3953  // Getters
3954  static get VERSION() {
3955    return bootstrap_dropdown_VERSION;
3956  }
3957  static get Default() {
3958    return bootstrap_dropdown_Default;
3959  }
3960  static get DefaultType() {
3961    return bootstrap_dropdown_DefaultType;
3962  }
3963
3964  // Public
3965  toggle() {
3966    if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) {
3967      return;
3968    }
3969    const isActive = this._menu.classList.contains(bootstrap_dropdown_CLASS_NAME_SHOW);
3970    Dropdown._clearMenus();
3971    if (isActive) {
3972      return;
3973    }
3974    this.show(true);
3975  }
3976  show(usePopper = false) {
3977    if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(bootstrap_dropdown_CLASS_NAME_SHOW)) {
3978      return;
3979    }
3980    const relatedTarget = {
3981      relatedTarget: this._element
3982    };
3983    const parent = Dropdown._getParentFromElement(this._element);
3984    const showEvent = Dropdown._triggerEvent(parent, bootstrap_dropdown_EVENT_SHOW, relatedTarget);
3985    if (showEvent.defaultPrevented) {
3986      return;
3987    }
3988
3989    // Totally disable Popper for Dropdowns in Navbar
3990    if (!this._inNavbar && usePopper) {
3991      // Check for Popper dependency
3992      if (typeof popper === 'undefined') {
3993        throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
3994      }
3995      let referenceElement = this._element;
3996      if (this._config.reference === 'parent') {
3997        referenceElement = parent;
3998      } else if (bootstrap_util.isElement(this._config.reference)) {
3999        referenceElement = this._config.reference;
4000
4001        // Check if it's jQuery element
4002        if (typeof this._config.reference.jquery !== 'undefined') {
4003          referenceElement = this._config.reference[0];
4004        }
4005      }
4006
4007      // If boundary is not `scrollParent`, then set position to `static`
4008      // to allow the menu to "escape" the scroll parent's boundaries
4009      // https://github.com/twbs/bootstrap/issues/24251
4010      if (this._config.boundary !== 'scrollParent') {
4011        parent.classList.add(CLASS_NAME_POSITION_STATIC);
4012      }
4013      this._popper = new popper(referenceElement, this._menu, this._getPopperConfig());
4014    }
4015
4016    // If this is a touch-enabled device we add extra
4017    // empty mouseover listeners to the body's immediate children;
4018    // only needed because of broken event delegation on iOS
4019    // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
4020    if ('ontouchstart' in document.documentElement && parent.closest(SELECTOR_NAVBAR_NAV) === null) {
4021      Dropdown._addTouchListeners();
4022    }
4023    this._element.focus();
4024    this._element.setAttribute('aria-expanded', true);
4025    this._menu.classList.toggle(bootstrap_dropdown_CLASS_NAME_SHOW);
4026    parent.classList.toggle(bootstrap_dropdown_CLASS_NAME_SHOW);
4027    Dropdown._triggerEvent(parent, bootstrap_dropdown_EVENT_SHOWN, relatedTarget);
4028  }
4029  hide() {
4030    if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(bootstrap_dropdown_CLASS_NAME_SHOW)) {
4031      return;
4032    }
4033    const relatedTarget = {
4034      relatedTarget: this._element
4035    };
4036    const parent = Dropdown._getParentFromElement(this._element);
4037    const hideEvent = Dropdown._triggerEvent(parent, bootstrap_dropdown_EVENT_HIDE, relatedTarget);
4038    if (hideEvent.defaultPrevented) {
4039      return;
4040    }
4041    if (this._popper) {
4042      this._popper.destroy();
4043    }
4044    this._menu.classList.toggle(bootstrap_dropdown_CLASS_NAME_SHOW);
4045    parent.classList.toggle(bootstrap_dropdown_CLASS_NAME_SHOW);
4046    Dropdown._triggerEvent(parent, bootstrap_dropdown_EVENT_HIDDEN, relatedTarget);
4047  }
4048  dispose() {
4049    Dropdown._instances.delete(this._element);
4050    if (this._clickHandler) {
4051      this._element.removeEventListener('click', this._clickHandler);
4052      this._clickHandler = null;
4053    }
4054    this._element = null;
4055    this._menu = null;
4056    if (this._popper !== null) {
4057      this._popper.destroy();
4058      this._popper = null;
4059    }
4060  }
4061  update() {
4062    this._inNavbar = this._detectNavbar();
4063    if (this._popper !== null) {
4064      this._popper.scheduleUpdate();
4065    }
4066  }
4067
4068  // Private
4069  _addEventListeners() {
4070    this._clickHandler = event => {
4071      event.preventDefault();
4072      event.stopPropagation();
4073      this.toggle();
4074    };
4075    this._element.addEventListener('click', this._clickHandler);
4076  }
4077  _getConfig(config) {
4078    config = {
4079      ...this.constructor.Default,
4080      ...Dropdown._getDataAttributes(this._element),
4081      ...config
4082    };
4083    bootstrap_util.typeCheckConfig(bootstrap_dropdown_NAME, config, this.constructor.DefaultType);
4084    return config;
4085  }
4086  _getMenuElement() {
4087    if (!this._menu) {
4088      const parent = Dropdown._getParentFromElement(this._element);
4089      if (parent) {
4090        this._menu = parent.querySelector(SELECTOR_MENU);
4091      }
4092    }
4093    return this._menu;
4094  }
4095  _getPlacement() {
4096    const parentDropdown = this._element.parentNode;
4097    let placement = PLACEMENT_BOTTOM;
4098
4099    // Handle dropup
4100    if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
4101      placement = this._menu.classList.contains(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
4102    } else if (parentDropdown.classList.contains(CLASS_NAME_DROPRIGHT)) {
4103      placement = PLACEMENT_RIGHT;
4104    } else if (parentDropdown.classList.contains(CLASS_NAME_DROPLEFT)) {
4105      placement = PLACEMENT_LEFT;
4106    } else if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
4107      placement = PLACEMENT_BOTTOMEND;
4108    }
4109    return placement;
4110  }
4111  _detectNavbar() {
4112    return this._element.closest('.navbar') !== null;
4113  }
4114  _getOffset() {
4115    const offset = {};
4116    if (typeof this._config.offset === 'function') {
4117      offset.fn = data => {
4118        data.offsets = {
4119          ...data.offsets,
4120          ...this._config.offset(data.offsets, this._element)
4121        };
4122        return data;
4123      };
4124    } else {
4125      offset.offset = this._config.offset;
4126    }
4127    return offset;
4128  }
4129  _getPopperConfig() {
4130    const popperConfig = {
4131      placement: this._getPlacement(),
4132      modifiers: {
4133        offset: this._getOffset(),
4134        flip: {
4135          enabled: this._config.flip
4136        },
4137        preventOverflow: {
4138          boundariesElement: this._config.boundary
4139        }
4140      }
4141    };
4142
4143    // Disable Popper if we have a static display
4144    if (this._config.display === 'static') {
4145      popperConfig.modifiers.applyStyle = {
4146        enabled: false
4147      };
4148    }
4149    return {
4150      ...popperConfig,
4151      ...this._config.popperConfig
4152    };
4153  }
4154
4155  // Static
4156  static getInstance(element) {
4157    return Dropdown._instances.get(element) || null;
4158  }
4159  static getOrCreateInstance(element, config = {}) {
4160    return this.getInstance(element) || new this(element, config);
4161  }
4162  static _getDataAttributes(element) {
4163    if (!element) {
4164      return {};
4165    }
4166    const parseValue = value => {
4167      if (value === 'true') {
4168        return true;
4169      }
4170      if (value === 'false') {
4171        return false;
4172      }
4173      if (value === '' || value === null || typeof value === 'undefined') {
4174        return value;
4175      }
4176      if (!Number.isNaN(Number(value)) && value.trim() !== '') {
4177        return Number(value);
4178      }
4179      try {
4180        return JSON.parse(value);
4181      } catch (_) {
4182        return value;
4183      }
4184    };
4185    return {
4186      offset: parseValue(element.dataset.offset),
4187      flip: parseValue(element.dataset.flip),
4188      boundary: parseValue(element.dataset.boundary),
4189      reference: parseValue(element.dataset.reference),
4190      display: parseValue(element.dataset.display),
4191      popperConfig: parseValue(element.dataset.popperConfig)
4192    };
4193  }
4194  static interface(elements, config) {
4195    elements.forEach(element => {
4196      let data = Dropdown.getInstance(element);
4197      const _config = typeof config === 'object' ? config : null;
4198      if (!data) {
4199        data = new Dropdown(element, _config);
4200      }
4201      if (typeof config === 'string') {
4202        if (typeof data[config] === 'undefined') {
4203          throw new TypeError(`No method named "${config}"`);
4204        }
4205        data[config]();
4206      }
4207    });
4208  }
4209  static _triggerEvent(element, eventName, detail = {}) {
4210    const event = new CustomEvent(eventName, {
4211      bubbles: true,
4212      cancelable: true,
4213      detail
4214    });
4215    if (typeof detail.relatedTarget !== 'undefined') {
4216      Object.defineProperty(event, 'relatedTarget', {
4217        configurable: true,
4218        enumerable: true,
4219        value: detail.relatedTarget
4220      });
4221    }
4222    if (typeof detail.clickEvent !== 'undefined') {
4223      Object.defineProperty(event, 'clickEvent', {
4224        configurable: true,
4225        enumerable: true,
4226        value: detail.clickEvent
4227      });
4228    }
4229    element.dispatchEvent(event);
4230    const jQueryRef = window.jQuery;
4231    if (typeof jQueryRef !== 'undefined') {
4232      const jqEvent = jQueryRef.Event(eventName, detail);
4233      jQueryRef(element).trigger(jqEvent);
4234      if (jqEvent.isDefaultPrevented()) {
4235        event.preventDefault();
4236      }
4237    }
4238    return event;
4239  }
4240  static _addTouchListeners() {
4241    const children = Array.from(document.body.children);
4242    children.forEach(child => {
4243      if (Dropdown._touchMouseOverListeners.has(child)) {
4244        return;
4245      }
4246      const noop = () => {};
4247      child.addEventListener('mouseover', noop);
4248      Dropdown._touchMouseOverListeners.set(child, noop);
4249    });
4250  }
4251  static _removeTouchListeners() {
4252    Dropdown._touchMouseOverListeners.forEach((handler, element) => {
4253      element.removeEventListener('mouseover', handler);
4254    });
4255    Dropdown._touchMouseOverListeners.clear();
4256  }
4257  static _clearMenus(event) {
4258    const which = event ? event.which || event.keyCode : null;
4259    const isRightClick = event && (which === RIGHT_MOUSE_BUTTON_WHICH || event.button === 2);
4260    if (event && (isRightClick || event.type === 'keyup' && which !== TAB_KEYCODE)) {
4261      return;
4262    }
4263    const toggles = [].slice.call(document.querySelectorAll(bootstrap_dropdown_SELECTOR_DATA_TOGGLE));
4264    for (let i = 0, len = toggles.length; i < len; i++) {
4265      const parent = Dropdown._getParentFromElement(toggles[i]);
4266      const context = Dropdown.getInstance(toggles[i]);
4267      const relatedTarget = {
4268        relatedTarget: toggles[i]
4269      };
4270      if (event && event.type === 'click') {
4271        relatedTarget.clickEvent = event;
4272      }
4273      if (!context || !parent) {
4274        continue;
4275      }
4276      const dropdownMenu = context._menu;
4277      if (!parent.classList.contains(bootstrap_dropdown_CLASS_NAME_SHOW)) {
4278        continue;
4279      }
4280      if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && which === TAB_KEYCODE) && parent.contains(event.target)) {
4281        continue;
4282      }
4283      const hideEvent = Dropdown._triggerEvent(parent, bootstrap_dropdown_EVENT_HIDE, relatedTarget);
4284      if (hideEvent.defaultPrevented) {
4285        continue;
4286      }
4287
4288      // If this is a touch-enabled device we remove the extra
4289      // empty mouseover listeners we added for iOS support
4290      if ('ontouchstart' in document.documentElement) {
4291        Dropdown._removeTouchListeners();
4292      }
4293      toggles[i].setAttribute('aria-expanded', 'false');
4294      if (context._popper) {
4295        context._popper.destroy();
4296      }
4297      dropdownMenu.classList.remove(bootstrap_dropdown_CLASS_NAME_SHOW);
4298      parent.classList.remove(bootstrap_dropdown_CLASS_NAME_SHOW);
4299      Dropdown._triggerEvent(parent, bootstrap_dropdown_EVENT_HIDDEN, relatedTarget);
4300    }
4301  }
4302  static _getParentFromElement(element) {
4303    let parent;
4304    const selector = bootstrap_util.getSelectorFromElement(element);
4305    if (selector) {
4306      parent = document.querySelector(selector);
4307    }
4308    return parent || element.parentNode;
4309  }
4310
4311  // eslint-disable-next-line complexity
4312  static _dataApiKeydownHandler(event) {
4313    const which = event.which || event.keyCode;
4314    // If not input/textarea:
4315    //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
4316    // If input/textarea:
4317    //  - If space key => not a dropdown command
4318    //  - If key is other than escape
4319    //    - If key is not up or down => not a dropdown command
4320    //    - If trigger inside the menu =>
4320 not a dropdown command
4321    if (/input|textarea/i.test(event.target.tagName) ? which === SPACE_KEYCODE || which !== bootstrap_dropdown_ESCAPE_KEYCODE && (which !== ARROW_DOWN_KEYCODE && which !== ARROW_UP_KEYCODE || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(which)) {
4322      return;
4323    }
4324    if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) {
4325      return;
4326    }
4327    const parent = Dropdown._getParentFromElement(this);
4328    const isActive = parent.classList.contains(bootstrap_dropdown_CLASS_NAME_SHOW);
4329    if (!isActive && which === bootstrap_dropdown_ESCAPE_KEYCODE) {
4330      return;
4331    }
4332    event.preventDefault();
4333    event.stopPropagation();
4334    if (!isActive || which === bootstrap_dropdown_ESCAPE_KEYCODE || which === SPACE_KEYCODE) {
4335      if (which === bootstrap_dropdown_ESCAPE_KEYCODE) {
4336        parent.querySelector(bootstrap_dropdown_SELECTOR_DATA_TOGGLE)?.focus();
4337      }
4338      this.click();
4339      return;
4340    }
4341    const items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(item => item.offsetParent !== null || item.getClientRects().length > 0);
4342    if (items.length === 0) {
4343      return;
4344    }
4345    let index = items.indexOf(event.target);
4346    if (which === ARROW_UP_KEYCODE && index > 0) {
4347      // Up
4348      index--;
4349    }
4350    if (which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
4351      // Down
4352      index++;
4353    }
4354    if (index < 0) {
4355      index = 0;
4356    }
4357    items[index].focus();
4358  }
4359}
4360
4361/**
4362 * Data API implementation
4363 */
4364
4365document.addEventListener('keydown', event => {
4366  const trigger = event.target.closest(bootstrap_dropdown_SELECTOR_DATA_TOGGLE);
4367  if (trigger) {
4368    Dropdown._dataApiKeydownHandler.call(trigger, event);
4369    return;
4370  }
4371  const menu = event.target.closest(SELECTOR_MENU);
4372  if (menu) {
4373    Dropdown._dataApiKeydownHandler.call(menu, event);
4374  }
4375});
4376document.addEventListener('keyup', event => {
4377  Dropdown._clearMenus(event);
4378});
4379document.addEventListener('click', event => {
4380  const formChild = event.target.closest(SELECTOR_FORM_CHILD);
4381  if (formChild) {
4382    event.stopPropagation();
4383    return;
4384  }
4385  const toggle = event.target.closest(bootstrap_dropdown_SELECTOR_DATA_TOGGLE);
4386  if (toggle) {
4387    event.preventDefault();
4388    event.stopPropagation();
4389    Dropdown.interface([toggle], 'toggle');
4390    return;
4391  }
4392  Dropdown._clearMenus(event);
4393});
4394
4395/**
4396 * Optional jQuery bridge
4397 */
4398if (typeof window.jQuery !== 'undefined') {
4399  const $ = window.jQuery;
4400  const JQUERY_NO_CONFLICT = $.fn[bootstrap_dropdown_NAME];
4401  $.fn[bootstrap_dropdown_NAME] = function (config) {
4402    return Dropdown.interface([].slice.call(this), config);
4403  };
4404  $.fn[bootstrap_dropdown_NAME].Constructor = Dropdown;
4405  $.fn[bootstrap_dropdown_NAME].noConflict = () => {
4406    $.fn[bootstrap_dropdown_NAME] = JQUERY_NO_CONFLICT;
4407    return $.fn[bootstrap_dropdown_NAME];
4408  };
4409}
4410/* harmony default export */ const bootstrap_dropdown = ((/* unused pure expression or super */ null && (Dropdown)));
4411;// ./src/Gutenberg/cl2-blocks-view.js
4412
4413
4414
4415'use strict';
4416function init() {
4417  const callColibriUtil = (fn, ...args) => {
4418    window.colibri = window.colibri || {};
4419    window.colibri.utils = window.colibri.utils || {};
4420    const util = window.colibri.utils[fn];
4421    if (typeof util === 'function') {
4422      util.apply(null, args);
4423      return;
4424    }
4425    window.colibri.utils._queue = window.colibri.utils._queue || [];
4426    window.colibri.utils._queue.push({
4427      fn,
4428      args
4429    });
4430  };
4431  window.colibri.gdprReady.then(function (isGdprVisitor) {
4432    callColibriUtil('maybeUpdateTimezones');
4433    callColibriUtil('maybeInitMapLinks');
4434    document.querySelectorAll('.js-disable-click').forEach(function (el) {
4435      el.addEventListener('click', e => {
4436        e.preventDefault();
4437      });
4438    });
4439
4440    /**
4441     * Check if a user has scrolled to a products list to track on GA4.
4442     */
4443    const courseLists = document.querySelectorAll('[data-module="course-list"]');
4444    if (courseLists.length > 0) {
4445      courseLists.forEach(function (courseList) {
4446        courseList.listViewed = false;
4447        let productCodes = [];
4448
4449        // Get all the products in the list.
4450        const cards = courseList.querySelectorAll('.card');
4451        cards.forEach(function (card) {
4452          var _addToCartContainer$g;
4453          const itemId = +card.getAttribute('data-item-id');
4454          if (isGdprVisitor && window.colibri.shouldHideForGdpr(itemId)) {
4455            const parent = card.parentElement;
4456            if (parent && parent.classList.contains('grid-col')) {
4457              parent.remove();
4458            } else {
4459              card.remove();
4460            }
4461          }
4462          const addToCartContainer = card.querySelector('.add-to-cart-container');
4463          const productCode = addToCartContainer ? (_addToCartContainer$g = addToCartContainer.getAttribute('data-alt-product-code')) !== null && _addToCartContainer$g !== void 0 ? _addToCartContainer$g : addToCartContainer.getAttribute('data-product-code') : null;
4464          if (productCode) {
4465            productCodes.push(productCode);
4466          }
4467        });
4468        courseList.productCodes = productCodes;
4469      });
4470      window.addEventListener('scroll', checkIfProductsListInViewport);
4471      checkIfProductsListInViewport();
4472      const packagesTabs = document.querySelectorAll('.wp-block-colibri-tabs__tab');
4473      packagesTabs.forEach(function (packagesTab) {
4474        packagesTab.addEventListener('click', function () {
4475          checkIfProductsListInViewport();
4476        });
4477      });
4478      function checkIfProductsListInViewport() {
4479        const viewportHeight = window.innerHeight;
4480        courseLists.forEach(function (courseList) {
4481          if (courseList.offsetParent) {
4482            const courseListPosition = courseList.getBoundingClientRect().top;
4483            const scrollThreshold = courseListPosition - viewportHeight / 3;
4484            if (scrollThreshold <= 0 && scrollThreshold > -courseList.offsetHeight + viewportHeight / 3) {
4485              if (courseList.listViewed === false) {
4486                callColibriUtil('pushAnalyticsData', 'list', 'view_item_list', courseList.productCodes);
4487                courseList.listViewed = true;
4488              }
4489            } else {
4490              courseList.listViewed = false;
4491            }
4492          }
4493        });
4494      }
4495    }
4496
4497    /**
4498     * Check if a user is viewing a Product Details page to track on GA4.
4499     */
4500    const body = document.body;
4501    if (body.classList.contains('single-product')) {
4502      const productCodeElement = document.querySelector('[data-product-code]');
4503      const productCode = productCodeElement.getAttribute('data-product-code');
4504      callColibriUtil('pushAnalyticsData', productCode, 'view_item');
4505    }
4506
4507    /**
4508     * Check if a user opened a View Product Details modal to track on GA4.
4509     */
4510    const viewDetailsButtons = document.querySelectorAll('.details-page-link[rel="modal"]');
4511    viewDetailsButtons.forEach(function (viewDetailsButton) {
4512      viewDetailsButton.addEventListener('click', onViewDetailsButtonClick);
4513    });
4514    function onViewDetailsButtonClick(event) {
4515      const target = event.target;
4516      if (!(target instanceof Element)) {
4517        return;
4518      }
4519      const productCode = target.getAttribute('data-product-code');
4520      callColibriUtil('pushAnalyticsData', productCode, 'view_item');
4521    }
4522  });
4523}
4524if (document.readyState === 'loading') {
4525  document.addEventListener('DOMContentLoaded', init);
4526} else {
4527  init();
4528}
4529/******/ })()
4530;
4531//# sourceMappingURL=cl2-blocks-view.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.