From 744402b185d297c28d48d346844ef689123b3fea Mon Sep 17 00:00:00 2001 From: dgrammatiko Date: Sun, 10 Jan 2021 00:14:42 +0100 Subject: [PATCH 01/99] bs5 js --- build/media_source/vendor/bs5/js/alert.es6.js | 282 ++ .../vendor/bs5/js/alert.es6.min.js | 1 + .../media_source/vendor/bs5/js/button.es6.js | 178 + .../vendor/bs5/js/button.es6.min.js | 1 + .../vendor/bs5/js/carousel.es6.js | 801 ++++ .../vendor/bs5/js/carousel.es6.min.js | 1 + .../vendor/bs5/js/collapse.es6.js | 588 +++ .../vendor/bs5/js/collapse.es6.min.js | 1 + build/media_source/vendor/bs5/js/dom/data.js | 1 + .../vendor/bs5/js/dom/event-handler.js | 1 + .../vendor/bs5/js/dom/manipulator.js | 1 + .../vendor/bs5/js/dom/selector-engine.js | 1 + .../vendor/bs5/js/dropdown.es6.js | 633 +++ .../vendor/bs5/js/dropdown.es6.min.js | 1 + .../vendor/bs5/js/js/alert.es6.js | 281 ++ .../vendor/bs5/js/js/alert.es6.min.js | 1 + .../vendor/bs5/js/js/button.es6.js | 177 + .../vendor/bs5/js/js/button.es6.min.js | 1 + .../vendor/bs5/js/js/carousel.es6.js | 800 ++++ .../vendor/bs5/js/js/carousel.es6.min.js | 1 + .../vendor/bs5/js/js/collapse.es6.js | 587 +++ .../vendor/bs5/js/js/collapse.es6.min.js | 1 + .../media_source/vendor/bs5/js/js/dom/data.js | 1 + .../vendor/bs5/js/js/dom/event-handler.js | 1 + .../vendor/bs5/js/js/dom/manipulator.js | 1 + .../vendor/bs5/js/js/dom/selector-engine.js | 1 + .../vendor/bs5/js/js/dropdown.es6.js | 632 +++ .../vendor/bs5/js/js/dropdown.es6.min.js | 1 + .../vendor/bs5/js/js/modal.es6.js | 789 ++++ .../vendor/bs5/js/js/modal.es6.min.js | 1 + .../vendor/bs5/js/js/popover.es6.js | 211 + .../vendor/bs5/js/js/popover.es6.min.js | 1 + .../vendor/bs5/js/js/popper/index.js | 1 + .../vendor/bs5/js/js/scrollspy.es6.js | 457 +++ .../vendor/bs5/js/js/scrollspy.es6.min.js | 1 + .../media_source/vendor/bs5/js/js/tab.es6.js | 364 ++ .../vendor/bs5/js/js/tab.es6.min.js | 1 + .../vendor/bs5/js/js/toast.es6.js | 371 ++ .../vendor/bs5/js/js/toast.es6.min.js | 1 + .../vendor/bs5/js/js/tooltip.es6.js | 1100 ++++++ .../vendor/bs5/js/js/tooltip.es6.min.js | 1 + build/media_source/vendor/bs5/js/modal.es6.js | 790 ++++ .../vendor/bs5/js/modal.es6.min.js | 1 + .../media_source/vendor/bs5/js/popover.es6.js | 3401 +++++++++++++++++ .../vendor/bs5/js/popover.es6.min.js | 1 + .../vendor/bs5/js/popper/index.js | 1 + .../vendor/bs5/js/scrollspy.es6.js | 457 +++ .../vendor/bs5/js/scrollspy.es6.min.js | 1 + build/media_source/vendor/bs5/js/tab.es6.js | 365 ++ .../media_source/vendor/bs5/js/tab.es6.min.js | 1 + build/media_source/vendor/bs5/js/toast.es6.js | 372 ++ .../vendor/bs5/js/toast.es6.min.js | 1 + .../media_source/vendor/bs5/js/tooltip.es6.js | 1100 ++++++ .../vendor/bs5/js/tooltip.es6.min.js | 1 + .../html/bootstrap}/modal/body.php | 0 .../html/bootstrap}/modal/footer.php | 0 .../html/bootstrap}/modal/header.php | 0 .../html/bootstrap}/modal/iframe.php | 0 .../html/bootstrap}/modal/main.php | 8 +- .../bootstrap/tab}/addtab.php | 0 .../bootstrap/tab}/endtab.php | 0 .../bootstrap/tab}/endtabset.php | 0 .../bootstrap/tab}/starttabset.php | 0 libraries/src/HTML/Helpers/Bootstrap.php | 338 +- templates/cassiopeia/index.php | 2 + templates/cassiopeia/joomla.asset.json | 3 +- 66 files changed, 15014 insertions(+), 105 deletions(-) create mode 100644 build/media_source/vendor/bs5/js/alert.es6.js create mode 100644 build/media_source/vendor/bs5/js/alert.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/button.es6.js create mode 100644 build/media_source/vendor/bs5/js/button.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/carousel.es6.js create mode 100644 build/media_source/vendor/bs5/js/carousel.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/collapse.es6.js create mode 100644 build/media_source/vendor/bs5/js/collapse.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/dom/data.js create mode 100644 build/media_source/vendor/bs5/js/dom/event-handler.js create mode 100644 build/media_source/vendor/bs5/js/dom/manipulator.js create mode 100644 build/media_source/vendor/bs5/js/dom/selector-engine.js create mode 100644 build/media_source/vendor/bs5/js/dropdown.es6.js create mode 100644 build/media_source/vendor/bs5/js/dropdown.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/alert.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/alert.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/button.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/button.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/carousel.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/carousel.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/collapse.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/collapse.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/dom/data.js create mode 100644 build/media_source/vendor/bs5/js/js/dom/event-handler.js create mode 100644 build/media_source/vendor/bs5/js/js/dom/manipulator.js create mode 100644 build/media_source/vendor/bs5/js/js/dom/selector-engine.js create mode 100644 build/media_source/vendor/bs5/js/js/dropdown.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/dropdown.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/modal.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/modal.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/popover.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/popover.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/popper/index.js create mode 100644 build/media_source/vendor/bs5/js/js/scrollspy.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/scrollspy.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/tab.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/tab.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/toast.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/toast.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/js/tooltip.es6.js create mode 100644 build/media_source/vendor/bs5/js/js/tooltip.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/modal.es6.js create mode 100644 build/media_source/vendor/bs5/js/modal.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/popover.es6.js create mode 100644 build/media_source/vendor/bs5/js/popover.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/popper/index.js create mode 100644 build/media_source/vendor/bs5/js/scrollspy.es6.js create mode 100644 build/media_source/vendor/bs5/js/scrollspy.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/tab.es6.js create mode 100644 build/media_source/vendor/bs5/js/tab.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/toast.es6.js create mode 100644 build/media_source/vendor/bs5/js/toast.es6.min.js create mode 100644 build/media_source/vendor/bs5/js/tooltip.es6.js create mode 100644 build/media_source/vendor/bs5/js/tooltip.es6.min.js rename layouts/{joomla => libraries/html/bootstrap}/modal/body.php (100%) rename layouts/{joomla => libraries/html/bootstrap}/modal/footer.php (100%) rename layouts/{joomla => libraries/html/bootstrap}/modal/header.php (100%) rename layouts/{joomla => libraries/html/bootstrap}/modal/iframe.php (100%) rename layouts/{joomla => libraries/html/bootstrap}/modal/main.php (89%) rename layouts/libraries/{cms/html/bootstrap => html/bootstrap/tab}/addtab.php (100%) rename layouts/libraries/{cms/html/bootstrap => html/bootstrap/tab}/endtab.php (100%) rename layouts/libraries/{cms/html/bootstrap => html/bootstrap/tab}/endtabset.php (100%) rename layouts/libraries/{cms/html/bootstrap => html/bootstrap/tab}/starttabset.php (100%) diff --git a/build/media_source/vendor/bs5/js/alert.es6.js b/build/media_source/vendor/bs5/js/alert.es6.js new file mode 100644 index 0000000000000..f06cf0b5e6298 --- /dev/null +++ b/build/media_source/vendor/bs5/js/alert.es6.js @@ -0,0 +1,282 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ +const MILLISECONDS_MULTIPLIER = 1000; +const TRANSITION_END = 'transitionend'; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const getTransitionDurationFromElement = element => { + if (!element) { + return 0 + } + + // Get transition-duration of the element + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + + const floatTransitionDuration = Number.parseFloat(transitionDuration); + const floatTransitionDelay = Number.parseFloat(transitionDelay); + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0 + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0]; + transitionDelay = transitionDelay.split(',')[0]; + + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER +}; + +const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)); +}; + +const emulateTransitionEnd = (element, duration) => { + let called = false; + const durationPadding = 5; + const emulatedDuration = duration + durationPadding; + + function listener() { + called = true; + element.removeEventListener(TRANSITION_END, listener); + } + + element.addEventListener(TRANSITION_END, listener); + setTimeout(() => { + if (!called) { + triggerTransitionEnd(element); + } + }, emulatedDuration); +}; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): alert.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'alert'; +const DATA_KEY = 'bs.alert'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]'; + +const EVENT_CLOSE = `close${EVENT_KEY}`; +const EVENT_CLOSED = `closed${EVENT_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +const CLASSNAME_ALERT = 'alert'; +const CLASSNAME_FADE = 'fade'; +const CLASSNAME_SHOW = 'show'; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Alert extends BaseComponent { + // Getters + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + close(element) { + const rootElement = element ? this._getRootElement(element) : this._element; + const customEvent = this._triggerCloseEvent(rootElement); + + if (customEvent === null || customEvent.defaultPrevented) { + return + } + + this._removeElement(rootElement); + } + + // Private + + _getRootElement(element) { + return getElementFromSelector(element) || element.closest(`.${CLASSNAME_ALERT}`) + } + + _triggerCloseEvent(element) { + return EventHandler.trigger(element, EVENT_CLOSE) + } + + _removeElement(element) { + element.classList.remove(CLASSNAME_SHOW); + + if (!element.classList.contains(CLASSNAME_FADE)) { + this._destroyElement(element); + return + } + + const transitionDuration = getTransitionDurationFromElement(element); + + EventHandler.one(element, TRANSITION_END, () => this._destroyElement(element)); + emulateTransitionEnd(element, transitionDuration); + } + + _destroyElement(element) { + if (element.parentNode) { + element.parentNode.removeChild(element); + } + + EventHandler.trigger(element, EVENT_CLOSED); + } + + // Static + + static jQueryInterface(config) { + return this.each(function () { + let data = Data.getData(this, DATA_KEY); + + if (!data) { + data = new Alert(this); + } + + if (config === 'close') { + data[config](this); + } + }) + } + + static handleDismiss(alertInstance) { + return function (event) { + if (event) { + event.preventDefault(); + } + + alertInstance.close(this); + } + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Alert to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Alert.jQueryInterface; + $.fn[NAME].Constructor = Alert; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Alert.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap = {}; +window.Joomla.Bootstrap.Alert = Alert; + +export default Alert; diff --git a/build/media_source/vendor/bs5/js/alert.es6.min.js b/build/media_source/vendor/bs5/js/alert.es6.min.js new file mode 100644 index 0000000000000..efd9ac6f30d08 --- /dev/null +++ b/build/media_source/vendor/bs5/js/alert.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";document.documentElement.dir;class n extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{static get DATA_KEY(){return"bs.alert"}close(t){const e=t?this._getRootElement(t):this._element,n=this._triggerCloseEvent(e);null===n||n.defaultPrevented||this._removeElement(e)}_getRootElement(t){return(t=>{const e=(t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const n=t.getAttribute("href");e=n&&"#"!==n?n.trim():null}return e})(t);return e?document.querySelector(e):null})(t)||t.closest(".alert")}_triggerCloseEvent(t){return e.trigger(t,"close.bs.alert")}_removeElement(t){if(t.classList.remove("show"),!t.classList.contains("fade"))return void this._destroyElement(t);const n=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:n}=window.getComputedStyle(t);const r=Number.parseFloat(e),s=Number.parseFloat(n);return r||s?(e=e.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(n))):0})(t);e.one(t,"transitionend",()=>this._destroyElement(t)),((t,e)=>{let n=!1;const r=e+5;t.addEventListener("transitionend",(function e(){n=!0,t.removeEventListener("transitionend",e)})),setTimeout(()=>{n||(t=>{t.dispatchEvent(new Event("transitionend"))})(t)},r)})(t,n)}_destroyElement(t){t.parentNode&&t.parentNode.removeChild(t),e.trigger(t,"closed.bs.alert")}static jQueryInterface(e){return this.each((function(){let r=t.getData(this,"bs.alert");r||(r=new n(this)),"close"===e&&r[e](this)}))}static handleDismiss(t){return function(e){e&&e.preventDefault(),t.close(this)}}}var r;e.on(document,"click.bs.alert.data-api",'[data-bs-dismiss="alert"]',n.handleDismiss(new n)),r=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn.alert;t.fn.alert=n.jQueryInterface,t.fn.alert.Constructor=n,t.fn.alert.noConflict=()=>(t.fn.alert=e,n.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r):r(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap={},window.Joomla.Bootstrap.Alert=n;export default n; diff --git a/build/media_source/vendor/bs5/js/button.es6.js b/build/media_source/vendor/bs5/js/button.es6.js new file mode 100644 index 0000000000000..f738ada316680 --- /dev/null +++ b/build/media_source/vendor/bs5/js/button.es6.js @@ -0,0 +1,178 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): button.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'button'; +const DATA_KEY = 'bs.button'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const CLASS_NAME_ACTIVE = 'active'; + +const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]'; + +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Button extends BaseComponent { + // Getters + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + toggle() { + // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method + this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE)); + } + + // Static + + static jQueryInterface(config) { + return this.each(function () { + let data = Data.getData(this, DATA_KEY); + + if (!data) { + data = new Button(this); + } + + if (config === 'toggle') { + data[config](); + } + }) + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => { + event.preventDefault(); + + const button = event.target.closest(SELECTOR_DATA_TOGGLE); + + let data = Data.getData(button, DATA_KEY); + if (!data) { + data = new Button(button); + } + + data.toggle(); +}); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Button to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Button.jQueryInterface; + $.fn[NAME].Constructor = Button; + + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Button.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap = {}; +window.Joomla.Bootstrap.Button = Button; + +export default Button; diff --git a/build/media_source/vendor/bs5/js/button.es6.min.js b/build/media_source/vendor/bs5/js/button.es6.min.js new file mode 100644 index 0000000000000..f9ea1fdaa742e --- /dev/null +++ b/build/media_source/vendor/bs5/js/button.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";document.documentElement.dir;const o="button";class n extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{static get DATA_KEY(){return"bs.button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(e){return this.each((function(){let o=t.getData(this,"bs.button");o||(o=new n(this)),"toggle"===e&&o[e]()}))}}var s;e.on(document,"click.bs.button.data-api",'[data-bs-toggle="button"]',e=>{e.preventDefault();const o=e.target.closest('[data-bs-toggle="button"]');let s=t.getData(o,"bs.button");s||(s=new n(o)),s.toggle()}),s=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[o];t.fn[o]=n.jQueryInterface,t.fn[o].Constructor=n,t.fn[o].noConflict=()=>(t.fn[o]=e,n.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",s):s(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap={},window.Joomla.Bootstrap.Button=n;export default n; diff --git a/build/media_source/vendor/bs5/js/carousel.es6.js b/build/media_source/vendor/bs5/js/carousel.es6.js new file mode 100644 index 0000000000000..2425c646a4cad --- /dev/null +++ b/build/media_source/vendor/bs5/js/carousel.es6.js @@ -0,0 +1,801 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; +import Manipulator from './dom/manipulator.js'; +import SelectorEngine from './dom/selector-engine.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ +const MILLISECONDS_MULTIPLIER = 1000; +const TRANSITION_END = 'transitionend'; + +// Shoutout AngusCroll (https://goo.gl/pxwQGp) +const toType = obj => { + if (obj === null || obj === undefined) { + return `${obj}` + } + + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() +}; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const getTransitionDurationFromElement = element => { + if (!element) { + return 0 + } + + // Get transition-duration of the element + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + + const floatTransitionDuration = Number.parseFloat(transitionDuration); + const floatTransitionDelay = Number.parseFloat(transitionDelay); + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0 + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0]; + transitionDelay = transitionDelay.split(',')[0]; + + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER +}; + +const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)); +}; + +const isElement = obj => (obj[0] || obj).nodeType; + +const emulateTransitionEnd = (element, duration) => { + let called = false; + const durationPadding = 5; + const emulatedDuration = duration + durationPadding; + + function listener() { + called = true; + element.removeEventListener(TRANSITION_END, listener); + } + + element.addEventListener(TRANSITION_END, listener); + setTimeout(() => { + if (!called) { + triggerTransitionEnd(element); + } + }, emulatedDuration); +}; + +const typeCheckConfig = (componentName, config, configTypes) => { + Object.keys(configTypes).forEach(property => { + const expectedTypes = configTypes[property]; + const value = config[property]; + const valueType = value && isElement(value) ? + 'element' : + toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error( + `${componentName.toUpperCase()}: ` + + `Option "${property}" provided type "${valueType}" ` + + `but expected type "${expectedTypes}".`) + } + }); +}; + +const isVisible = element => { + if (!element) { + return false + } + + if (element.style && element.parentNode && element.parentNode.style) { + const elementStyle = getComputedStyle(element); + const parentNodeStyle = getComputedStyle(element.parentNode); + + return elementStyle.display !== 'none' && + parentNodeStyle.display !== 'none' && + elementStyle.visibility !== 'hidden' + } + + return false +}; + +const reflow = element => element.offsetHeight; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): carousel.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'carousel'; +const DATA_KEY = 'bs.carousel'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const ARROW_LEFT_KEY = 'ArrowLeft'; +const ARROW_RIGHT_KEY = 'ArrowRight'; +const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch +const SWIPE_THRESHOLD = 40; + +const Default = { + interval: 5000, + keyboard: true, + slide: false, + pause: 'hover', + wrap: true, + touch: true +}; + +const DefaultType = { + interval: '(number|boolean)', + keyboard: 'boolean', + slide: '(boolean|string)', + pause: '(string|boolean)', + wrap: 'boolean', + touch: 'boolean' +}; + +const DIRECTION_NEXT = 'next'; +const DIRECTION_PREV = 'prev'; +const DIRECTION_LEFT = 'left'; +const DIRECTION_RIGHT = 'right'; + +const EVENT_SLIDE = `slide${EVENT_KEY}`; +const EVENT_SLID = `slid${EVENT_KEY}`; +const EVENT_KEYDOWN = `keydown${EVENT_KEY}`; +const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`; +const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`; +const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`; +const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`; +const EVENT_TOUCHEND = `touchend${EVENT_KEY}`; +const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`; +const EVENT_POINTERUP = `pointerup${EVENT_KEY}`; +const EVENT_DRAG_START = `dragstart${EVENT_KEY}`; +const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +const CLASS_NAME_CAROUSEL = 'carousel'; +const CLASS_NAME_ACTIVE = 'active'; +const CLASS_NAME_SLIDE = 'slide'; +const CLASS_NAME_END = 'carousel-item-end'; +const CLASS_NAME_START = 'carousel-item-start'; +const CLASS_NAME_NEXT = 'carousel-item-next'; +const CLASS_NAME_PREV = 'carousel-item-prev'; +const CLASS_NAME_POINTER_EVENT = 'pointer-event'; + +const SELECTOR_ACTIVE = '.active'; +const SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; +const SELECTOR_ITEM = '.carousel-item'; +const SELECTOR_ITEM_IMG = '.carousel-item img'; +const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; +const SELECTOR_INDICATORS = '.carousel-indicators'; +const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; +const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; + +const PointerType = { + TOUCH: 'touch', + PEN: 'pen' +}; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ +class Carousel extends BaseComponent { + constructor(element, config) { + super(element); + + this._items = null; + this._interval = null; + this._activeElement = null; + this._isPaused = false; + this._isSliding = false; + this.touchTimeout = null; + this.touchStartX = 0; + this.touchDeltaX = 0; + + this._config = this._getConfig(config); + this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); + this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; + this._pointerEvent = Boolean(window.PointerEvent); + + this._addEventListeners(); + } + + // Getters + + static get Default() { + return Default + } + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + next() { + if (!this._isSliding) { + this._slide(DIRECTION_NEXT); + } + } + + nextWhenVisible() { + // Don't call next when the page isn't visible + // or the carousel or its parent isn't visible + if (!document.hidden && isVisible(this._element)) { + this.next(); + } + } + + prev() { + if (!this._isSliding) { + this._slide(DIRECTION_PREV); + } + } + + pause(event) { + if (!event) { + this._isPaused = true; + } + + if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) { + triggerTransitionEnd(this._element); + this.cycle(true); + } + + clearInterval(this._interval); + this._interval = null; + } + + cycle(event) { + if (!event) { + this._isPaused = false; + } + + if (this._interval) { + clearInterval(this._interval); + this._interval = null; + } + + if (this._config && this._config.interval && !this._isPaused) { + this._updateInterval(); + + this._interval = setInterval( + (document.visibilityState ? this.nextWhenVisible : this.next).bind(this), + this._config.interval + ); + } + } + + to(index) { + this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + const activeIndex = this._getItemIndex(this._activeElement); + + if (index > this._items.length - 1 || index < 0) { + return + } + + if (this._isSliding) { + EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); + return + } + + if (activeIndex === index) { + this.pause(); + this.cycle(); + return + } + + const direction = index > activeIndex ? + DIRECTION_NEXT : + DIRECTION_PREV; + + this._slide(direction, this._items[index]); + } + + dispose() { + super.dispose(); + EventHandler.off(this._element, EVENT_KEY); + + this._items = null; + this._config = null; + this._interval = null; + this._isPaused = null; + this._isSliding = null; + this._activeElement = null; + this._indicatorsElement = null; + } + + // Private + + _getConfig(config) { + config = { + ...Default, + ...config + }; + typeCheckConfig(NAME, config, DefaultType); + return config + } + + _handleSwipe() { + const absDeltax = Math.abs(this.touchDeltaX); + + if (absDeltax <= SWIPE_THRESHOLD) { + return + } + + const direction = absDeltax / this.touchDeltaX; + + this.touchDeltaX = 0; + + // swipe left + if (direction > 0) { + this.prev(); + } + + // swipe right + if (direction < 0) { + this.next(); + } + } + + _addEventListeners() { + if (this._config.keyboard) { + EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); + } + + if (this._config.pause === 'hover') { + EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event)); + EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event)); + } + + if (this._config.touch && this._touchSupported) { + this._addTouchEventListeners(); + } + } + + _addTouchEventListeners() { + const start = event => { + if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { + this.touchStartX = event.clientX; + } else if (!this._pointerEvent) { + this.touchStartX = event.touches[0].clientX; + } + }; + + const move = event => { + // ensure swiping with one touch and not pinching + if (event.touches && event.touches.length > 1) { + this.touchDeltaX = 0; + } else { + this.touchDeltaX = event.touches[0].clientX - this.touchStartX; + } + }; + + const end = event => { + if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { + this.touchDeltaX = event.clientX - this.touchStartX; + } + + this._handleSwipe(); + if (this._config.pause === 'hover') { + // If it's a touch-enabled device, mouseenter/leave are fired as + // part of the mouse compatibility events on first tap - the carousel + // would stop cycling until user tapped out of it; + // here, we listen for touchend, explicitly pause the carousel + // (as if it's the second time we tap on it, mouseenter compat event + // is NOT fired) and after a timeout (to allow for mouse compatibility + // events to fire) we explicitly restart cycling + + this.pause(); + if (this.touchTimeout) { + clearTimeout(this.touchTimeout); + } + + this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval); + } + }; + + SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { + EventHandler.on(itemImg, EVENT_DRAG_START, e => e.preventDefault()); + }); + + if (this._pointerEvent) { + EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event)); + EventHandler.on(this._element, EVENT_POINTERUP, event => end(event)); + + this._element.classList.add(CLASS_NAME_POINTER_EVENT); + } else { + EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event)); + EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event)); + EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event)); + } + } + + _keydown(event) { + if (/input|textarea/i.test(event.target.tagName)) { + return + } + + switch (event.key) { + case ARROW_LEFT_KEY: + event.preventDefault(); + this.prev(); + break + case ARROW_RIGHT_KEY: + event.preventDefault(); + this.next(); + break + } + } + + _getItemIndex(element) { + this._items = element && element.parentNode ? + SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : + []; + + return this._items.indexOf(element) + } + + _getItemByDirection(direction, activeElement) { + const isNextDirection = direction === DIRECTION_NEXT; + const isPrevDirection = direction === DIRECTION_PREV; + const activeIndex = this._getItemIndex(activeElement); + const lastItemIndex = this._items.length - 1; + const isGoingToWrap = (isPrevDirection && activeIndex === 0) || + (isNextDirection && activeIndex === lastItemIndex); + + if (isGoingToWrap && !this._config.wrap) { + return activeElement + } + + const delta = direction === DIRECTION_PREV ? -1 : 1; + const itemIndex = (activeIndex + delta) % this._items.length; + + return itemIndex === -1 ? + this._items[this._items.length - 1] : + this._items[itemIndex] + } + + _triggerSlideEvent(relatedTarget, eventDirectionName) { + const targetIndex = this._getItemIndex(relatedTarget); + const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)); + + return EventHandler.trigger(this._element, EVENT_SLIDE, { + relatedTarget, + direction: eventDirectionName, + from: fromIndex, + to: targetIndex + }) + } + + _setActiveIndicatorElement(element) { + if (this._indicatorsElement) { + const indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement); + + for (let i = 0; i < indicators.length; i++) { + indicators[i].classList.remove(CLASS_NAME_ACTIVE); + } + + const nextIndicator = this._indicatorsElement.children[ + this._getItemIndex(element) + ]; + + if (nextIndicator) { + nextIndicator.classList.add(CLASS_NAME_ACTIVE); + } + } + } + + _updateInterval() { + const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + + if (!element) { + return + } + + const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); + + if (elementInterval) { + this._config.defaultInterval = this._config.defaultInterval || this._config.interval; + this._config.interval = elementInterval; + } else { + this._config.interval = this._config.defaultInterval || this._config.interval; + } + } + + _slide(direction, element) { + const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + const activeElementIndex = this._getItemIndex(activeElement); + const nextElement = element || (activeElement && this._getItemByDirection(direction, activeElement)); + + const nextElementIndex = this._getItemIndex(nextElement); + const isCycling = Boolean(this._interval); + + let directionalClassName; + let orderClassName; + let eventDirectionName; + + if (direction === DIRECTION_NEXT) { + directionalClassName = CLASS_NAME_START; + orderClassName = CLASS_NAME_NEXT; + eventDirectionName = DIRECTION_LEFT; + } else { + directionalClassName = CLASS_NAME_END; + orderClassName = CLASS_NAME_PREV; + eventDirectionName = DIRECTION_RIGHT; + } + + if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) { + this._isSliding = false; + return + } + + const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); + if (slideEvent.defaultPrevented) { + return + } + + if (!activeElement || !nextElement) { + // Some weirdness is happening, so we bail + return + } + + this._isSliding = true; + + if (isCycling) { + this.pause(); + } + + this._setActiveIndicatorElement(nextElement); + this._activeElement = nextElement; + + if (this._element.classList.contains(CLASS_NAME_SLIDE)) { + nextElement.classList.add(orderClassName); + + reflow(nextElement); + + activeElement.classList.add(directionalClassName); + nextElement.classList.add(directionalClassName); + + const transitionDuration = getTransitionDurationFromElement(activeElement); + + EventHandler.one(activeElement, TRANSITION_END, () => { + nextElement.classList.remove(directionalClassName, orderClassName); + nextElement.classList.add(CLASS_NAME_ACTIVE); + + activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName); + + this._isSliding = false; + + setTimeout(() => { + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: nextElement, + direction: eventDirectionName, + from: activeElementIndex, + to: nextElementIndex + }); + }, 0); + }); + + emulateTransitionEnd(activeElement, transitionDuration); + } else { + activeElement.classList.remove(CLASS_NAME_ACTIVE); + nextElement.classList.add(CLASS_NAME_ACTIVE); + + this._isSliding = false; + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: nextElement, + direction: eventDirectionName, + from: activeElementIndex, + to: nextElementIndex + }); + } + + if (isCycling) { + this.cycle(); + } + } + + // Static + + static carouselInterface(element, config) { + let data = Data.getData(element, DATA_KEY); + let _config = { + ...Default, + ...Manipulator.getDataAttributes(element) + }; + + if (typeof config === 'object') { + _config = { + ..._config, + ...config + }; + } + + const action = typeof config === 'string' ? config : _config.slide; + + if (!data) { + data = new Carousel(element, _config); + } + + if (typeof config === 'number') { + data.to(config); + } else if (typeof action === 'string') { + if (typeof data[action] === 'undefined') { + throw new TypeError(`No method named "${action}"`) + } + + data[action](); + } else if (_config.interval && _config.ride) { + data.pause(); + data.cycle(); + } + } + + static jQueryInterface(config) { + return this.each(function () { + Carousel.carouselInterface(this, config); + }) + } + + static dataApiClickHandler(event) { + const target = getElementFromSelector(this); + + if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { + return + } + + const config = { + ...Manipulator.getDataAttributes(target), + ...Manipulator.getDataAttributes(this) + }; + const slideIndex = this.getAttribute('data-bs-slide-to'); + + if (slideIndex) { + config.interval = false; + } + + Carousel.carouselInterface(target, config); + + if (slideIndex) { + Data.getData(target, DATA_KEY).to(slideIndex); + } + + event.preventDefault(); + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler); + +EventHandler.on(window, EVENT_LOAD_DATA_API, () => { + const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); + + for (let i = 0, len = carousels.length; i < len; i++) { + Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY)); + } +}); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Carousel to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Carousel.jQueryInterface; + $.fn[NAME].Constructor = Carousel; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Carousel.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap = {}; +window.Joomla.Bootstrap.Carousel = Carousel; + +export default Carousel; diff --git a/build/media_source/vendor/bs5/js/carousel.es6.min.js b/build/media_source/vendor/bs5/js/carousel.es6.min.js new file mode 100644 index 0000000000000..480882ee381f6 --- /dev/null +++ b/build/media_source/vendor/bs5/js/carousel.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";import i from"./dom/manipulator.js";import s from"./dom/selector-engine.js";const n=t=>{t.dispatchEvent(new Event("transitionend"))};document.documentElement.dir;const o="carousel",a="bs.carousel",r={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},l={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},c={TOUCH:"touch",PEN:"pen"};class h extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{constructor(t,e){super(t),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._indicatorsElement=s.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return r}static get DATA_KEY(){return a}next(){this._isSliding||this._slide("next")}nextWhenVisible(){!document.hidden&&(t=>{if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){const e=getComputedStyle(t),i=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==i.display&&"hidden"!==e.visibility}return!1})(this._element)&&this.next()}prev(){this._isSliding||this._slide("prev")}pause(t){t||(this._isPaused=!0),s.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(n(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(t){this._activeElement=s.findOne(".active.carousel-item",this._element);const i=this._getItemIndex(this._activeElement);if(t>this._items.length-1||t<0)return;if(this._isSliding)return void e.one(this._element,"slid.bs.carousel",()=>this.to(t));if(i===t)return this.pause(),void this.cycle();const n=t>i?"next":"prev";this._slide(n,this._items[t])}dispose(){super.dispose(),e.off(this._element,".bs.carousel"),this._items=null,this._config=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null}_getConfig(t){return t={...r,...t},((t,e,i)=>{Object.keys(i).forEach(s=>{const n=i[s],o=e[s],a=o&&((r=o)[0]||r).nodeType?"element":(t=>null==t?""+t:{}.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase())(o);var r;if(!new RegExp(n).test(a))throw new Error(t.toUpperCase()+": "+`Option "${s}" provided type "${a}" `+`but expected type "${n}".`)})})(o,t,l),t}_handleSwipe(){const t=Math.abs(this.touchDeltaX);if(t<=40)return;const e=t/this.touchDeltaX;this.touchDeltaX=0,e>0&&this.prev(),e<0&&this.next()}_addEventListeners(){this._config.keyboard&&e.on(this._element,"keydown.bs.carousel",t=>this._keydown(t)),"hover"===this._config.pause&&(e.on(this._element,"mouseenter.bs.carousel",t=>this.pause(t)),e.on(this._element,"mouseleave.bs.carousel",t=>this.cycle(t))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const t=t=>{this._pointerEvent&&c[t.pointerType.toUpperCase()]?this.touchStartX=t.clientX:this._pointerEvent||(this.touchStartX=t.touches[0].clientX)},i=t=>{t.touches&&t.touches.length>1?this.touchDeltaX=0:this.touchDeltaX=t.touches[0].clientX-this.touchStartX},n=t=>{this._pointerEvent&&c[t.pointerType.toUpperCase()]&&(this.touchDeltaX=t.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout(t=>this.cycle(t),500+this._config.interval))};s.find(".carousel-item img",this._element).forEach(t=>{e.on(t,"dragstart.bs.carousel",t=>t.preventDefault())}),this._pointerEvent?(e.on(this._element,"pointerdown.bs.carousel",e=>t(e)),e.on(this._element,"pointerup.bs.carousel",t=>n(t)),this._element.classList.add("pointer-event")):(e.on(this._element,"touchstart.bs.carousel",e=>t(e)),e.on(this._element,"touchmove.bs.carousel",t=>i(t)),e.on(this._element,"touchend.bs.carousel",t=>n(t)))}_keydown(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.key){case"ArrowLeft":t.preventDefault(),this.prev();break;case"ArrowRight":t.preventDefault(),this.next()}}_getItemIndex(t){return this._items=t&&t.parentNode?s.find(".carousel-item",t.parentNode):[],this._items.indexOf(t)}_getItemByDirection(t,e){const i="next"===t,s="prev"===t,n=this._getItemIndex(e),o=this._items.length-1;if((s&&0===n||i&&n===o)&&!this._config.wrap)return e;const a=(n+("prev"===t?-1:1))%this._items.length;return-1===a?this._items[this._items.length-1]:this._items[a]}_triggerSlideEvent(t,i){const n=this._getItemIndex(t),o=this._getItemIndex(s.findOne(".active.carousel-item",this._element));return e.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:i,from:o,to:n})}_setActiveIndicatorElement(t){if(this._indicatorsElement){const e=s.find(".active",this._indicatorsElement);for(let t=0;t{t.offsetHeight})(r),o.classList.add(h),r.classList.add(h);const t=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const s=Number.parseFloat(e),n=Number.parseFloat(i);return s||n?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(o);e.one(o,"transitionend",()=>{r.classList.remove(h,u),r.classList.add("active"),o.classList.remove("active",u,h),this._isSliding=!1,setTimeout(()=>{e.trigger(this._element,"slid.bs.carousel",{relatedTarget:r,direction:d,from:a,to:l})},0)}),((t,e)=>{let i=!1;const s=e+5;t.addEventListener("transitionend",(function e(){i=!0,t.removeEventListener("transitionend",e)})),setTimeout(()=>{i||n(t)},s)})(o,t)}else o.classList.remove("active"),r.classList.add("active"),this._isSliding=!1,e.trigger(this._element,"slid.bs.carousel",{relatedTarget:r,direction:d,from:a,to:l});c&&this.cycle()}}static carouselInterface(e,s){let n=t.getData(e,a),o={...r,...i.getDataAttributes(e)};"object"==typeof s&&(o={...o,...s});const l="string"==typeof s?s:o.slide;if(n||(n=new h(e,o)),"number"==typeof s)n.to(s);else if("string"==typeof l){if(void 0===n[l])throw new TypeError(`No method named "${l}"`);n[l]()}else o.interval&&o.ride&&(n.pause(),n.cycle())}static jQueryInterface(t){return this.each((function(){h.carouselInterface(this,t)}))}static dataApiClickHandler(e){const s=(t=>{const e=(t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const i=t.getAttribute("href");e=i&&"#"!==i?i.trim():null}return e})(this);return e?document.querySelector(e):null})();if(!s||!s.classList.contains("carousel"))return;const n={...i.getDataAttributes(s),...i.getDataAttributes(this)},o=this.getAttribute("data-bs-slide-to");o&&(n.interval=!1),h.carouselInterface(s,n),o&&t.getData(s,a).to(o),e.preventDefault()}}var u;e.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",h.dataApiClickHandler),e.on(window,"load.bs.carousel.data-api",()=>{const e=s.find('[data-bs-ride="carousel"]');for(let i=0,s=e.length;i{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[o];t.fn[o]=h.jQueryInterface,t.fn[o].Constructor=h,t.fn[o].noConflict=()=>(t.fn[o]=e,h.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",u):u(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap={},window.Joomla.Bootstrap.Carousel=h;export default h; diff --git a/build/media_source/vendor/bs5/js/collapse.es6.js b/build/media_source/vendor/bs5/js/collapse.es6.js new file mode 100644 index 0000000000000..610bbc8c3b219 --- /dev/null +++ b/build/media_source/vendor/bs5/js/collapse.es6.js @@ -0,0 +1,588 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; +import Manipulator from './dom/manipulator.js'; +import SelectorEngine from './dom/selector-engine.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ +const MILLISECONDS_MULTIPLIER = 1000; +const TRANSITION_END = 'transitionend'; + +// Shoutout AngusCroll (https://goo.gl/pxwQGp) +const toType = obj => { + if (obj === null || obj === undefined) { + return `${obj}` + } + + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() +}; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getSelectorFromElement = element => { + const selector = getSelector(element); + + if (selector) { + return document.querySelector(selector) ? selector : null + } + + return null +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const getTransitionDurationFromElement = element => { + if (!element) { + return 0 + } + + // Get transition-duration of the element + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + + const floatTransitionDuration = Number.parseFloat(transitionDuration); + const floatTransitionDelay = Number.parseFloat(transitionDelay); + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0 + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0]; + transitionDelay = transitionDelay.split(',')[0]; + + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER +}; + +const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)); +}; + +const isElement = obj => (obj[0] || obj).nodeType; + +const emulateTransitionEnd = (element, duration) => { + let called = false; + const durationPadding = 5; + const emulatedDuration = duration + durationPadding; + + function listener() { + called = true; + element.removeEventListener(TRANSITION_END, listener); + } + + element.addEventListener(TRANSITION_END, listener); + setTimeout(() => { + if (!called) { + triggerTransitionEnd(element); + } + }, emulatedDuration); +}; + +const typeCheckConfig = (componentName, config, configTypes) => { + Object.keys(configTypes).forEach(property => { + const expectedTypes = configTypes[property]; + const value = config[property]; + const valueType = value && isElement(value) ? + 'element' : + toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error( + `${componentName.toUpperCase()}: ` + + `Option "${property}" provided type "${valueType}" ` + + `but expected type "${expectedTypes}".`) + } + }); +}; + +const reflow = element => element.offsetHeight; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): collapse.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'collapse'; +const DATA_KEY = 'bs.collapse'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const Default = { + toggle: true, + parent: '' +}; + +const DefaultType = { + toggle: 'boolean', + parent: '(string|element)' +}; + +const EVENT_SHOW = `show${EVENT_KEY}`; +const EVENT_SHOWN = `shown${EVENT_KEY}`; +const EVENT_HIDE = `hide${EVENT_KEY}`; +const EVENT_HIDDEN = `hidden${EVENT_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +const CLASS_NAME_SHOW = 'show'; +const CLASS_NAME_COLLAPSE = 'collapse'; +const CLASS_NAME_COLLAPSING = 'collapsing'; +const CLASS_NAME_COLLAPSED = 'collapsed'; + +const WIDTH = 'width'; +const HEIGHT = 'height'; + +const SELECTOR_ACTIVES = '.show, .collapsing'; +const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]'; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Collapse extends BaseComponent { + constructor(element, config) { + super(element); + + this._isTransitioning = false; + this._config = this._getConfig(config); + this._triggerArray = SelectorEngine.find( + `${SELECTOR_DATA_TOGGLE}[href="#${element.id}"],` + + `${SELECTOR_DATA_TOGGLE}[data-bs-target="#${element.id}"]` + ); + + const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE); + + for (let i = 0, len = toggleList.length; i < len; i++) { + const elem = toggleList[i]; + const selector = getSelectorFromElement(elem); + const filterElement = SelectorEngine.find(selector) + .filter(foundElem => foundElem === element); + + if (selector !== null && filterElement.length) { + this._selector = selector; + this._triggerArray.push(elem); + } + } + + this._parent = this._config.parent ? this._getParent() : null; + + if (!this._config.parent) { + this._addAriaAndCollapsedClass(this._element, this._triggerArray); + } + + if (this._config.toggle) { + this.toggle(); + } + } + + // Getters + + static get Default() { + return Default + } + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + toggle() { + if (this._element.classList.contains(CLASS_NAME_SHOW)) { + this.hide(); + } else { + this.show(); + } + } + + show() { + if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) { + return + } + + let actives; + let activesData; + + if (this._parent) { + actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent) + .filter(elem => { + if (typeof this._config.parent === 'string') { + return elem.getAttribute('data-bs-parent') === this._config.parent + } + + return elem.classList.contains(CLASS_NAME_COLLAPSE) + }); + + if (actives.length === 0) { + actives = null; + } + } + + const container = SelectorEngine.findOne(this._selector); + if (actives) { + const tempActiveData = actives.find(elem => container !== elem); + activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY) : null; + + if (activesData && activesData._isTransitioning) { + return + } + } + + const startEvent = EventHandler.trigger(this._element, EVENT_SHOW); + if (startEvent.defaultPrevented) { + return + } + + if (actives) { + actives.forEach(elemActive => { + if (container !== elemActive) { + Collapse.collapseInterface(elemActive, 'hide'); + } + + if (!activesData) { + Data.setData(elemActive, DATA_KEY, null); + } + }); + } + + const dimension = this._getDimension(); + + this._element.classList.remove(CLASS_NAME_COLLAPSE); + this._element.classList.add(CLASS_NAME_COLLAPSING); + + this._element.style[dimension] = 0; + + if (this._triggerArray.length) { + this._triggerArray.forEach(element => { + element.classList.remove(CLASS_NAME_COLLAPSED); + element.setAttribute('aria-expanded', true); + }); + } + + this.setTransitioning(true); + + const complete = () => { + this._element.classList.remove(CLASS_NAME_COLLAPSING); + this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW); + + this._element.style[dimension] = ''; + + this.setTransitioning(false); + + EventHandler.trigger(this._element, EVENT_SHOWN); + }; + + const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); + const scrollSize = `scroll${capitalizedDimension}`; + const transitionDuration = getTransitionDurationFromElement(this._element); + + EventHandler.one(this._element, TRANSITION_END, complete); + + emulateTransitionEnd(this._element, transitionDuration); + this._element.style[dimension] = `${this._element[scrollSize]}px`; + } + + hide() { + if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) { + return + } + + const startEvent = EventHandler.trigger(this._element, EVENT_HIDE); + if (startEvent.defaultPrevented) { + return + } + + const dimension = this._getDimension(); + + this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; + + reflow(this._element); + + this._element.classList.add(CLASS_NAME_COLLAPSING); + this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW); + + const triggerArrayLength = this._triggerArray.length; + if (triggerArrayLength > 0) { + for (let i = 0; i < triggerArrayLength; i++) { + const trigger = this._triggerArray[i]; + const elem = getElementFromSelector(trigger); + + if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) { + trigger.classList.add(CLASS_NAME_COLLAPSED); + trigger.setAttribute('aria-expanded', false); + } + } + } + + this.setTransitioning(true); + + const complete = () => { + this.setTransitioning(false); + this._element.classList.remove(CLASS_NAME_COLLAPSING); + this._element.classList.add(CLASS_NAME_COLLAPSE); + EventHandler.trigger(this._element, EVENT_HIDDEN); + }; + + this._element.style[dimension] = ''; + const transitionDuration = getTransitionDurationFromElement(this._element); + + EventHandler.one(this._element, TRANSITION_END, complete); + emulateTransitionEnd(this._element, transitionDuration); + } + + setTransitioning(isTransitioning) { + this._isTransitioning = isTransitioning; + } + + dispose() { + super.dispose(); + this._config = null; + this._parent = null; + this._triggerArray = null; + this._isTransitioning = null; + } + + // Private + + _getConfig(config) { + config = { + ...Default, + ...config + }; + config.toggle = Boolean(config.toggle); // Coerce string values + typeCheckConfig(NAME, config, DefaultType); + return config + } + + _getDimension() { + return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT + } + + _getParent() { + let { parent } = this._config; + + if (isElement(parent)) { + // it's a jQuery object + if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') { + parent = parent[0]; + } + } else { + parent = SelectorEngine.findOne(parent); + } + + const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`; + + SelectorEngine.find(selector, parent) + .forEach(element => { + const selected = getElementFromSelector(element); + + this._addAriaAndCollapsedClass( + selected, + [element] + ); + }); + + return parent + } + + _addAriaAndCollapsedClass(element, triggerArray) { + if (!element || !triggerArray.length) { + return + } + + const isOpen = element.classList.contains(CLASS_NAME_SHOW); + + triggerArray.forEach(elem => { + if (isOpen) { + elem.classList.remove(CLASS_NAME_COLLAPSED); + } else { + elem.classList.add(CLASS_NAME_COLLAPSED); + } + + elem.setAttribute('aria-expanded', isOpen); + }); + } + + // Static + + static collapseInterface(element, config) { + let data = Data.getData(element, DATA_KEY); + const _config = { + ...Default, + ...Manipulator.getDataAttributes(element), + ...(typeof config === 'object' && config ? config : {}) + }; + + if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { + _config.toggle = false; + } + + if (!data) { + data = new Collapse(element, _config); + } + + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`) + } + + data[config](); + } + } + + static jQueryInterface(config) { + return this.each(function () { + Collapse.collapseInterface(this, config); + }) + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { + // preventDefault only for elements (which change the URL) not inside the collapsible element + if (event.target.tagName === 'A') { + event.preventDefault(); + } + + const triggerData = Manipulator.getDataAttributes(this); + const selector = getSelectorFromElement(this); + const selectorElements = SelectorEngine.find(selector); + + selectorElements.forEach(element => { + const data = Data.getData(element, DATA_KEY); + let config; + if (data) { + // update parent attribute + if (data._parent === null && typeof triggerData.parent === 'string') { + data._config.parent = triggerData.parent; + data._parent = data._getParent(); + } + + config = 'toggle'; + } else { + config = triggerData; + } + + Collapse.collapseInterface(element, config); + }); +}); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Collapse to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Collapse.jQueryInterface; + $.fn[NAME].Constructor = Collapse; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Collapse.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap = {}; +window.Joomla.Bootstrap.Collapse = Collapse; + +export default Collapse; diff --git a/build/media_source/vendor/bs5/js/collapse.es6.min.js b/build/media_source/vendor/bs5/js/collapse.es6.min.js new file mode 100644 index 0000000000000..1ff4c95b2439c --- /dev/null +++ b/build/media_source/vendor/bs5/js/collapse.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";import s from"./dom/manipulator.js";import n from"./dom/selector-engine.js";const i=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const s=t.getAttribute("href");e=s&&"#"!==s?s.trim():null}return e},o=t=>{const e=i(t);return e&&document.querySelector(e)?e:null},a=t=>{const e=i(t);return e?document.querySelector(e):null},r=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const n=Number.parseFloat(e),i=Number.parseFloat(s);return n||i?(e=e.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(s))):0},l=t=>(t[0]||t).nodeType,c=(t,e)=>{let s=!1;const n=e+5;t.addEventListener("transitionend",(function e(){s=!0,t.removeEventListener("transitionend",e)})),setTimeout(()=>{s||(t=>{t.dispatchEvent(new Event("transitionend"))})(t)},n)};document.documentElement.dir;const h="collapse",g="bs.collapse",d={toggle:!0,parent:""},p={toggle:"boolean",parent:"(string|element)"};class u extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{constructor(t,e){super(t),this._isTransitioning=!1,this._config=this._getConfig(e),this._triggerArray=n.find(`[data-bs-toggle="collapse"][href="#${t.id}"],[data-bs-toggle="collapse"][data-bs-target="#${t.id}"]`);const s=n.find('[data-bs-toggle="collapse"]');for(let e=0,i=s.length;ee===t);null!==a&&r.length&&(this._selector=a,this._triggerArray.push(i))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}static get Default(){return d}static get DATA_KEY(){return g}toggle(){this._element.classList.contains("show")?this.hide():this.show()}show(){if(this._isTransitioning||this._element.classList.contains("show"))return;let s,i;this._parent&&(s=n.find(".show, .collapsing",this._parent).filter(t=>"string"==typeof this._config.parent?t.getAttribute("data-bs-parent")===this._config.parent:t.classList.contains("collapse")),0===s.length&&(s=null));const o=n.findOne(this._selector);if(s){const e=s.find(t=>o!==t);if(i=e?t.getData(e,g):null,i&&i._isTransitioning)return}if(e.trigger(this._element,"show.bs.collapse").defaultPrevented)return;s&&s.forEach(e=>{o!==e&&u.collapseInterface(e,"hide"),i||t.setData(e,g,null)});const a=this._getDimension();this._element.classList.remove("collapse"),this._element.classList.add("collapsing"),this._element.style[a]=0,this._triggerArray.length&&this._triggerArray.forEach(t=>{t.classList.remove("collapsed"),t.setAttribute("aria-expanded",!0)}),this.setTransitioning(!0);const l="scroll"+(a[0].toUpperCase()+a.slice(1)),h=r(this._element);e.one(this._element,"transitionend",()=>{this._element.classList.remove("collapsing"),this._element.classList.add("collapse","show"),this._element.style[a]="",this.setTransitioning(!1),e.trigger(this._element,"shown.bs.collapse")}),c(this._element,h),this._element.style[a]=this._element[l]+"px"}hide(){if(this._isTransitioning||!this._element.classList.contains("show"))return;if(e.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=this._element.getBoundingClientRect()[t]+"px",this._element.offsetHeight,this._element.classList.add("collapsing"),this._element.classList.remove("collapse","show");const s=this._triggerArray.length;if(s>0)for(let t=0;t{this.setTransitioning(!1),this._element.classList.remove("collapsing"),this._element.classList.add("collapse"),e.trigger(this._element,"hidden.bs.collapse")}),c(this._element,n)}setTransitioning(t){this._isTransitioning=t}dispose(){super.dispose(),this._config=null,this._parent=null,this._triggerArray=null,this._isTransitioning=null}_getConfig(t){return(t={...d,...t}).toggle=Boolean(t.toggle),((t,e,s)=>{Object.keys(s).forEach(n=>{const i=s[n],o=e[n],a=o&&l(o)?"element":null==(r=o)?""+r:{}.toString.call(r).match(/\s([a-z]+)/i)[1].toLowerCase();var r;if(!new RegExp(i).test(a))throw new Error(t.toUpperCase()+": "+`Option "${n}" provided type "${a}" `+`but expected type "${i}".`)})})(h,t,p),t}_getDimension(){return this._element.classList.contains("width")?"width":"height"}_getParent(){let{parent:t}=this._config;l(t)?void 0===t.jquery&&void 0===t[0]||(t=t[0]):t=n.findOne(t);const e=`[data-bs-toggle="collapse"][data-bs-parent="${t}"]`;return n.find(e,t).forEach(t=>{const e=a(t);this._addAriaAndCollapsedClass(e,[t])}),t}_addAriaAndCollapsedClass(t,e){if(!t||!e.length)return;const s=t.classList.contains("show");e.forEach(t=>{s?t.classList.remove("collapsed"):t.classList.add("collapsed"),t.setAttribute("aria-expanded",s)})}static collapseInterface(e,n){let i=t.getData(e,g);const o={...d,...s.getDataAttributes(e),..."object"==typeof n&&n?n:{}};if(!i&&o.toggle&&"string"==typeof n&&/show|hide/.test(n)&&(o.toggle=!1),i||(i=new u(e,o)),"string"==typeof n){if(void 0===i[n])throw new TypeError(`No method named "${n}"`);i[n]()}}static jQueryInterface(t){return this.each((function(){u.collapseInterface(this,t)}))}}var m;e.on(document,"click.bs.collapse.data-api",'[data-bs-toggle="collapse"]',(function(e){"A"===e.target.tagName&&e.preventDefault();const i=s.getDataAttributes(this),a=o(this);n.find(a).forEach(e=>{const s=t.getData(e,g);let n;s?(null===s._parent&&"string"==typeof i.parent&&(s._config.parent=i.parent,s._parent=s._getParent()),n="toggle"):n=i,u.collapseInterface(e,n)})})),m=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[h];t.fn[h]=u.jQueryInterface,t.fn[h].Constructor=u,t.fn[h].noConflict=()=>(t.fn[h]=e,u.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",m):m(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap={},window.Joomla.Bootstrap.Collapse=u;export default u; diff --git a/build/media_source/vendor/bs5/js/dom/data.js b/build/media_source/vendor/bs5/js/dom/data.js new file mode 100644 index 0000000000000..a577deb9161c5 --- /dev/null +++ b/build/media_source/vendor/bs5/js/dom/data.js @@ -0,0 +1 @@ +const e=(()=>{const e={};let t=1;return{set(s,d,y){void 0===s.bsKey&&(s.bsKey={key:d,id:t},t++),e[s.bsKey.id]=y},get(t,s){if(!t||void 0===t.bsKey)return null;const d=t.bsKey;return d.key===s?e[d.id]:null},delete(t,s){if(void 0===t.bsKey)return;const d=t.bsKey;d.key===s&&(delete e[d.id],delete t.bsKey)}}})(),t={setData(t,s,d){e.set(t,s,d)},getData:(t,s)=>e.get(t,s),removeData(t,s){e.delete(t,s)}};export default t; diff --git a/build/media_source/vendor/bs5/js/dom/event-handler.js b/build/media_source/vendor/bs5/js/dom/event-handler.js new file mode 100644 index 0000000000000..82a087bb5fa09 --- /dev/null +++ b/build/media_source/vendor/bs5/js/dom/event-handler.js @@ -0,0 +1 @@ +document.documentElement.dir;const e=/[^.]*(?=\..*)\.|.*/,t=/\..*/,n=/::\d+$/,o={};let r=1;const u={mouseenter:"mouseover",mouseleave:"mouseout"},l=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function c(e,t){return t&&`${t}::${r++}`||e.uidEvent||r++}function i(e){const t=c(e);return e.uidEvent=t,o[t]=o[t]||{},o[t]}function s(e,t,n=null){const o=Object.keys(e);for(let r=0,u=o.length;r{!function(e,t,n,o){const r=t[n]||{};Object.keys(r).forEach(u=>{if(u.includes(o)){const o=r[u];d(e,t,n,o.originalHandler,o.delegationSelector)}})}(e,f,n,t.slice(1))});const g=f[c]||{};Object.keys(g).forEach(o=>{const r=o.replace(n,"");if(!s||t.includes(r)){const t=g[o];d(e,f,c,t.originalHandler,t.delegationSelector)}})},trigger(e,n,o){if("string"!=typeof n||!e)return null;const r=(()=>{const{jQuery:e}=window;return e&&!document.body.hasAttribute("data-bs-no-jquery")?e:null})(),u=n.replace(t,""),c=n!==u,i=l.has(u);let s,a=!0,f=!0,d=!1,p=null;return c&&r&&(s=r.Event(n,o),r(e).trigger(s),a=!s.isPropagationStopped(),f=!s.isImmediatePropagationStopped(),d=s.isDefaultPrevented()),i?(p=document.createEvent("HTMLEvents"),p.initEvent(u,a,!0)):p=new CustomEvent(n,{bubbles:a,cancelable:!0}),void 0!==o&&Object.keys(o).forEach(e=>{Object.defineProperty(p,e,{get:()=>o[e]})}),d&&p.preventDefault(),f&&e.dispatchEvent(p),p.defaultPrevented&&void 0!==s&&s.preventDefault(),p}};export default p; diff --git a/build/media_source/vendor/bs5/js/dom/manipulator.js b/build/media_source/vendor/bs5/js/dom/manipulator.js new file mode 100644 index 0000000000000..b6db5fcf1fe2d --- /dev/null +++ b/build/media_source/vendor/bs5/js/dom/manipulator.js @@ -0,0 +1 @@ +function t(t){return"true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function e(t){return t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}const r={setDataAttribute(t,r,o){t.setAttribute("data-bs-"+e(r),o)},removeDataAttribute(t,r){t.removeAttribute("data-bs-"+e(r))},getDataAttributes(e){if(!e)return{};const r={};return Object.keys(e.dataset).filter(t=>t.startsWith("bs")).forEach(o=>{let a=o.replace(/^bs/,"");a=a.charAt(0).toLowerCase()+a.slice(1,a.length),r[a]=t(e.dataset[o])}),r},getDataAttribute:(r,o)=>t(r.getAttribute("data-bs-"+e(o))),offset(t){const e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},position:t=>({top:t.offsetTop,left:t.offsetLeft})};export default r; diff --git a/build/media_source/vendor/bs5/js/dom/selector-engine.js b/build/media_source/vendor/bs5/js/dom/selector-engine.js new file mode 100644 index 0000000000000..5ca792626a021 --- /dev/null +++ b/build/media_source/vendor/bs5/js/dom/selector-engine.js @@ -0,0 +1 @@ +const e={matches:(e,t)=>e.matches(t),find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter(e=>e.matches(t)),parents(e,t){const n=[];let r=e.parentNode;for(;r&&r.nodeType===Node.ELEMENT_NODE&&3!==r.nodeType;)this.matches(r,t)&&n.push(r),r=r.parentNode;return n},prev(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return[n];n=n.previousElementSibling}return[]},next(e,t){let n=e.nextElementSibling;for(;n;){if(this.matches(n,t))return[n];n=n.nextElementSibling}return[]}};export default e; diff --git a/build/media_source/vendor/bs5/js/dropdown.es6.js b/build/media_source/vendor/bs5/js/dropdown.es6.js new file mode 100644 index 0000000000000..584c00be20af2 --- /dev/null +++ b/build/media_source/vendor/bs5/js/dropdown.es6.js @@ -0,0 +1,633 @@ +import * as Popper from './popper/index.js'; +import { createPopper } from './popper/index.js'; +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; +import Manipulator from './dom/manipulator.js'; +import SelectorEngine from './dom/selector-engine.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +// Shoutout AngusCroll (https://goo.gl/pxwQGp) +const toType = obj => { + if (obj === null || obj === undefined) { + return `${obj}` + } + + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() +}; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const isElement = obj => (obj[0] || obj).nodeType; + +const typeCheckConfig = (componentName, config, configTypes) => { + Object.keys(configTypes).forEach(property => { + const expectedTypes = configTypes[property]; + const value = config[property]; + const valueType = value && isElement(value) ? + 'element' : + toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error( + `${componentName.toUpperCase()}: ` + + `Option "${property}" provided type "${valueType}" ` + + `but expected type "${expectedTypes}".`) + } + }); +}; + +const isVisible = element => { + if (!element) { + return false + } + + if (element.style && element.parentNode && element.parentNode.style) { + const elementStyle = getComputedStyle(element); + const parentNodeStyle = getComputedStyle(element.parentNode); + + return elementStyle.display !== 'none' && + parentNodeStyle.display !== 'none' && + elementStyle.visibility !== 'hidden' + } + + return false +}; + +const noop = () => function () {}; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): dropdown.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'dropdown'; +const DATA_KEY = 'bs.dropdown'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const ESCAPE_KEY = 'Escape'; +const SPACE_KEY = 'Space'; +const TAB_KEY = 'Tab'; +const ARROW_UP_KEY = 'ArrowUp'; +const ARROW_DOWN_KEY = 'ArrowDown'; +const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button + +const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY}`); + +const EVENT_HIDE = `hide${EVENT_KEY}`; +const EVENT_HIDDEN = `hidden${EVENT_KEY}`; +const EVENT_SHOW = `show${EVENT_KEY}`; +const EVENT_SHOWN = `shown${EVENT_KEY}`; +const EVENT_CLICK = `click${EVENT_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; +const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`; +const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`; + +const CLASS_NAME_DISABLED = 'disabled'; +const CLASS_NAME_SHOW = 'show'; +const CLASS_NAME_DROPUP = 'dropup'; +const CLASS_NAME_DROPEND = 'dropend'; +const CLASS_NAME_DROPSTART = 'dropstart'; +const CLASS_NAME_NAVBAR = 'navbar'; + +const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]'; +const SELECTOR_FORM_CHILD = '.dropdown form'; +const SELECTOR_MENU = '.dropdown-menu'; +const SELECTOR_NAVBAR_NAV = '.navbar-nav'; +const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; + +const PLACEMENT_TOP = isRTL ? 'top-end' : 'top-start'; +const PLACEMENT_TOPEND = isRTL ? 'top-start' : 'top-end'; +const PLACEMENT_BOTTOM = isRTL ? 'bottom-end' : 'bottom-start'; +const PLACEMENT_BOTTOMEND = isRTL ? 'bottom-start' : 'bottom-end'; +const PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start'; +const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start'; + +const Default = { + offset: 0, + flip: true, + boundary: 'clippingParents', + reference: 'toggle', + display: 'dynamic', + popperConfig: null +}; + +const DefaultType = { + offset: '(number|string|function)', + flip: 'boolean', + boundary: '(string|element)', + reference: '(string|element)', + display: 'string', + popperConfig: '(null|object)' +}; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Dropdown extends BaseComponent { + constructor(element, config) { + super(element); + + this._popper = null; + this._config = this._getConfig(config); + this._menu = this._getMenuElement(); + this._inNavbar = this._detectNavbar(); + + this._addEventListeners(); + } + + // Getters + + static get Default() { + return Default + } + + static get DefaultType() { + return DefaultType + } + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + toggle() { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) { + return + } + + const isActive = this._element.classList.contains(CLASS_NAME_SHOW); + + Dropdown.clearMenus(); + + if (isActive) { + return + } + + this.show(); + } + + show() { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW)) { + return + } + + const parent = Dropdown.getParentFromElement(this._element); + const relatedTarget = { + relatedTarget: this._element + }; + + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget); + + if (showEvent.defaultPrevented) { + return + } + + // Totally disable Popper for Dropdowns in Navbar + if (!this._inNavbar) { + if (typeof Popper === 'undefined') { + throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)') + } + + let referenceElement = this._element; + + if (this._config.reference === 'parent') { + referenceElement = parent; + } else if (isElement(this._config.reference)) { + referenceElement = this._config.reference; + + // Check if it's jQuery element + if (typeof this._config.reference.jquery !== 'undefined') { + referenceElement = this._config.reference[0]; + } + } + + this._popper = createPopper(referenceElement, this._menu, this._getPopperConfig()); + } + + // If this is a touch-enabled device we add extra + // empty mouseover listeners to the body's immediate children; + // only needed because of broken event delegation on iOS + // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html + if ('ontouchstart' in document.documentElement && + !parent.closest(SELECTOR_NAVBAR_NAV)) { + [].concat(...document.body.children) + .forEach(elem => EventHandler.on(elem, 'mouseover', null, noop())); + } + + this._element.focus(); + this._element.setAttribute('aria-expanded', true); + + this._menu.classList.toggle(CLASS_NAME_SHOW); + this._element.classList.toggle(CLASS_NAME_SHOW); + EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget); + } + + hide() { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW)) { + return + } + + const parent = Dropdown.getParentFromElement(this._element); + const relatedTarget = { + relatedTarget: this._element + }; + + const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget); + + if (hideEvent.defaultPrevented) { + return + } + + if (this._popper) { + this._popper.destroy(); + } + + this._menu.classList.toggle(CLASS_NAME_SHOW); + this._element.classList.toggle(CLASS_NAME_SHOW); + EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget); + } + + dispose() { + super.dispose(); + EventHandler.off(this._element, EVENT_KEY); + this._menu = null; + + if (this._popper) { + this._popper.destroy(); + this._popper = null; + } + } + + update() { + this._inNavbar = this._detectNavbar(); + if (this._popper) { + this._popper.update(); + } + } + + // Private + + _addEventListeners() { + EventHandler.on(this._element, EVENT_CLICK, event => { + event.preventDefault(); + event.stopPropagation(); + this.toggle(); + }); + } + + _getConfig(config) { + config = { + ...this.constructor.Default, + ...Manipulator.getDataAttributes(this._element), + ...config + }; + + typeCheckConfig(NAME, config, this.constructor.DefaultType); + + return config + } + + _getMenuElement() { + return SelectorEngine.next(this._element, SELECTOR_MENU)[0] + } + + _getPlacement() { + const parentDropdown = this._element.parentNode; + + if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { + return PLACEMENT_RIGHT + } + + if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { + return PLACEMENT_LEFT + } + + // We need to trim the value because custom properties can also include spaces + const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; + + if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { + return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP + } + + return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM + } + + _detectNavbar() { + return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null + } + + _getPopperConfig() { + const popperConfig = { + placement: this._getPlacement(), + modifiers: [{ + name: 'preventOverflow', + options: { + altBoundary: this._config.flip, + rootBoundary: this._config.boundary + } + }] + }; + + // Disable Popper if we have a static display + if (this._config.display === 'static') { + popperConfig.modifiers = [{ + name: 'applyStyles', + enabled: false + }]; + } + + return { + ...popperConfig, + ...this._config.popperConfig + } + } + + // Static + + static dropdownInterface(element, config) { + let data = Data.getData(element, DATA_KEY); + const _config = typeof config === 'object' ? config : null; + + if (!data) { + data = new Dropdown(element, _config); + } + + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`) + } + + data[config](); + } + } + + static jQueryInterface(config) { + return this.each(function () { + Dropdown.dropdownInterface(this, config); + }) + } + + static clearMenus(event) { + if (event && (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))) { + return + } + + const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE); + + for (let i = 0, len = toggles.length; i < len; i++) { + const parent = Dropdown.getParentFromElement(toggles[i]); + const context = Data.getData(toggles[i], DATA_KEY); + const relatedTarget = { + relatedTarget: toggles[i] + }; + + if (event && event.type === 'click') { + relatedTarget.clickEvent = event; + } + + if (!context) { + continue + } + + const dropdownMenu = context._menu; + if (!toggles[i].classList.contains(CLASS_NAME_SHOW)) { + continue + } + + if (event && ((event.type === 'click' && + /input|textarea/i.test(event.target.tagName)) || + (event.type === 'keyup' && event.key === TAB_KEY)) && + dropdownMenu.contains(event.target)) { + continue + } + + const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget); + if (hideEvent.defaultPrevented) { + continue + } + + // If this is a touch-enabled device we remove the extra + // empty mouseover listeners we added for iOS support + if ('ontouchstart' in document.documentElement) { + [].concat(...document.body.children) + .forEach(elem => EventHandler.off(elem, 'mouseover', null, noop())); + } + + toggles[i].setAttribute('aria-expanded', 'false'); + + if (context._popper) { + context._popper.destroy(); + } + + dropdownMenu.classList.remove(CLASS_NAME_SHOW); + toggles[i].classList.remove(CLASS_NAME_SHOW); + EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget); + } + } + + static getParentFromElement(element) { + return getElementFromSelector(element) || element.parentNode + } + + static dataApiKeydownHandler(event) { + // If not input/textarea: + // - And not a key in REGEXP_KEYDOWN => not a dropdown command + // If input/textarea: + // - If space key => not a dropdown command + // - If key is other than escape + // - If key is not up or down => not a dropdown command + // - If trigger inside the menu => not a dropdown command + if (/input|textarea/i.test(event.target.tagName) ? + event.key === SPACE_KEY || (event.key !== ESCAPE_KEY && + ((event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY) || + event.target.closest(SELECTOR_MENU))) : + !REGEXP_KEYDOWN.test(event.key)) { + return + } + + event.preventDefault(); + event.stopPropagation(); + + if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) { + return + } + + const parent = Dropdown.getParentFromElement(this); + const isActive = this.classList.contains(CLASS_NAME_SHOW); + + if (event.key === ESCAPE_KEY) { + const button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0]; + button.focus(); + Dropdown.clearMenus(); + return + } + + if (!isActive || event.key === SPACE_KEY) { + Dropdown.clearMenus(); + return + } + + const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible); + + if (!items.length) { + return + } + + let index = items.indexOf(event.target); + + // Up + if (event.key === ARROW_UP_KEY && index > 0) { + index--; + } + + // Down + if (event.key === ARROW_DOWN_KEY && index < items.length - 1) { + index++; + } + + // index is -1 if the first keydown is an ArrowUp + index = index === -1 ? 0 : index; + + items[index].focus(); + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler); +EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); +EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus); +EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { + event.preventDefault(); + event.stopPropagation(); + Dropdown.dropdownInterface(this, 'toggle'); +}); +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, e => e.stopPropagation()); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Dropdown to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Dropdown.jQueryInterface; + $.fn[NAME].Constructor = Dropdown; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Dropdown.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap = {}; +window.Joomla.Bootstrap.Dropdown = Dropdown; + +export default Dropdown; diff --git a/build/media_source/vendor/bs5/js/dropdown.es6.min.js b/build/media_source/vendor/bs5/js/dropdown.es6.min.js new file mode 100644 index 0000000000000..cba977d0a1c2a --- /dev/null +++ b/build/media_source/vendor/bs5/js/dropdown.es6.min.js @@ -0,0 +1 @@ +import*as t from"./popper/index.js";import{createPopper as e}from"./popper/index.js";import n from"./dom/data.js";import o from"./dom/event-handler.js";import r from"./dom/manipulator.js";import s from"./dom/selector-engine.js";const i=t=>(t[0]||t).nodeType,a=t=>{if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){const e=getComputedStyle(t),n=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==n.display&&"hidden"!==e.visibility}return!1},d="rtl"===document.documentElement.dir,p="dropdown",l=new RegExp("ArrowUp|ArrowDown|Escape"),c=d?"top-end":"top-start",u=d?"top-start":"top-end",m=d?"bottom-end":"bottom-start",h=d?"bottom-start":"bottom-end",g=d?"left-start":"right-start",f=d?"right-start":"left-start",w={offset:0,flip:!0,boundary:"clippingParents",reference:"toggle",display:"dynamic",popperConfig:null},_={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string",popperConfig:"(null|object)"};class b extends class{constructor(t){t&&(this._element=t,n.setData(t,this.constructor.DATA_KEY,this))}dispose(){n.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(t){return n.getData(t,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{constructor(t,e){super(t),this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}static get Default(){return w}static get DefaultType(){return _}static get DATA_KEY(){return"bs.dropdown"}toggle(){if(this._element.disabled||this._element.classList.contains("disabled"))return;const t=this._element.classList.contains("show");b.clearMenus(),t||this.show()}show(){if(this._element.disabled||this._element.classList.contains("disabled")||this._menu.classList.contains("show"))return;const n=b.getParentFromElement(this._element),r={relatedTarget:this._element};if(!o.trigger(this._element,"show.bs.dropdown",r).defaultPrevented){if(!this._inNavbar){if(void 0===t)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let o=this._element;"parent"===this._config.reference?o=n:i(this._config.reference)&&(o=this._config.reference,void 0!==this._config.reference.jquery&&(o=this._config.reference[0])),this._popper=e(o,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&!n.closest(".navbar-nav")&&[].concat(...document.body.children).forEach(t=>o.on(t,"mouseover",null,(function(){}))),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.toggle("show"),this._element.classList.toggle("show"),o.trigger(n,"shown.bs.dropdown",r)}}hide(){if(this._element.disabled||this._element.classList.contains("disabled")||!this._menu.classList.contains("show"))return;const t=b.getParentFromElement(this._element),e={relatedTarget:this._element};o.trigger(t,"hide.bs.dropdown",e).defaultPrevented||(this._popper&&this._popper.destroy(),this._menu.classList.toggle("show"),this._element.classList.toggle("show"),o.trigger(t,"hidden.bs.dropdown",e))}dispose(){super.dispose(),o.off(this._element,".bs.dropdown"),this._menu=null,this._popper&&(this._popper.destroy(),this._popper=null)}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_addEventListeners(){o.on(this._element,"click.bs.dropdown",t=>{t.preventDefault(),t.stopPropagation(),this.toggle()})}_getConfig(t){return t={...this.constructor.Default,...r.getDataAttributes(this._element),...t},((t,e,n)=>{Object.keys(n).forEach(o=>{const r=n[o],s=e[o],a=s&&i(s)?"element":null==(d=s)?""+d:{}.toString.call(d).match(/\s([a-z]+)/i)[1].toLowerCase();var d;if(!new RegExp(r).test(a))throw new Error(t.toUpperCase()+": "+`Option "${o}" provided type "${a}" `+`but expected type "${r}".`)})})(p,t,this.constructor.DefaultType),t}_getMenuElement(){return s.next(this._element,".dropdown-menu")[0]}_getPlacement(){const t=this._element.parentNode;if(t.classList.contains("dropend"))return g;if(t.classList.contains("dropstart"))return f;const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?u:c:e?h:m}_detectNavbar(){return null!==this._element.closest(".navbar")}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{altBoundary:this._config.flip,rootBoundary:this._config.boundary}}]};return"static"===this._config.display&&(t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,...this._config.popperConfig}}static dropdownInterface(t,e){let o=n.getData(t,"bs.dropdown");if(o||(o=new b(t,"object"==typeof e?e:null)),"string"==typeof e){if(void 0===o[e])throw new TypeError(`No method named "${e}"`);o[e]()}}static jQueryInterface(t){return this.each((function(){b.dropdownInterface(this,t)}))}static clearMenus(t){if(t&&(2===t.button||"keyup"===t.type&&"Tab"!==t.key))return;const e=s.find('[data-bs-toggle="dropdown"]');for(let r=0,s=e.length;ro.off(t,"mouseover",null,(function(){}))),e[r].setAttribute("aria-expanded","false"),i._popper&&i._popper.destroy(),d.classList.remove("show"),e[r].classList.remove("show"),o.trigger(s,"hidden.bs.dropdown",a)))}}static getParentFromElement(t){return(t=>{const e=(t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const n=t.getAttribute("href");e=n&&"#"!==n?n.trim():null}return e})(t);return e?document.querySelector(e):null})(t)||t.parentNode}static dataApiKeydownHandler(t){if(/input|textarea/i.test(t.target.tagName)?"Space"===t.key||"Escape"!==t.key&&("ArrowDown"!==t.key&&"ArrowUp"!==t.key||t.target.closest(".dropdown-menu")):!l.test(t.key))return;if(t.preventDefault(),t.stopPropagation(),this.disabled||this.classList.contains("disabled"))return;const e=b.getParentFromElement(this),n=this.classList.contains("show");if("Escape"===t.key)return(this.matches('[data-bs-toggle="dropdown"]')?this:s.prev(this,'[data-bs-toggle="dropdown"]')[0]).focus(),void b.clearMenus();if(!n||"Space"===t.key)return void b.clearMenus();const o=s.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",e).filter(a);if(!o.length)return;let r=o.indexOf(t.target);"ArrowUp"===t.key&&r>0&&r--,"ArrowDown"===t.key&&rt.stopPropagation()),y=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[p];t.fn[p]=b.jQueryInterface,t.fn[p].Constructor=b,t.fn[p].noConflict=()=>(t.fn[p]=e,b.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",y):y(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap={},window.Joomla.Bootstrap.Dropdown=b;export default b; diff --git a/build/media_source/vendor/bs5/js/js/alert.es6.js b/build/media_source/vendor/bs5/js/js/alert.es6.js new file mode 100644 index 0000000000000..a861f9966d6a4 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/alert.es6.js @@ -0,0 +1,281 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ +const MILLISECONDS_MULTIPLIER = 1000; +const TRANSITION_END = 'transitionend'; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const getTransitionDurationFromElement = element => { + if (!element) { + return 0 + } + + // Get transition-duration of the element + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + + const floatTransitionDuration = Number.parseFloat(transitionDuration); + const floatTransitionDelay = Number.parseFloat(transitionDelay); + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0 + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0]; + transitionDelay = transitionDelay.split(',')[0]; + + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER +}; + +const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)); +}; + +const emulateTransitionEnd = (element, duration) => { + let called = false; + const durationPadding = 5; + const emulatedDuration = duration + durationPadding; + + function listener() { + called = true; + element.removeEventListener(TRANSITION_END, listener); + } + + element.addEventListener(TRANSITION_END, listener); + setTimeout(() => { + if (!called) { + triggerTransitionEnd(element); + } + }, emulatedDuration); +}; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): alert.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'alert'; +const DATA_KEY = 'bs.alert'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]'; + +const EVENT_CLOSE = `close${EVENT_KEY}`; +const EVENT_CLOSED = `closed${EVENT_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +const CLASSNAME_ALERT = 'alert'; +const CLASSNAME_FADE = 'fade'; +const CLASSNAME_SHOW = 'show'; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Alert extends BaseComponent { + // Getters + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + close(element) { + const rootElement = element ? this._getRootElement(element) : this._element; + const customEvent = this._triggerCloseEvent(rootElement); + + if (customEvent === null || customEvent.defaultPrevented) { + return + } + + this._removeElement(rootElement); + } + + // Private + + _getRootElement(element) { + return getElementFromSelector(element) || element.closest(`.${CLASSNAME_ALERT}`) + } + + _triggerCloseEvent(element) { + return EventHandler.trigger(element, EVENT_CLOSE) + } + + _removeElement(element) { + element.classList.remove(CLASSNAME_SHOW); + + if (!element.classList.contains(CLASSNAME_FADE)) { + this._destroyElement(element); + return + } + + const transitionDuration = getTransitionDurationFromElement(element); + + EventHandler.one(element, TRANSITION_END, () => this._destroyElement(element)); + emulateTransitionEnd(element, transitionDuration); + } + + _destroyElement(element) { + if (element.parentNode) { + element.parentNode.removeChild(element); + } + + EventHandler.trigger(element, EVENT_CLOSED); + } + + // Static + + static jQueryInterface(config) { + return this.each(function () { + let data = Data.getData(this, DATA_KEY); + + if (!data) { + data = new Alert(this); + } + + if (config === 'close') { + data[config](this); + } + }) + } + + static handleDismiss(alertInstance) { + return function (event) { + if (event) { + event.preventDefault(); + } + + alertInstance.close(this); + } + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Alert to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Alert.jQueryInterface; + $.fn[NAME].Constructor = Alert; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Alert.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap.Alert = Alert; + +export default Alert; diff --git a/build/media_source/vendor/bs5/js/js/alert.es6.min.js b/build/media_source/vendor/bs5/js/js/alert.es6.min.js new file mode 100644 index 0000000000000..2b74500146c83 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/alert.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";document.documentElement.dir;class n extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{static get DATA_KEY(){return"bs.alert"}close(t){const e=t?this._getRootElement(t):this._element,n=this._triggerCloseEvent(e);null===n||n.defaultPrevented||this._removeElement(e)}_getRootElement(t){return(t=>{const e=(t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const n=t.getAttribute("href");e=n&&"#"!==n?n.trim():null}return e})(t);return e?document.querySelector(e):null})(t)||t.closest(".alert")}_triggerCloseEvent(t){return e.trigger(t,"close.bs.alert")}_removeElement(t){if(t.classList.remove("show"),!t.classList.contains("fade"))return void this._destroyElement(t);const n=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:n}=window.getComputedStyle(t);const r=Number.parseFloat(e),s=Number.parseFloat(n);return r||s?(e=e.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(n))):0})(t);e.one(t,"transitionend",()=>this._destroyElement(t)),((t,e)=>{let n=!1;const r=e+5;t.addEventListener("transitionend",(function e(){n=!0,t.removeEventListener("transitionend",e)})),setTimeout(()=>{n||(t=>{t.dispatchEvent(new Event("transitionend"))})(t)},r)})(t,n)}_destroyElement(t){t.parentNode&&t.parentNode.removeChild(t),e.trigger(t,"closed.bs.alert")}static jQueryInterface(e){return this.each((function(){let r=t.getData(this,"bs.alert");r||(r=new n(this)),"close"===e&&r[e](this)}))}static handleDismiss(t){return function(e){e&&e.preventDefault(),t.close(this)}}}var r;e.on(document,"click.bs.alert.data-api",'[data-bs-dismiss="alert"]',n.handleDismiss(new n)),r=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn.alert;t.fn.alert=n.jQueryInterface,t.fn.alert.Constructor=n,t.fn.alert.noConflict=()=>(t.fn.alert=e,n.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r):r(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap.Alert=n;export default n; diff --git a/build/media_source/vendor/bs5/js/js/button.es6.js b/build/media_source/vendor/bs5/js/js/button.es6.js new file mode 100644 index 0000000000000..0865aa64b0d62 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/button.es6.js @@ -0,0 +1,177 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): button.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'button'; +const DATA_KEY = 'bs.button'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const CLASS_NAME_ACTIVE = 'active'; + +const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]'; + +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Button extends BaseComponent { + // Getters + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + toggle() { + // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method + this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE)); + } + + // Static + + static jQueryInterface(config) { + return this.each(function () { + let data = Data.getData(this, DATA_KEY); + + if (!data) { + data = new Button(this); + } + + if (config === 'toggle') { + data[config](); + } + }) + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => { + event.preventDefault(); + + const button = event.target.closest(SELECTOR_DATA_TOGGLE); + + let data = Data.getData(button, DATA_KEY); + if (!data) { + data = new Button(button); + } + + data.toggle(); +}); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Button to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Button.jQueryInterface; + $.fn[NAME].Constructor = Button; + + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Button.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap.Button = Button; + +export default Button; diff --git a/build/media_source/vendor/bs5/js/js/button.es6.min.js b/build/media_source/vendor/bs5/js/js/button.es6.min.js new file mode 100644 index 0000000000000..f36566f5fcbea --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/button.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";document.documentElement.dir;const n="button";class o extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{static get DATA_KEY(){return"bs.button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(e){return this.each((function(){let n=t.getData(this,"bs.button");n||(n=new o(this)),"toggle"===e&&n[e]()}))}}var s;e.on(document,"click.bs.button.data-api",'[data-bs-toggle="button"]',e=>{e.preventDefault();const n=e.target.closest('[data-bs-toggle="button"]');let s=t.getData(n,"bs.button");s||(s=new o(n)),s.toggle()}),s=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[n];t.fn[n]=o.jQueryInterface,t.fn[n].Constructor=o,t.fn[n].noConflict=()=>(t.fn[n]=e,o.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",s):s(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap.Button=o;export default o; diff --git a/build/media_source/vendor/bs5/js/js/carousel.es6.js b/build/media_source/vendor/bs5/js/js/carousel.es6.js new file mode 100644 index 0000000000000..899e30f714674 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/carousel.es6.js @@ -0,0 +1,800 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; +import Manipulator from './dom/manipulator.js'; +import SelectorEngine from './dom/selector-engine.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ +const MILLISECONDS_MULTIPLIER = 1000; +const TRANSITION_END = 'transitionend'; + +// Shoutout AngusCroll (https://goo.gl/pxwQGp) +const toType = obj => { + if (obj === null || obj === undefined) { + return `${obj}` + } + + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() +}; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const getTransitionDurationFromElement = element => { + if (!element) { + return 0 + } + + // Get transition-duration of the element + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + + const floatTransitionDuration = Number.parseFloat(transitionDuration); + const floatTransitionDelay = Number.parseFloat(transitionDelay); + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0 + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0]; + transitionDelay = transitionDelay.split(',')[0]; + + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER +}; + +const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)); +}; + +const isElement = obj => (obj[0] || obj).nodeType; + +const emulateTransitionEnd = (element, duration) => { + let called = false; + const durationPadding = 5; + const emulatedDuration = duration + durationPadding; + + function listener() { + called = true; + element.removeEventListener(TRANSITION_END, listener); + } + + element.addEventListener(TRANSITION_END, listener); + setTimeout(() => { + if (!called) { + triggerTransitionEnd(element); + } + }, emulatedDuration); +}; + +const typeCheckConfig = (componentName, config, configTypes) => { + Object.keys(configTypes).forEach(property => { + const expectedTypes = configTypes[property]; + const value = config[property]; + const valueType = value && isElement(value) ? + 'element' : + toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error( + `${componentName.toUpperCase()}: ` + + `Option "${property}" provided type "${valueType}" ` + + `but expected type "${expectedTypes}".`) + } + }); +}; + +const isVisible = element => { + if (!element) { + return false + } + + if (element.style && element.parentNode && element.parentNode.style) { + const elementStyle = getComputedStyle(element); + const parentNodeStyle = getComputedStyle(element.parentNode); + + return elementStyle.display !== 'none' && + parentNodeStyle.display !== 'none' && + elementStyle.visibility !== 'hidden' + } + + return false +}; + +const reflow = element => element.offsetHeight; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): carousel.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'carousel'; +const DATA_KEY = 'bs.carousel'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const ARROW_LEFT_KEY = 'ArrowLeft'; +const ARROW_RIGHT_KEY = 'ArrowRight'; +const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch +const SWIPE_THRESHOLD = 40; + +const Default = { + interval: 5000, + keyboard: true, + slide: false, + pause: 'hover', + wrap: true, + touch: true +}; + +const DefaultType = { + interval: '(number|boolean)', + keyboard: 'boolean', + slide: '(boolean|string)', + pause: '(string|boolean)', + wrap: 'boolean', + touch: 'boolean' +}; + +const DIRECTION_NEXT = 'next'; +const DIRECTION_PREV = 'prev'; +const DIRECTION_LEFT = 'left'; +const DIRECTION_RIGHT = 'right'; + +const EVENT_SLIDE = `slide${EVENT_KEY}`; +const EVENT_SLID = `slid${EVENT_KEY}`; +const EVENT_KEYDOWN = `keydown${EVENT_KEY}`; +const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`; +const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`; +const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`; +const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`; +const EVENT_TOUCHEND = `touchend${EVENT_KEY}`; +const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`; +const EVENT_POINTERUP = `pointerup${EVENT_KEY}`; +const EVENT_DRAG_START = `dragstart${EVENT_KEY}`; +const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +const CLASS_NAME_CAROUSEL = 'carousel'; +const CLASS_NAME_ACTIVE = 'active'; +const CLASS_NAME_SLIDE = 'slide'; +const CLASS_NAME_END = 'carousel-item-end'; +const CLASS_NAME_START = 'carousel-item-start'; +const CLASS_NAME_NEXT = 'carousel-item-next'; +const CLASS_NAME_PREV = 'carousel-item-prev'; +const CLASS_NAME_POINTER_EVENT = 'pointer-event'; + +const SELECTOR_ACTIVE = '.active'; +const SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; +const SELECTOR_ITEM = '.carousel-item'; +const SELECTOR_ITEM_IMG = '.carousel-item img'; +const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; +const SELECTOR_INDICATORS = '.carousel-indicators'; +const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; +const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; + +const PointerType = { + TOUCH: 'touch', + PEN: 'pen' +}; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ +class Carousel extends BaseComponent { + constructor(element, config) { + super(element); + + this._items = null; + this._interval = null; + this._activeElement = null; + this._isPaused = false; + this._isSliding = false; + this.touchTimeout = null; + this.touchStartX = 0; + this.touchDeltaX = 0; + + this._config = this._getConfig(config); + this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); + this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; + this._pointerEvent = Boolean(window.PointerEvent); + + this._addEventListeners(); + } + + // Getters + + static get Default() { + return Default + } + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + next() { + if (!this._isSliding) { + this._slide(DIRECTION_NEXT); + } + } + + nextWhenVisible() { + // Don't call next when the page isn't visible + // or the carousel or its parent isn't visible + if (!document.hidden && isVisible(this._element)) { + this.next(); + } + } + + prev() { + if (!this._isSliding) { + this._slide(DIRECTION_PREV); + } + } + + pause(event) { + if (!event) { + this._isPaused = true; + } + + if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) { + triggerTransitionEnd(this._element); + this.cycle(true); + } + + clearInterval(this._interval); + this._interval = null; + } + + cycle(event) { + if (!event) { + this._isPaused = false; + } + + if (this._interval) { + clearInterval(this._interval); + this._interval = null; + } + + if (this._config && this._config.interval && !this._isPaused) { + this._updateInterval(); + + this._interval = setInterval( + (document.visibilityState ? this.nextWhenVisible : this.next).bind(this), + this._config.interval + ); + } + } + + to(index) { + this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + const activeIndex = this._getItemIndex(this._activeElement); + + if (index > this._items.length - 1 || index < 0) { + return + } + + if (this._isSliding) { + EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); + return + } + + if (activeIndex === index) { + this.pause(); + this.cycle(); + return + } + + const direction = index > activeIndex ? + DIRECTION_NEXT : + DIRECTION_PREV; + + this._slide(direction, this._items[index]); + } + + dispose() { + super.dispose(); + EventHandler.off(this._element, EVENT_KEY); + + this._items = null; + this._config = null; + this._interval = null; + this._isPaused = null; + this._isSliding = null; + this._activeElement = null; + this._indicatorsElement = null; + } + + // Private + + _getConfig(config) { + config = { + ...Default, + ...config + }; + typeCheckConfig(NAME, config, DefaultType); + return config + } + + _handleSwipe() { + const absDeltax = Math.abs(this.touchDeltaX); + + if (absDeltax <= SWIPE_THRESHOLD) { + return + } + + const direction = absDeltax / this.touchDeltaX; + + this.touchDeltaX = 0; + + // swipe left + if (direction > 0) { + this.prev(); + } + + // swipe right + if (direction < 0) { + this.next(); + } + } + + _addEventListeners() { + if (this._config.keyboard) { + EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); + } + + if (this._config.pause === 'hover') { + EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event)); + EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event)); + } + + if (this._config.touch && this._touchSupported) { + this._addTouchEventListeners(); + } + } + + _addTouchEventListeners() { + const start = event => { + if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { + this.touchStartX = event.clientX; + } else if (!this._pointerEvent) { + this.touchStartX = event.touches[0].clientX; + } + }; + + const move = event => { + // ensure swiping with one touch and not pinching + if (event.touches && event.touches.length > 1) { + this.touchDeltaX = 0; + } else { + this.touchDeltaX = event.touches[0].clientX - this.touchStartX; + } + }; + + const end = event => { + if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { + this.touchDeltaX = event.clientX - this.touchStartX; + } + + this._handleSwipe(); + if (this._config.pause === 'hover') { + // If it's a touch-enabled device, mouseenter/leave are fired as + // part of the mouse compatibility events on first tap - the carousel + // would stop cycling until user tapped out of it; + // here, we listen for touchend, explicitly pause the carousel + // (as if it's the second time we tap on it, mouseenter compat event + // is NOT fired) and after a timeout (to allow for mouse compatibility + // events to fire) we explicitly restart cycling + + this.pause(); + if (this.touchTimeout) { + clearTimeout(this.touchTimeout); + } + + this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval); + } + }; + + SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { + EventHandler.on(itemImg, EVENT_DRAG_START, e => e.preventDefault()); + }); + + if (this._pointerEvent) { + EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event)); + EventHandler.on(this._element, EVENT_POINTERUP, event => end(event)); + + this._element.classList.add(CLASS_NAME_POINTER_EVENT); + } else { + EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event)); + EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event)); + EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event)); + } + } + + _keydown(event) { + if (/input|textarea/i.test(event.target.tagName)) { + return + } + + switch (event.key) { + case ARROW_LEFT_KEY: + event.preventDefault(); + this.prev(); + break + case ARROW_RIGHT_KEY: + event.preventDefault(); + this.next(); + break + } + } + + _getItemIndex(element) { + this._items = element && element.parentNode ? + SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : + []; + + return this._items.indexOf(element) + } + + _getItemByDirection(direction, activeElement) { + const isNextDirection = direction === DIRECTION_NEXT; + const isPrevDirection = direction === DIRECTION_PREV; + const activeIndex = this._getItemIndex(activeElement); + const lastItemIndex = this._items.length - 1; + const isGoingToWrap = (isPrevDirection && activeIndex === 0) || + (isNextDirection && activeIndex === lastItemIndex); + + if (isGoingToWrap && !this._config.wrap) { + return activeElement + } + + const delta = direction === DIRECTION_PREV ? -1 : 1; + const itemIndex = (activeIndex + delta) % this._items.length; + + return itemIndex === -1 ? + this._items[this._items.length - 1] : + this._items[itemIndex] + } + + _triggerSlideEvent(relatedTarget, eventDirectionName) { + const targetIndex = this._getItemIndex(relatedTarget); + const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)); + + return EventHandler.trigger(this._element, EVENT_SLIDE, { + relatedTarget, + direction: eventDirectionName, + from: fromIndex, + to: targetIndex + }) + } + + _setActiveIndicatorElement(element) { + if (this._indicatorsElement) { + const indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement); + + for (let i = 0; i < indicators.length; i++) { + indicators[i].classList.remove(CLASS_NAME_ACTIVE); + } + + const nextIndicator = this._indicatorsElement.children[ + this._getItemIndex(element) + ]; + + if (nextIndicator) { + nextIndicator.classList.add(CLASS_NAME_ACTIVE); + } + } + } + + _updateInterval() { + const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + + if (!element) { + return + } + + const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); + + if (elementInterval) { + this._config.defaultInterval = this._config.defaultInterval || this._config.interval; + this._config.interval = elementInterval; + } else { + this._config.interval = this._config.defaultInterval || this._config.interval; + } + } + + _slide(direction, element) { + const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); + const activeElementIndex = this._getItemIndex(activeElement); + const nextElement = element || (activeElement && this._getItemByDirection(direction, activeElement)); + + const nextElementIndex = this._getItemIndex(nextElement); + const isCycling = Boolean(this._interval); + + let directionalClassName; + let orderClassName; + let eventDirectionName; + + if (direction === DIRECTION_NEXT) { + directionalClassName = CLASS_NAME_START; + orderClassName = CLASS_NAME_NEXT; + eventDirectionName = DIRECTION_LEFT; + } else { + directionalClassName = CLASS_NAME_END; + orderClassName = CLASS_NAME_PREV; + eventDirectionName = DIRECTION_RIGHT; + } + + if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) { + this._isSliding = false; + return + } + + const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); + if (slideEvent.defaultPrevented) { + return + } + + if (!activeElement || !nextElement) { + // Some weirdness is happening, so we bail + return + } + + this._isSliding = true; + + if (isCycling) { + this.pause(); + } + + this._setActiveIndicatorElement(nextElement); + this._activeElement = nextElement; + + if (this._element.classList.contains(CLASS_NAME_SLIDE)) { + nextElement.classList.add(orderClassName); + + reflow(nextElement); + + activeElement.classList.add(directionalClassName); + nextElement.classList.add(directionalClassName); + + const transitionDuration = getTransitionDurationFromElement(activeElement); + + EventHandler.one(activeElement, TRANSITION_END, () => { + nextElement.classList.remove(directionalClassName, orderClassName); + nextElement.classList.add(CLASS_NAME_ACTIVE); + + activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName); + + this._isSliding = false; + + setTimeout(() => { + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: nextElement, + direction: eventDirectionName, + from: activeElementIndex, + to: nextElementIndex + }); + }, 0); + }); + + emulateTransitionEnd(activeElement, transitionDuration); + } else { + activeElement.classList.remove(CLASS_NAME_ACTIVE); + nextElement.classList.add(CLASS_NAME_ACTIVE); + + this._isSliding = false; + EventHandler.trigger(this._element, EVENT_SLID, { + relatedTarget: nextElement, + direction: eventDirectionName, + from: activeElementIndex, + to: nextElementIndex + }); + } + + if (isCycling) { + this.cycle(); + } + } + + // Static + + static carouselInterface(element, config) { + let data = Data.getData(element, DATA_KEY); + let _config = { + ...Default, + ...Manipulator.getDataAttributes(element) + }; + + if (typeof config === 'object') { + _config = { + ..._config, + ...config + }; + } + + const action = typeof config === 'string' ? config : _config.slide; + + if (!data) { + data = new Carousel(element, _config); + } + + if (typeof config === 'number') { + data.to(config); + } else if (typeof action === 'string') { + if (typeof data[action] === 'undefined') { + throw new TypeError(`No method named "${action}"`) + } + + data[action](); + } else if (_config.interval && _config.ride) { + data.pause(); + data.cycle(); + } + } + + static jQueryInterface(config) { + return this.each(function () { + Carousel.carouselInterface(this, config); + }) + } + + static dataApiClickHandler(event) { + const target = getElementFromSelector(this); + + if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { + return + } + + const config = { + ...Manipulator.getDataAttributes(target), + ...Manipulator.getDataAttributes(this) + }; + const slideIndex = this.getAttribute('data-bs-slide-to'); + + if (slideIndex) { + config.interval = false; + } + + Carousel.carouselInterface(target, config); + + if (slideIndex) { + Data.getData(target, DATA_KEY).to(slideIndex); + } + + event.preventDefault(); + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler); + +EventHandler.on(window, EVENT_LOAD_DATA_API, () => { + const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); + + for (let i = 0, len = carousels.length; i < len; i++) { + Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY)); + } +}); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Carousel to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Carousel.jQueryInterface; + $.fn[NAME].Constructor = Carousel; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Carousel.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap.Carousel = Carousel; + +export default Carousel; diff --git a/build/media_source/vendor/bs5/js/js/carousel.es6.min.js b/build/media_source/vendor/bs5/js/js/carousel.es6.min.js new file mode 100644 index 0000000000000..259a4c0b8a929 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/carousel.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";import i from"./dom/manipulator.js";import s from"./dom/selector-engine.js";const n=t=>{t.dispatchEvent(new Event("transitionend"))};document.documentElement.dir;const o="carousel",r="bs.carousel",a={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},l={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},c={TOUCH:"touch",PEN:"pen"};class h extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{constructor(t,e){super(t),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._indicatorsElement=s.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return a}static get DATA_KEY(){return r}next(){this._isSliding||this._slide("next")}nextWhenVisible(){!document.hidden&&(t=>{if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){const e=getComputedStyle(t),i=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==i.display&&"hidden"!==e.visibility}return!1})(this._element)&&this.next()}prev(){this._isSliding||this._slide("prev")}pause(t){t||(this._isPaused=!0),s.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(n(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(t){this._activeElement=s.findOne(".active.carousel-item",this._element);const i=this._getItemIndex(this._activeElement);if(t>this._items.length-1||t<0)return;if(this._isSliding)return void e.one(this._element,"slid.bs.carousel",()=>this.to(t));if(i===t)return this.pause(),void this.cycle();const n=t>i?"next":"prev";this._slide(n,this._items[t])}dispose(){super.dispose(),e.off(this._element,".bs.carousel"),this._items=null,this._config=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null}_getConfig(t){return t={...a,...t},((t,e,i)=>{Object.keys(i).forEach(s=>{const n=i[s],o=e[s],r=o&&((a=o)[0]||a).nodeType?"element":(t=>null==t?""+t:{}.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase())(o);var a;if(!new RegExp(n).test(r))throw new Error(t.toUpperCase()+": "+`Option "${s}" provided type "${r}" `+`but expected type "${n}".`)})})(o,t,l),t}_handleSwipe(){const t=Math.abs(this.touchDeltaX);if(t<=40)return;const e=t/this.touchDeltaX;this.touchDeltaX=0,e>0&&this.prev(),e<0&&this.next()}_addEventListeners(){this._config.keyboard&&e.on(this._element,"keydown.bs.carousel",t=>this._keydown(t)),"hover"===this._config.pause&&(e.on(this._element,"mouseenter.bs.carousel",t=>this.pause(t)),e.on(this._element,"mouseleave.bs.carousel",t=>this.cycle(t))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const t=t=>{this._pointerEvent&&c[t.pointerType.toUpperCase()]?this.touchStartX=t.clientX:this._pointerEvent||(this.touchStartX=t.touches[0].clientX)},i=t=>{t.touches&&t.touches.length>1?this.touchDeltaX=0:this.touchDeltaX=t.touches[0].clientX-this.touchStartX},n=t=>{this._pointerEvent&&c[t.pointerType.toUpperCase()]&&(this.touchDeltaX=t.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout(t=>this.cycle(t),500+this._config.interval))};s.find(".carousel-item img",this._element).forEach(t=>{e.on(t,"dragstart.bs.carousel",t=>t.preventDefault())}),this._pointerEvent?(e.on(this._element,"pointerdown.bs.carousel",e=>t(e)),e.on(this._element,"pointerup.bs.carousel",t=>n(t)),this._element.classList.add("pointer-event")):(e.on(this._element,"touchstart.bs.carousel",e=>t(e)),e.on(this._element,"touchmove.bs.carousel",t=>i(t)),e.on(this._element,"touchend.bs.carousel",t=>n(t)))}_keydown(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.key){case"ArrowLeft":t.preventDefault(),this.prev();break;case"ArrowRight":t.preventDefault(),this.next()}}_getItemIndex(t){return this._items=t&&t.parentNode?s.find(".carousel-item",t.parentNode):[],this._items.indexOf(t)}_getItemByDirection(t,e){const i="next"===t,s="prev"===t,n=this._getItemIndex(e),o=this._items.length-1;if((s&&0===n||i&&n===o)&&!this._config.wrap)return e;const r=(n+("prev"===t?-1:1))%this._items.length;return-1===r?this._items[this._items.length-1]:this._items[r]}_triggerSlideEvent(t,i){const n=this._getItemIndex(t),o=this._getItemIndex(s.findOne(".active.carousel-item",this._element));return e.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:i,from:o,to:n})}_setActiveIndicatorElement(t){if(this._indicatorsElement){const e=s.find(".active",this._indicatorsElement);for(let t=0;t{t.offsetHeight})(a),o.classList.add(h),a.classList.add(h);const t=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const s=Number.parseFloat(e),n=Number.parseFloat(i);return s||n?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(o);e.one(o,"transitionend",()=>{a.classList.remove(h,u),a.classList.add("active"),o.classList.remove("active",u,h),this._isSliding=!1,setTimeout(()=>{e.trigger(this._element,"slid.bs.carousel",{relatedTarget:a,direction:d,from:r,to:l})},0)}),((t,e)=>{let i=!1;const s=e+5;t.addEventListener("transitionend",(function e(){i=!0,t.removeEventListener("transitionend",e)})),setTimeout(()=>{i||n(t)},s)})(o,t)}else o.classList.remove("active"),a.classList.add("active"),this._isSliding=!1,e.trigger(this._element,"slid.bs.carousel",{relatedTarget:a,direction:d,from:r,to:l});c&&this.cycle()}}static carouselInterface(e,s){let n=t.getData(e,r),o={...a,...i.getDataAttributes(e)};"object"==typeof s&&(o={...o,...s});const l="string"==typeof s?s:o.slide;if(n||(n=new h(e,o)),"number"==typeof s)n.to(s);else if("string"==typeof l){if(void 0===n[l])throw new TypeError(`No method named "${l}"`);n[l]()}else o.interval&&o.ride&&(n.pause(),n.cycle())}static jQueryInterface(t){return this.each((function(){h.carouselInterface(this,t)}))}static dataApiClickHandler(e){const s=(t=>{const e=(t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const i=t.getAttribute("href");e=i&&"#"!==i?i.trim():null}return e})(this);return e?document.querySelector(e):null})();if(!s||!s.classList.contains("carousel"))return;const n={...i.getDataAttributes(s),...i.getDataAttributes(this)},o=this.getAttribute("data-bs-slide-to");o&&(n.interval=!1),h.carouselInterface(s,n),o&&t.getData(s,r).to(o),e.preventDefault()}}var u;e.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",h.dataApiClickHandler),e.on(window,"load.bs.carousel.data-api",()=>{const e=s.find('[data-bs-ride="carousel"]');for(let i=0,s=e.length;i{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[o];t.fn[o]=h.jQueryInterface,t.fn[o].Constructor=h,t.fn[o].noConflict=()=>(t.fn[o]=e,h.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",u):u(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap.Carousel=h;export default h; diff --git a/build/media_source/vendor/bs5/js/js/collapse.es6.js b/build/media_source/vendor/bs5/js/js/collapse.es6.js new file mode 100644 index 0000000000000..2e7ea51e1577f --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/collapse.es6.js @@ -0,0 +1,587 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; +import Manipulator from './dom/manipulator.js'; +import SelectorEngine from './dom/selector-engine.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ +const MILLISECONDS_MULTIPLIER = 1000; +const TRANSITION_END = 'transitionend'; + +// Shoutout AngusCroll (https://goo.gl/pxwQGp) +const toType = obj => { + if (obj === null || obj === undefined) { + return `${obj}` + } + + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() +}; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getSelectorFromElement = element => { + const selector = getSelector(element); + + if (selector) { + return document.querySelector(selector) ? selector : null + } + + return null +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const getTransitionDurationFromElement = element => { + if (!element) { + return 0 + } + + // Get transition-duration of the element + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + + const floatTransitionDuration = Number.parseFloat(transitionDuration); + const floatTransitionDelay = Number.parseFloat(transitionDelay); + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0 + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0]; + transitionDelay = transitionDelay.split(',')[0]; + + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER +}; + +const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)); +}; + +const isElement = obj => (obj[0] || obj).nodeType; + +const emulateTransitionEnd = (element, duration) => { + let called = false; + const durationPadding = 5; + const emulatedDuration = duration + durationPadding; + + function listener() { + called = true; + element.removeEventListener(TRANSITION_END, listener); + } + + element.addEventListener(TRANSITION_END, listener); + setTimeout(() => { + if (!called) { + triggerTransitionEnd(element); + } + }, emulatedDuration); +}; + +const typeCheckConfig = (componentName, config, configTypes) => { + Object.keys(configTypes).forEach(property => { + const expectedTypes = configTypes[property]; + const value = config[property]; + const valueType = value && isElement(value) ? + 'element' : + toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error( + `${componentName.toUpperCase()}: ` + + `Option "${property}" provided type "${valueType}" ` + + `but expected type "${expectedTypes}".`) + } + }); +}; + +const reflow = element => element.offsetHeight; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): collapse.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'collapse'; +const DATA_KEY = 'bs.collapse'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const Default = { + toggle: true, + parent: '' +}; + +const DefaultType = { + toggle: 'boolean', + parent: '(string|element)' +}; + +const EVENT_SHOW = `show${EVENT_KEY}`; +const EVENT_SHOWN = `shown${EVENT_KEY}`; +const EVENT_HIDE = `hide${EVENT_KEY}`; +const EVENT_HIDDEN = `hidden${EVENT_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +const CLASS_NAME_SHOW = 'show'; +const CLASS_NAME_COLLAPSE = 'collapse'; +const CLASS_NAME_COLLAPSING = 'collapsing'; +const CLASS_NAME_COLLAPSED = 'collapsed'; + +const WIDTH = 'width'; +const HEIGHT = 'height'; + +const SELECTOR_ACTIVES = '.show, .collapsing'; +const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]'; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Collapse extends BaseComponent { + constructor(element, config) { + super(element); + + this._isTransitioning = false; + this._config = this._getConfig(config); + this._triggerArray = SelectorEngine.find( + `${SELECTOR_DATA_TOGGLE}[href="#${element.id}"],` + + `${SELECTOR_DATA_TOGGLE}[data-bs-target="#${element.id}"]` + ); + + const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE); + + for (let i = 0, len = toggleList.length; i < len; i++) { + const elem = toggleList[i]; + const selector = getSelectorFromElement(elem); + const filterElement = SelectorEngine.find(selector) + .filter(foundElem => foundElem === element); + + if (selector !== null && filterElement.length) { + this._selector = selector; + this._triggerArray.push(elem); + } + } + + this._parent = this._config.parent ? this._getParent() : null; + + if (!this._config.parent) { + this._addAriaAndCollapsedClass(this._element, this._triggerArray); + } + + if (this._config.toggle) { + this.toggle(); + } + } + + // Getters + + static get Default() { + return Default + } + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + toggle() { + if (this._element.classList.contains(CLASS_NAME_SHOW)) { + this.hide(); + } else { + this.show(); + } + } + + show() { + if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) { + return + } + + let actives; + let activesData; + + if (this._parent) { + actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent) + .filter(elem => { + if (typeof this._config.parent === 'string') { + return elem.getAttribute('data-bs-parent') === this._config.parent + } + + return elem.classList.contains(CLASS_NAME_COLLAPSE) + }); + + if (actives.length === 0) { + actives = null; + } + } + + const container = SelectorEngine.findOne(this._selector); + if (actives) { + const tempActiveData = actives.find(elem => container !== elem); + activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY) : null; + + if (activesData && activesData._isTransitioning) { + return + } + } + + const startEvent = EventHandler.trigger(this._element, EVENT_SHOW); + if (startEvent.defaultPrevented) { + return + } + + if (actives) { + actives.forEach(elemActive => { + if (container !== elemActive) { + Collapse.collapseInterface(elemActive, 'hide'); + } + + if (!activesData) { + Data.setData(elemActive, DATA_KEY, null); + } + }); + } + + const dimension = this._getDimension(); + + this._element.classList.remove(CLASS_NAME_COLLAPSE); + this._element.classList.add(CLASS_NAME_COLLAPSING); + + this._element.style[dimension] = 0; + + if (this._triggerArray.length) { + this._triggerArray.forEach(element => { + element.classList.remove(CLASS_NAME_COLLAPSED); + element.setAttribute('aria-expanded', true); + }); + } + + this.setTransitioning(true); + + const complete = () => { + this._element.classList.remove(CLASS_NAME_COLLAPSING); + this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW); + + this._element.style[dimension] = ''; + + this.setTransitioning(false); + + EventHandler.trigger(this._element, EVENT_SHOWN); + }; + + const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); + const scrollSize = `scroll${capitalizedDimension}`; + const transitionDuration = getTransitionDurationFromElement(this._element); + + EventHandler.one(this._element, TRANSITION_END, complete); + + emulateTransitionEnd(this._element, transitionDuration); + this._element.style[dimension] = `${this._element[scrollSize]}px`; + } + + hide() { + if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) { + return + } + + const startEvent = EventHandler.trigger(this._element, EVENT_HIDE); + if (startEvent.defaultPrevented) { + return + } + + const dimension = this._getDimension(); + + this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; + + reflow(this._element); + + this._element.classList.add(CLASS_NAME_COLLAPSING); + this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW); + + const triggerArrayLength = this._triggerArray.length; + if (triggerArrayLength > 0) { + for (let i = 0; i < triggerArrayLength; i++) { + const trigger = this._triggerArray[i]; + const elem = getElementFromSelector(trigger); + + if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) { + trigger.classList.add(CLASS_NAME_COLLAPSED); + trigger.setAttribute('aria-expanded', false); + } + } + } + + this.setTransitioning(true); + + const complete = () => { + this.setTransitioning(false); + this._element.classList.remove(CLASS_NAME_COLLAPSING); + this._element.classList.add(CLASS_NAME_COLLAPSE); + EventHandler.trigger(this._element, EVENT_HIDDEN); + }; + + this._element.style[dimension] = ''; + const transitionDuration = getTransitionDurationFromElement(this._element); + + EventHandler.one(this._element, TRANSITION_END, complete); + emulateTransitionEnd(this._element, transitionDuration); + } + + setTransitioning(isTransitioning) { + this._isTransitioning = isTransitioning; + } + + dispose() { + super.dispose(); + this._config = null; + this._parent = null; + this._triggerArray = null; + this._isTransitioning = null; + } + + // Private + + _getConfig(config) { + config = { + ...Default, + ...config + }; + config.toggle = Boolean(config.toggle); // Coerce string values + typeCheckConfig(NAME, config, DefaultType); + return config + } + + _getDimension() { + return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT + } + + _getParent() { + let { parent } = this._config; + + if (isElement(parent)) { + // it's a jQuery object + if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') { + parent = parent[0]; + } + } else { + parent = SelectorEngine.findOne(parent); + } + + const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`; + + SelectorEngine.find(selector, parent) + .forEach(element => { + const selected = getElementFromSelector(element); + + this._addAriaAndCollapsedClass( + selected, + [element] + ); + }); + + return parent + } + + _addAriaAndCollapsedClass(element, triggerArray) { + if (!element || !triggerArray.length) { + return + } + + const isOpen = element.classList.contains(CLASS_NAME_SHOW); + + triggerArray.forEach(elem => { + if (isOpen) { + elem.classList.remove(CLASS_NAME_COLLAPSED); + } else { + elem.classList.add(CLASS_NAME_COLLAPSED); + } + + elem.setAttribute('aria-expanded', isOpen); + }); + } + + // Static + + static collapseInterface(element, config) { + let data = Data.getData(element, DATA_KEY); + const _config = { + ...Default, + ...Manipulator.getDataAttributes(element), + ...(typeof config === 'object' && config ? config : {}) + }; + + if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { + _config.toggle = false; + } + + if (!data) { + data = new Collapse(element, _config); + } + + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`) + } + + data[config](); + } + } + + static jQueryInterface(config) { + return this.each(function () { + Collapse.collapseInterface(this, config); + }) + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { + // preventDefault only for elements (which change the URL) not inside the collapsible element + if (event.target.tagName === 'A') { + event.preventDefault(); + } + + const triggerData = Manipulator.getDataAttributes(this); + const selector = getSelectorFromElement(this); + const selectorElements = SelectorEngine.find(selector); + + selectorElements.forEach(element => { + const data = Data.getData(element, DATA_KEY); + let config; + if (data) { + // update parent attribute + if (data._parent === null && typeof triggerData.parent === 'string') { + data._config.parent = triggerData.parent; + data._parent = data._getParent(); + } + + config = 'toggle'; + } else { + config = triggerData; + } + + Collapse.collapseInterface(element, config); + }); +}); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Collapse to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Collapse.jQueryInterface; + $.fn[NAME].Constructor = Collapse; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Collapse.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap.Collapse = Collapse; + +export default Collapse; diff --git a/build/media_source/vendor/bs5/js/js/collapse.es6.min.js b/build/media_source/vendor/bs5/js/js/collapse.es6.min.js new file mode 100644 index 0000000000000..08793679face4 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/collapse.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";import s from"./dom/manipulator.js";import n from"./dom/selector-engine.js";const i=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const s=t.getAttribute("href");e=s&&"#"!==s?s.trim():null}return e},o=t=>{const e=i(t);return e&&document.querySelector(e)?e:null},a=t=>{const e=i(t);return e?document.querySelector(e):null},r=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const n=Number.parseFloat(e),i=Number.parseFloat(s);return n||i?(e=e.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(s))):0},l=t=>(t[0]||t).nodeType,c=(t,e)=>{let s=!1;const n=e+5;t.addEventListener("transitionend",(function e(){s=!0,t.removeEventListener("transitionend",e)})),setTimeout(()=>{s||(t=>{t.dispatchEvent(new Event("transitionend"))})(t)},n)};document.documentElement.dir;const h="collapse",g="bs.collapse",d={toggle:!0,parent:""},p={toggle:"boolean",parent:"(string|element)"};class u extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{constructor(t,e){super(t),this._isTransitioning=!1,this._config=this._getConfig(e),this._triggerArray=n.find(`[data-bs-toggle="collapse"][href="#${t.id}"],[data-bs-toggle="collapse"][data-bs-target="#${t.id}"]`);const s=n.find('[data-bs-toggle="collapse"]');for(let e=0,i=s.length;ee===t);null!==a&&r.length&&(this._selector=a,this._triggerArray.push(i))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}static get Default(){return d}static get DATA_KEY(){return g}toggle(){this._element.classList.contains("show")?this.hide():this.show()}show(){if(this._isTransitioning||this._element.classList.contains("show"))return;let s,i;this._parent&&(s=n.find(".show, .collapsing",this._parent).filter(t=>"string"==typeof this._config.parent?t.getAttribute("data-bs-parent")===this._config.parent:t.classList.contains("collapse")),0===s.length&&(s=null));const o=n.findOne(this._selector);if(s){const e=s.find(t=>o!==t);if(i=e?t.getData(e,g):null,i&&i._isTransitioning)return}if(e.trigger(this._element,"show.bs.collapse").defaultPrevented)return;s&&s.forEach(e=>{o!==e&&u.collapseInterface(e,"hide"),i||t.setData(e,g,null)});const a=this._getDimension();this._element.classList.remove("collapse"),this._element.classList.add("collapsing"),this._element.style[a]=0,this._triggerArray.length&&this._triggerArray.forEach(t=>{t.classList.remove("collapsed"),t.setAttribute("aria-expanded",!0)}),this.setTransitioning(!0);const l="scroll"+(a[0].toUpperCase()+a.slice(1)),h=r(this._element);e.one(this._element,"transitionend",()=>{this._element.classList.remove("collapsing"),this._element.classList.add("collapse","show"),this._element.style[a]="",this.setTransitioning(!1),e.trigger(this._element,"shown.bs.collapse")}),c(this._element,h),this._element.style[a]=this._element[l]+"px"}hide(){if(this._isTransitioning||!this._element.classList.contains("show"))return;if(e.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=this._element.getBoundingClientRect()[t]+"px",this._element.offsetHeight,this._element.classList.add("collapsing"),this._element.classList.remove("collapse","show");const s=this._triggerArray.length;if(s>0)for(let t=0;t{this.setTransitioning(!1),this._element.classList.remove("collapsing"),this._element.classList.add("collapse"),e.trigger(this._element,"hidden.bs.collapse")}),c(this._element,n)}setTransitioning(t){this._isTransitioning=t}dispose(){super.dispose(),this._config=null,this._parent=null,this._triggerArray=null,this._isTransitioning=null}_getConfig(t){return(t={...d,...t}).toggle=Boolean(t.toggle),((t,e,s)=>{Object.keys(s).forEach(n=>{const i=s[n],o=e[n],a=o&&l(o)?"element":null==(r=o)?""+r:{}.toString.call(r).match(/\s([a-z]+)/i)[1].toLowerCase();var r;if(!new RegExp(i).test(a))throw new Error(t.toUpperCase()+": "+`Option "${n}" provided type "${a}" `+`but expected type "${i}".`)})})(h,t,p),t}_getDimension(){return this._element.classList.contains("width")?"width":"height"}_getParent(){let{parent:t}=this._config;l(t)?void 0===t.jquery&&void 0===t[0]||(t=t[0]):t=n.findOne(t);const e=`[data-bs-toggle="collapse"][data-bs-parent="${t}"]`;return n.find(e,t).forEach(t=>{const e=a(t);this._addAriaAndCollapsedClass(e,[t])}),t}_addAriaAndCollapsedClass(t,e){if(!t||!e.length)return;const s=t.classList.contains("show");e.forEach(t=>{s?t.classList.remove("collapsed"):t.classList.add("collapsed"),t.setAttribute("aria-expanded",s)})}static collapseInterface(e,n){let i=t.getData(e,g);const o={...d,...s.getDataAttributes(e),..."object"==typeof n&&n?n:{}};if(!i&&o.toggle&&"string"==typeof n&&/show|hide/.test(n)&&(o.toggle=!1),i||(i=new u(e,o)),"string"==typeof n){if(void 0===i[n])throw new TypeError(`No method named "${n}"`);i[n]()}}static jQueryInterface(t){return this.each((function(){u.collapseInterface(this,t)}))}}var m;e.on(document,"click.bs.collapse.data-api",'[data-bs-toggle="collapse"]',(function(e){"A"===e.target.tagName&&e.preventDefault();const i=s.getDataAttributes(this),a=o(this);n.find(a).forEach(e=>{const s=t.getData(e,g);let n;s?(null===s._parent&&"string"==typeof i.parent&&(s._config.parent=i.parent,s._parent=s._getParent()),n="toggle"):n=i,u.collapseInterface(e,n)})})),m=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[h];t.fn[h]=u.jQueryInterface,t.fn[h].Constructor=u,t.fn[h].noConflict=()=>(t.fn[h]=e,u.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",m):m(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap.Collapse=u;export default u; diff --git a/build/media_source/vendor/bs5/js/js/dom/data.js b/build/media_source/vendor/bs5/js/js/dom/data.js new file mode 100644 index 0000000000000..a577deb9161c5 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/dom/data.js @@ -0,0 +1 @@ +const e=(()=>{const e={};let t=1;return{set(s,d,y){void 0===s.bsKey&&(s.bsKey={key:d,id:t},t++),e[s.bsKey.id]=y},get(t,s){if(!t||void 0===t.bsKey)return null;const d=t.bsKey;return d.key===s?e[d.id]:null},delete(t,s){if(void 0===t.bsKey)return;const d=t.bsKey;d.key===s&&(delete e[d.id],delete t.bsKey)}}})(),t={setData(t,s,d){e.set(t,s,d)},getData:(t,s)=>e.get(t,s),removeData(t,s){e.delete(t,s)}};export default t; diff --git a/build/media_source/vendor/bs5/js/js/dom/event-handler.js b/build/media_source/vendor/bs5/js/js/dom/event-handler.js new file mode 100644 index 0000000000000..82a087bb5fa09 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/dom/event-handler.js @@ -0,0 +1 @@ +document.documentElement.dir;const e=/[^.]*(?=\..*)\.|.*/,t=/\..*/,n=/::\d+$/,o={};let r=1;const u={mouseenter:"mouseover",mouseleave:"mouseout"},l=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function c(e,t){return t&&`${t}::${r++}`||e.uidEvent||r++}function i(e){const t=c(e);return e.uidEvent=t,o[t]=o[t]||{},o[t]}function s(e,t,n=null){const o=Object.keys(e);for(let r=0,u=o.length;r{!function(e,t,n,o){const r=t[n]||{};Object.keys(r).forEach(u=>{if(u.includes(o)){const o=r[u];d(e,t,n,o.originalHandler,o.delegationSelector)}})}(e,f,n,t.slice(1))});const g=f[c]||{};Object.keys(g).forEach(o=>{const r=o.replace(n,"");if(!s||t.includes(r)){const t=g[o];d(e,f,c,t.originalHandler,t.delegationSelector)}})},trigger(e,n,o){if("string"!=typeof n||!e)return null;const r=(()=>{const{jQuery:e}=window;return e&&!document.body.hasAttribute("data-bs-no-jquery")?e:null})(),u=n.replace(t,""),c=n!==u,i=l.has(u);let s,a=!0,f=!0,d=!1,p=null;return c&&r&&(s=r.Event(n,o),r(e).trigger(s),a=!s.isPropagationStopped(),f=!s.isImmediatePropagationStopped(),d=s.isDefaultPrevented()),i?(p=document.createEvent("HTMLEvents"),p.initEvent(u,a,!0)):p=new CustomEvent(n,{bubbles:a,cancelable:!0}),void 0!==o&&Object.keys(o).forEach(e=>{Object.defineProperty(p,e,{get:()=>o[e]})}),d&&p.preventDefault(),f&&e.dispatchEvent(p),p.defaultPrevented&&void 0!==s&&s.preventDefault(),p}};export default p; diff --git a/build/media_source/vendor/bs5/js/js/dom/manipulator.js b/build/media_source/vendor/bs5/js/js/dom/manipulator.js new file mode 100644 index 0000000000000..b6db5fcf1fe2d --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/dom/manipulator.js @@ -0,0 +1 @@ +function t(t){return"true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function e(t){return t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}const r={setDataAttribute(t,r,o){t.setAttribute("data-bs-"+e(r),o)},removeDataAttribute(t,r){t.removeAttribute("data-bs-"+e(r))},getDataAttributes(e){if(!e)return{};const r={};return Object.keys(e.dataset).filter(t=>t.startsWith("bs")).forEach(o=>{let a=o.replace(/^bs/,"");a=a.charAt(0).toLowerCase()+a.slice(1,a.length),r[a]=t(e.dataset[o])}),r},getDataAttribute:(r,o)=>t(r.getAttribute("data-bs-"+e(o))),offset(t){const e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},position:t=>({top:t.offsetTop,left:t.offsetLeft})};export default r; diff --git a/build/media_source/vendor/bs5/js/js/dom/selector-engine.js b/build/media_source/vendor/bs5/js/js/dom/selector-engine.js new file mode 100644 index 0000000000000..5ca792626a021 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/dom/selector-engine.js @@ -0,0 +1 @@ +const e={matches:(e,t)=>e.matches(t),find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter(e=>e.matches(t)),parents(e,t){const n=[];let r=e.parentNode;for(;r&&r.nodeType===Node.ELEMENT_NODE&&3!==r.nodeType;)this.matches(r,t)&&n.push(r),r=r.parentNode;return n},prev(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return[n];n=n.previousElementSibling}return[]},next(e,t){let n=e.nextElementSibling;for(;n;){if(this.matches(n,t))return[n];n=n.nextElementSibling}return[]}};export default e; diff --git a/build/media_source/vendor/bs5/js/js/dropdown.es6.js b/build/media_source/vendor/bs5/js/js/dropdown.es6.js new file mode 100644 index 0000000000000..5ccdfa308800f --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/dropdown.es6.js @@ -0,0 +1,632 @@ +import * as Popper from './popper/index.js'; +import { createPopper } from './popper/index.js'; +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; +import Manipulator from './dom/manipulator.js'; +import SelectorEngine from './dom/selector-engine.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +// Shoutout AngusCroll (https://goo.gl/pxwQGp) +const toType = obj => { + if (obj === null || obj === undefined) { + return `${obj}` + } + + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() +}; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const isElement = obj => (obj[0] || obj).nodeType; + +const typeCheckConfig = (componentName, config, configTypes) => { + Object.keys(configTypes).forEach(property => { + const expectedTypes = configTypes[property]; + const value = config[property]; + const valueType = value && isElement(value) ? + 'element' : + toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error( + `${componentName.toUpperCase()}: ` + + `Option "${property}" provided type "${valueType}" ` + + `but expected type "${expectedTypes}".`) + } + }); +}; + +const isVisible = element => { + if (!element) { + return false + } + + if (element.style && element.parentNode && element.parentNode.style) { + const elementStyle = getComputedStyle(element); + const parentNodeStyle = getComputedStyle(element.parentNode); + + return elementStyle.display !== 'none' && + parentNodeStyle.display !== 'none' && + elementStyle.visibility !== 'hidden' + } + + return false +}; + +const noop = () => function () {}; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): dropdown.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'dropdown'; +const DATA_KEY = 'bs.dropdown'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const ESCAPE_KEY = 'Escape'; +const SPACE_KEY = 'Space'; +const TAB_KEY = 'Tab'; +const ARROW_UP_KEY = 'ArrowUp'; +const ARROW_DOWN_KEY = 'ArrowDown'; +const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button + +const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY}`); + +const EVENT_HIDE = `hide${EVENT_KEY}`; +const EVENT_HIDDEN = `hidden${EVENT_KEY}`; +const EVENT_SHOW = `show${EVENT_KEY}`; +const EVENT_SHOWN = `shown${EVENT_KEY}`; +const EVENT_CLICK = `click${EVENT_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; +const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`; +const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`; + +const CLASS_NAME_DISABLED = 'disabled'; +const CLASS_NAME_SHOW = 'show'; +const CLASS_NAME_DROPUP = 'dropup'; +const CLASS_NAME_DROPEND = 'dropend'; +const CLASS_NAME_DROPSTART = 'dropstart'; +const CLASS_NAME_NAVBAR = 'navbar'; + +const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]'; +const SELECTOR_FORM_CHILD = '.dropdown form'; +const SELECTOR_MENU = '.dropdown-menu'; +const SELECTOR_NAVBAR_NAV = '.navbar-nav'; +const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; + +const PLACEMENT_TOP = isRTL ? 'top-end' : 'top-start'; +const PLACEMENT_TOPEND = isRTL ? 'top-start' : 'top-end'; +const PLACEMENT_BOTTOM = isRTL ? 'bottom-end' : 'bottom-start'; +const PLACEMENT_BOTTOMEND = isRTL ? 'bottom-start' : 'bottom-end'; +const PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start'; +const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start'; + +const Default = { + offset: 0, + flip: true, + boundary: 'clippingParents', + reference: 'toggle', + display: 'dynamic', + popperConfig: null +}; + +const DefaultType = { + offset: '(number|string|function)', + flip: 'boolean', + boundary: '(string|element)', + reference: '(string|element)', + display: 'string', + popperConfig: '(null|object)' +}; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Dropdown extends BaseComponent { + constructor(element, config) { + super(element); + + this._popper = null; + this._config = this._getConfig(config); + this._menu = this._getMenuElement(); + this._inNavbar = this._detectNavbar(); + + this._addEventListeners(); + } + + // Getters + + static get Default() { + return Default + } + + static get DefaultType() { + return DefaultType + } + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + toggle() { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) { + return + } + + const isActive = this._element.classList.contains(CLASS_NAME_SHOW); + + Dropdown.clearMenus(); + + if (isActive) { + return + } + + this.show(); + } + + show() { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW)) { + return + } + + const parent = Dropdown.getParentFromElement(this._element); + const relatedTarget = { + relatedTarget: this._element + }; + + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget); + + if (showEvent.defaultPrevented) { + return + } + + // Totally disable Popper for Dropdowns in Navbar + if (!this._inNavbar) { + if (typeof Popper === 'undefined') { + throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)') + } + + let referenceElement = this._element; + + if (this._config.reference === 'parent') { + referenceElement = parent; + } else if (isElement(this._config.reference)) { + referenceElement = this._config.reference; + + // Check if it's jQuery element + if (typeof this._config.reference.jquery !== 'undefined') { + referenceElement = this._config.reference[0]; + } + } + + this._popper = createPopper(referenceElement, this._menu, this._getPopperConfig()); + } + + // If this is a touch-enabled device we add extra + // empty mouseover listeners to the body's immediate children; + // only needed because of broken event delegation on iOS + // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html + if ('ontouchstart' in document.documentElement && + !parent.closest(SELECTOR_NAVBAR_NAV)) { + [].concat(...document.body.children) + .forEach(elem => EventHandler.on(elem, 'mouseover', null, noop())); + } + + this._element.focus(); + this._element.setAttribute('aria-expanded', true); + + this._menu.classList.toggle(CLASS_NAME_SHOW); + this._element.classList.toggle(CLASS_NAME_SHOW); + EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget); + } + + hide() { + if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW)) { + return + } + + const parent = Dropdown.getParentFromElement(this._element); + const relatedTarget = { + relatedTarget: this._element + }; + + const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget); + + if (hideEvent.defaultPrevented) { + return + } + + if (this._popper) { + this._popper.destroy(); + } + + this._menu.classList.toggle(CLASS_NAME_SHOW); + this._element.classList.toggle(CLASS_NAME_SHOW); + EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget); + } + + dispose() { + super.dispose(); + EventHandler.off(this._element, EVENT_KEY); + this._menu = null; + + if (this._popper) { + this._popper.destroy(); + this._popper = null; + } + } + + update() { + this._inNavbar = this._detectNavbar(); + if (this._popper) { + this._popper.update(); + } + } + + // Private + + _addEventListeners() { + EventHandler.on(this._element, EVENT_CLICK, event => { + event.preventDefault(); + event.stopPropagation(); + this.toggle(); + }); + } + + _getConfig(config) { + config = { + ...this.constructor.Default, + ...Manipulator.getDataAttributes(this._element), + ...config + }; + + typeCheckConfig(NAME, config, this.constructor.DefaultType); + + return config + } + + _getMenuElement() { + return SelectorEngine.next(this._element, SELECTOR_MENU)[0] + } + + _getPlacement() { + const parentDropdown = this._element.parentNode; + + if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { + return PLACEMENT_RIGHT + } + + if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { + return PLACEMENT_LEFT + } + + // We need to trim the value because custom properties can also include spaces + const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; + + if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { + return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP + } + + return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM + } + + _detectNavbar() { + return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null + } + + _getPopperConfig() { + const popperConfig = { + placement: this._getPlacement(), + modifiers: [{ + name: 'preventOverflow', + options: { + altBoundary: this._config.flip, + rootBoundary: this._config.boundary + } + }] + }; + + // Disable Popper if we have a static display + if (this._config.display === 'static') { + popperConfig.modifiers = [{ + name: 'applyStyles', + enabled: false + }]; + } + + return { + ...popperConfig, + ...this._config.popperConfig + } + } + + // Static + + static dropdownInterface(element, config) { + let data = Data.getData(element, DATA_KEY); + const _config = typeof config === 'object' ? config : null; + + if (!data) { + data = new Dropdown(element, _config); + } + + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`) + } + + data[config](); + } + } + + static jQueryInterface(config) { + return this.each(function () { + Dropdown.dropdownInterface(this, config); + }) + } + + static clearMenus(event) { + if (event && (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))) { + return + } + + const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE); + + for (let i = 0, len = toggles.length; i < len; i++) { + const parent = Dropdown.getParentFromElement(toggles[i]); + const context = Data.getData(toggles[i], DATA_KEY); + const relatedTarget = { + relatedTarget: toggles[i] + }; + + if (event && event.type === 'click') { + relatedTarget.clickEvent = event; + } + + if (!context) { + continue + } + + const dropdownMenu = context._menu; + if (!toggles[i].classList.contains(CLASS_NAME_SHOW)) { + continue + } + + if (event && ((event.type === 'click' && + /input|textarea/i.test(event.target.tagName)) || + (event.type === 'keyup' && event.key === TAB_KEY)) && + dropdownMenu.contains(event.target)) { + continue + } + + const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget); + if (hideEvent.defaultPrevented) { + continue + } + + // If this is a touch-enabled device we remove the extra + // empty mouseover listeners we added for iOS support + if ('ontouchstart' in document.documentElement) { + [].concat(...document.body.children) + .forEach(elem => EventHandler.off(elem, 'mouseover', null, noop())); + } + + toggles[i].setAttribute('aria-expanded', 'false'); + + if (context._popper) { + context._popper.destroy(); + } + + dropdownMenu.classList.remove(CLASS_NAME_SHOW); + toggles[i].classList.remove(CLASS_NAME_SHOW); + EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget); + } + } + + static getParentFromElement(element) { + return getElementFromSelector(element) || element.parentNode + } + + static dataApiKeydownHandler(event) { + // If not input/textarea: + // - And not a key in REGEXP_KEYDOWN => not a dropdown command + // If input/textarea: + // - If space key => not a dropdown command + // - If key is other than escape + // - If key is not up or down => not a dropdown command + // - If trigger inside the menu => not a dropdown command + if (/input|textarea/i.test(event.target.tagName) ? + event.key === SPACE_KEY || (event.key !== ESCAPE_KEY && + ((event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY) || + event.target.closest(SELECTOR_MENU))) : + !REGEXP_KEYDOWN.test(event.key)) { + return + } + + event.preventDefault(); + event.stopPropagation(); + + if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) { + return + } + + const parent = Dropdown.getParentFromElement(this); + const isActive = this.classList.contains(CLASS_NAME_SHOW); + + if (event.key === ESCAPE_KEY) { + const button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0]; + button.focus(); + Dropdown.clearMenus(); + return + } + + if (!isActive || event.key === SPACE_KEY) { + Dropdown.clearMenus(); + return + } + + const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible); + + if (!items.length) { + return + } + + let index = items.indexOf(event.target); + + // Up + if (event.key === ARROW_UP_KEY && index > 0) { + index--; + } + + // Down + if (event.key === ARROW_DOWN_KEY && index < items.length - 1) { + index++; + } + + // index is -1 if the first keydown is an ArrowUp + index = index === -1 ? 0 : index; + + items[index].focus(); + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler); +EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); +EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus); +EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { + event.preventDefault(); + event.stopPropagation(); + Dropdown.dropdownInterface(this, 'toggle'); +}); +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, e => e.stopPropagation()); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Dropdown to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Dropdown.jQueryInterface; + $.fn[NAME].Constructor = Dropdown; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Dropdown.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap.Dropdown = Dropdown; + +export default Dropdown; diff --git a/build/media_source/vendor/bs5/js/js/dropdown.es6.min.js b/build/media_source/vendor/bs5/js/js/dropdown.es6.min.js new file mode 100644 index 0000000000000..a9a5350d1c72b --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/dropdown.es6.min.js @@ -0,0 +1 @@ +import*as t from"./popper/index.js";import{createPopper as e}from"./popper/index.js";import n from"./dom/data.js";import o from"./dom/event-handler.js";import r from"./dom/manipulator.js";import s from"./dom/selector-engine.js";const i=t=>(t[0]||t).nodeType,a=t=>{if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){const e=getComputedStyle(t),n=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==n.display&&"hidden"!==e.visibility}return!1},d="rtl"===document.documentElement.dir,p="dropdown",l=new RegExp("ArrowUp|ArrowDown|Escape"),c=d?"top-end":"top-start",u=d?"top-start":"top-end",m=d?"bottom-end":"bottom-start",h=d?"bottom-start":"bottom-end",g=d?"left-start":"right-start",f=d?"right-start":"left-start",w={offset:0,flip:!0,boundary:"clippingParents",reference:"toggle",display:"dynamic",popperConfig:null},_={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string",popperConfig:"(null|object)"};class b extends class{constructor(t){t&&(this._element=t,n.setData(t,this.constructor.DATA_KEY,this))}dispose(){n.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(t){return n.getData(t,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{constructor(t,e){super(t),this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}static get Default(){return w}static get DefaultType(){return _}static get DATA_KEY(){return"bs.dropdown"}toggle(){if(this._element.disabled||this._element.classList.contains("disabled"))return;const t=this._element.classList.contains("show");b.clearMenus(),t||this.show()}show(){if(this._element.disabled||this._element.classList.contains("disabled")||this._menu.classList.contains("show"))return;const n=b.getParentFromElement(this._element),r={relatedTarget:this._element};if(!o.trigger(this._element,"show.bs.dropdown",r).defaultPrevented){if(!this._inNavbar){if(void 0===t)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let o=this._element;"parent"===this._config.reference?o=n:i(this._config.reference)&&(o=this._config.reference,void 0!==this._config.reference.jquery&&(o=this._config.reference[0])),this._popper=e(o,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&!n.closest(".navbar-nav")&&[].concat(...document.body.children).forEach(t=>o.on(t,"mouseover",null,(function(){}))),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.toggle("show"),this._element.classList.toggle("show"),o.trigger(n,"shown.bs.dropdown",r)}}hide(){if(this._element.disabled||this._element.classList.contains("disabled")||!this._menu.classList.contains("show"))return;const t=b.getParentFromElement(this._element),e={relatedTarget:this._element};o.trigger(t,"hide.bs.dropdown",e).defaultPrevented||(this._popper&&this._popper.destroy(),this._menu.classList.toggle("show"),this._element.classList.toggle("show"),o.trigger(t,"hidden.bs.dropdown",e))}dispose(){super.dispose(),o.off(this._element,".bs.dropdown"),this._menu=null,this._popper&&(this._popper.destroy(),this._popper=null)}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_addEventListeners(){o.on(this._element,"click.bs.dropdown",t=>{t.preventDefault(),t.stopPropagation(),this.toggle()})}_getConfig(t){return t={...this.constructor.Default,...r.getDataAttributes(this._element),...t},((t,e,n)=>{Object.keys(n).forEach(o=>{const r=n[o],s=e[o],a=s&&i(s)?"element":null==(d=s)?""+d:{}.toString.call(d).match(/\s([a-z]+)/i)[1].toLowerCase();var d;if(!new RegExp(r).test(a))throw new Error(t.toUpperCase()+": "+`Option "${o}" provided type "${a}" `+`but expected type "${r}".`)})})(p,t,this.constructor.DefaultType),t}_getMenuElement(){return s.next(this._element,".dropdown-menu")[0]}_getPlacement(){const t=this._element.parentNode;if(t.classList.contains("dropend"))return g;if(t.classList.contains("dropstart"))return f;const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?u:c:e?h:m}_detectNavbar(){return null!==this._element.closest(".navbar")}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{altBoundary:this._config.flip,rootBoundary:this._config.boundary}}]};return"static"===this._config.display&&(t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,...this._config.popperConfig}}static dropdownInterface(t,e){let o=n.getData(t,"bs.dropdown");if(o||(o=new b(t,"object"==typeof e?e:null)),"string"==typeof e){if(void 0===o[e])throw new TypeError(`No method named "${e}"`);o[e]()}}static jQueryInterface(t){return this.each((function(){b.dropdownInterface(this,t)}))}static clearMenus(t){if(t&&(2===t.button||"keyup"===t.type&&"Tab"!==t.key))return;const e=s.find('[data-bs-toggle="dropdown"]');for(let r=0,s=e.length;ro.off(t,"mouseover",null,(function(){}))),e[r].setAttribute("aria-expanded","false"),i._popper&&i._popper.destroy(),d.classList.remove("show"),e[r].classList.remove("show"),o.trigger(s,"hidden.bs.dropdown",a)))}}static getParentFromElement(t){return(t=>{const e=(t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const n=t.getAttribute("href");e=n&&"#"!==n?n.trim():null}return e})(t);return e?document.querySelector(e):null})(t)||t.parentNode}static dataApiKeydownHandler(t){if(/input|textarea/i.test(t.target.tagName)?"Space"===t.key||"Escape"!==t.key&&("ArrowDown"!==t.key&&"ArrowUp"!==t.key||t.target.closest(".dropdown-menu")):!l.test(t.key))return;if(t.preventDefault(),t.stopPropagation(),this.disabled||this.classList.contains("disabled"))return;const e=b.getParentFromElement(this),n=this.classList.contains("show");if("Escape"===t.key)return(this.matches('[data-bs-toggle="dropdown"]')?this:s.prev(this,'[data-bs-toggle="dropdown"]')[0]).focus(),void b.clearMenus();if(!n||"Space"===t.key)return void b.clearMenus();const o=s.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",e).filter(a);if(!o.length)return;let r=o.indexOf(t.target);"ArrowUp"===t.key&&r>0&&r--,"ArrowDown"===t.key&&rt.stopPropagation()),y=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[p];t.fn[p]=b.jQueryInterface,t.fn[p].Constructor=b,t.fn[p].noConflict=()=>(t.fn[p]=e,b.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",y):y(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap.Dropdown=b;export default b; diff --git a/build/media_source/vendor/bs5/js/js/modal.es6.js b/build/media_source/vendor/bs5/js/js/modal.es6.js new file mode 100644 index 0000000000000..59f441495551f --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/modal.es6.js @@ -0,0 +1,789 @@ +import Data from './dom/data.js'; +import EventHandler from './dom/event-handler.js'; +import Manipulator from './dom/manipulator.js'; +import SelectorEngine from './dom/selector-engine.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ +const MILLISECONDS_MULTIPLIER = 1000; +const TRANSITION_END = 'transitionend'; + +// Shoutout AngusCroll (https://goo.gl/pxwQGp) +const toType = obj => { + if (obj === null || obj === undefined) { + return `${obj}` + } + + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() +}; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getElementFromSelector = element => { + const selector = getSelector(element); + + return selector ? document.querySelector(selector) : null +}; + +const getTransitionDurationFromElement = element => { + if (!element) { + return 0 + } + + // Get transition-duration of the element + let { transitionDuration, transitionDelay } = window.getComputedStyle(element); + + const floatTransitionDuration = Number.parseFloat(transitionDuration); + const floatTransitionDelay = Number.parseFloat(transitionDelay); + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0 + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0]; + transitionDelay = transitionDelay.split(',')[0]; + + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER +}; + +const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)); +}; + +const isElement = obj => (obj[0] || obj).nodeType; + +const emulateTransitionEnd = (element, duration) => { + let called = false; + const durationPadding = 5; + const emulatedDuration = duration + durationPadding; + + function listener() { + called = true; + element.removeEventListener(TRANSITION_END, listener); + } + + element.addEventListener(TRANSITION_END, listener); + setTimeout(() => { + if (!called) { + triggerTransitionEnd(element); + } + }, emulatedDuration); +}; + +const typeCheckConfig = (componentName, config, configTypes) => { + Object.keys(configTypes).forEach(property => { + const expectedTypes = configTypes[property]; + const value = config[property]; + const valueType = value && isElement(value) ? + 'element' : + toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error( + `${componentName.toUpperCase()}: ` + + `Option "${property}" provided type "${valueType}" ` + + `but expected type "${expectedTypes}".`) + } + }); +}; + +const isVisible = element => { + if (!element) { + return false + } + + if (element.style && element.parentNode && element.parentNode.style) { + const elementStyle = getComputedStyle(element); + const parentNodeStyle = getComputedStyle(element.parentNode); + + return elementStyle.display !== 'none' && + parentNodeStyle.display !== 'none' && + elementStyle.visibility !== 'hidden' + } + + return false +}; + +const reflow = element => element.offsetHeight; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): modal.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'modal'; +const DATA_KEY = 'bs.modal'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; +const ESCAPE_KEY = 'Escape'; + +const Default = { + backdrop: true, + keyboard: true, + focus: true +}; + +const DefaultType = { + backdrop: '(boolean|string)', + keyboard: 'boolean', + focus: 'boolean' +}; + +const EVENT_HIDE = `hide${EVENT_KEY}`; +const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`; +const EVENT_HIDDEN = `hidden${EVENT_KEY}`; +const EVENT_SHOW = `show${EVENT_KEY}`; +const EVENT_SHOWN = `shown${EVENT_KEY}`; +const EVENT_FOCUSIN = `focusin${EVENT_KEY}`; +const EVENT_RESIZE = `resize${EVENT_KEY}`; +const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`; +const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`; +const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY}`; +const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`; +const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + +const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; +const CLASS_NAME_BACKDROP = 'modal-backdrop'; +const CLASS_NAME_OPEN = 'modal-open'; +const CLASS_NAME_FADE = 'fade'; +const CLASS_NAME_SHOW = 'show'; +const CLASS_NAME_STATIC = 'modal-static'; + +const SELECTOR_DIALOG = '.modal-dialog'; +const SELECTOR_MODAL_BODY = '.modal-body'; +const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="modal"]'; +const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]'; +const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; +const SELECTOR_STICKY_CONTENT = '.sticky-top'; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Modal extends BaseComponent { + constructor(element, config) { + super(element); + + this._config = this._getConfig(config); + this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element); + this._backdrop = null; + this._isShown = false; + this._isBodyOverflowing = false; + this._ignoreBackdropClick = false; + this._isTransitioning = false; + this._scrollbarWidth = 0; + } + + // Getters + + static get Default() { + return Default + } + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + toggle(relatedTarget) { + return this._isShown ? this.hide() : this.show(relatedTarget) + } + + show(relatedTarget) { + if (this._isShown || this._isTransitioning) { + return + } + + if (this._element.classList.contains(CLASS_NAME_FADE)) { + this._isTransitioning = true; + } + + const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { + relatedTarget + }); + + if (this._isShown || showEvent.defaultPrevented) { + return + } + + this._isShown = true; + + this._checkScrollbar(); + this._setScrollbar(); + + this._adjustDialog(); + + this._setEscapeEvent(); + this._setResizeEvent(); + + EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, event => this.hide(event)); + + EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => { + EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => { + if (event.target === this._element) { + this._ignoreBackdropClick = true; + } + }); + }); + + this._showBackdrop(() => this._showElement(relatedTarget)); + } + + hide(event) { + if (event) { + event.preventDefault(); + } + + if (!this._isShown || this._isTransitioning) { + return + } + + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE); + + if (hideEvent.defaultPrevented) { + return + } + + this._isShown = false; + const transition = this._element.classList.contains(CLASS_NAME_FADE); + + if (transition) { + this._isTransitioning = true; + } + + this._setEscapeEvent(); + this._setResizeEvent(); + + EventHandler.off(document, EVENT_FOCUSIN); + + this._element.classList.remove(CLASS_NAME_SHOW); + + EventHandler.off(this._element, EVENT_CLICK_DISMISS); + EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS); + + if (transition) { + const transitionDuration = getTransitionDurationFromElement(this._element); + + EventHandler.one(this._element, TRANSITION_END, event => this._hideModal(event)); + emulateTransitionEnd(this._element, transitionDuration); + } else { + this._hideModal(); + } + } + + dispose() { + [window, this._element, this._dialog] + .forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY)); + + super.dispose(); + + /** + * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` + * Do not move `document` in `htmlElements` array + * It will remove `EVENT_CLICK_DATA_API` event that should remain + */ + EventHandler.off(document, EVENT_FOCUSIN); + + this._config = null; + this._dialog = null; + this._backdrop = null; + this._isShown = null; + this._isBodyOverflowing = null; + this._ignoreBackdropClick = null; + this._isTransitioning = null; + this._scrollbarWidth = null; + } + + handleUpdate() { + this._adjustDialog(); + } + + // Private + + _getConfig(config) { + config = { + ...Default, + ...config + }; + typeCheckConfig(NAME, config, DefaultType); + return config + } + + _showElement(relatedTarget) { + const transition = this._element.classList.contains(CLASS_NAME_FADE); + const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); + + if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { + // Don't move modal's DOM position + document.body.appendChild(this._element); + } + + this._element.style.display = 'block'; + this._element.removeAttribute('aria-hidden'); + this._element.setAttribute('aria-modal', true); + this._element.setAttribute('role', 'dialog'); + this._element.scrollTop = 0; + + if (modalBody) { + modalBody.scrollTop = 0; + } + + if (transition) { + reflow(this._element); + } + + this._element.classList.add(CLASS_NAME_SHOW); + + if (this._config.focus) { + this._enforceFocus(); + } + + const transitionComplete = () => { + if (this._config.focus) { + this._element.focus(); + } + + this._isTransitioning = false; + EventHandler.trigger(this._element, EVENT_SHOWN, { + relatedTarget + }); + }; + + if (transition) { + const transitionDuration = getTransitionDurationFromElement(this._dialog); + + EventHandler.one(this._dialog, TRANSITION_END, transitionComplete); + emulateTransitionEnd(this._dialog, transitionDuration); + } else { + transitionComplete(); + } + } + + _enforceFocus() { + EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop + EventHandler.on(document, EVENT_FOCUSIN, event => { + if (document !== event.target && + this._element !== event.target && + !this._element.contains(event.target)) { + this._element.focus(); + } + }); + } + + _setEscapeEvent() { + if (this._isShown) { + EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { + if (this._config.keyboard && event.key === ESCAPE_KEY) { + event.preventDefault(); + this.hide(); + } else if (!this._config.keyboard && event.key === ESCAPE_KEY) { + this._triggerBackdropTransition(); + } + }); + } else { + EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS); + } + } + + _setResizeEvent() { + if (this._isShown) { + EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog()); + } else { + EventHandler.off(window, EVENT_RESIZE); + } + } + + _hideModal() { + this._element.style.display = 'none'; + this._element.setAttribute('aria-hidden', true); + this._element.removeAttribute('aria-modal'); + this._element.removeAttribute('role'); + this._isTransitioning = false; + this._showBackdrop(() => { + document.body.classList.remove(CLASS_NAME_OPEN); + this._resetAdjustments(); + this._resetScrollbar(); + EventHandler.trigger(this._element, EVENT_HIDDEN); + }); + } + + _removeBackdrop() { + this._backdrop.parentNode.removeChild(this._backdrop); + this._backdrop = null; + } + + _showBackdrop(callback) { + const animate = this._element.classList.contains(CLASS_NAME_FADE) ? + CLASS_NAME_FADE : + ''; + + if (this._isShown && this._config.backdrop) { + this._backdrop = document.createElement('div'); + this._backdrop.className = CLASS_NAME_BACKDROP; + + if (animate) { + this._backdrop.classList.add(animate); + } + + document.body.appendChild(this._backdrop); + + EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => { + if (this._ignoreBackdropClick) { + this._ignoreBackdropClick = false; + return + } + + if (event.target !== event.currentTarget) { + return + } + + if (this._config.backdrop === 'static') { + this._triggerBackdropTransition(); + } else { + this.hide(); + } + }); + + if (animate) { + reflow(this._backdrop); + } + + this._backdrop.classList.add(CLASS_NAME_SHOW); + + if (!animate) { + callback(); + return + } + + const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); + + EventHandler.one(this._backdrop, TRANSITION_END, callback); + emulateTransitionEnd(this._backdrop, backdropTransitionDuration); + } else if (!this._isShown && this._backdrop) { + this._backdrop.classList.remove(CLASS_NAME_SHOW); + + const callbackRemove = () => { + this._removeBackdrop(); + callback(); + }; + + if (this._element.classList.contains(CLASS_NAME_FADE)) { + const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); + EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove); + emulateTransitionEnd(this._backdrop, backdropTransitionDuration); + } else { + callbackRemove(); + } + } else { + callback(); + } + } + + _triggerBackdropTransition() { + const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); + if (hideEvent.defaultPrevented) { + return + } + + const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; + + if (!isModalOverflowing) { + this._element.style.overflowY = 'hidden'; + } + + this._element.classList.add(CLASS_NAME_STATIC); + const modalTransitionDuration = getTransitionDurationFromElement(this._dialog); + EventHandler.off(this._element, TRANSITION_END); + EventHandler.one(this._element, TRANSITION_END, () => { + this._element.classList.remove(CLASS_NAME_STATIC); + if (!isModalOverflowing) { + EventHandler.one(this._element, TRANSITION_END, () => { + this._element.style.overflowY = ''; + }); + emulateTransitionEnd(this._element, modalTransitionDuration); + } + }); + emulateTransitionEnd(this._element, modalTransitionDuration); + this._element.focus(); + } + + // ---------------------------------------------------------------------- + // the following methods are used to handle overflowing modals + // ---------------------------------------------------------------------- + + _adjustDialog() { + const isModalOverflowing = + this._element.scrollHeight > document.documentElement.clientHeight; + + if ((!this._isBodyOverflowing && isModalOverflowing && !isRTL) || (this._isBodyOverflowing && !isModalOverflowing && isRTL)) { + this._element.style.paddingLeft = `${this._scrollbarWidth}px`; + } + + if ((this._isBodyOverflowing && !isModalOverflowing && !isRTL) || (!this._isBodyOverflowing && isModalOverflowing && isRTL)) { + this._element.style.paddingRight = `${this._scrollbarWidth}px`; + } + } + + _resetAdjustments() { + this._element.style.paddingLeft = ''; + this._element.style.paddingRight = ''; + } + + _checkScrollbar() { + const rect = document.body.getBoundingClientRect(); + this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; + this._scrollbarWidth = this._getScrollbarWidth(); + } + + _setScrollbar() { + if (this._isBodyOverflowing) { + // Note: DOMNode.style.paddingRight returns the actual value or '' if not set + // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set + + // Adjust fixed content padding + SelectorEngine.find(SELECTOR_FIXED_CONTENT) + .forEach(element => { + const actualPadding = element.style.paddingRight; + const calculatedPadding = window.getComputedStyle(element)['padding-right']; + Manipulator.setDataAttribute(element, 'padding-right', actualPadding); + element.style.paddingRight = `${Number.parseFloat(calculatedPadding) + this._scrollbarWidth}px`; + }); + + // Adjust sticky content margin + SelectorEngine.find(SELECTOR_STICKY_CONTENT) + .forEach(element => { + const actualMargin = element.style.marginRight; + const calculatedMargin = window.getComputedStyle(element)['margin-right']; + Manipulator.setDataAttribute(element, 'margin-right', actualMargin); + element.style.marginRight = `${Number.parseFloat(calculatedMargin) - this._scrollbarWidth}px`; + }); + + // Adjust body padding + const actualPadding = document.body.style.paddingRight; + const calculatedPadding = window.getComputedStyle(document.body)['padding-right']; + + Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding); + document.body.style.paddingRight = `${Number.parseFloat(calculatedPadding) + this._scrollbarWidth}px`; + } + + document.body.classList.add(CLASS_NAME_OPEN); + } + + _resetScrollbar() { + // Restore fixed content padding + SelectorEngine.find(SELECTOR_FIXED_CONTENT) + .forEach(element => { + const padding = Manipulator.getDataAttribute(element, 'padding-right'); + if (typeof padding !== 'undefined') { + Manipulator.removeDataAttribute(element, 'padding-right'); + element.style.paddingRight = padding; + } + }); + + // Restore sticky content and navbar-toggler margin + SelectorEngine.find(`${SELECTOR_STICKY_CONTENT}`) + .forEach(element => { + const margin = Manipulator.getDataAttribute(element, 'margin-right'); + if (typeof margin !== 'undefined') { + Manipulator.removeDataAttribute(element, 'margin-right'); + element.style.marginRight = margin; + } + }); + + // Restore body padding + const padding = Manipulator.getDataAttribute(document.body, 'padding-right'); + if (typeof padding === 'undefined') { + document.body.style.paddingRight = ''; + } else { + Manipulator.removeDataAttribute(document.body, 'padding-right'); + document.body.style.paddingRight = padding; + } + } + + _getScrollbarWidth() { // thx d.walsh + const scrollDiv = document.createElement('div'); + scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; + document.body.appendChild(scrollDiv); + const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; + document.body.removeChild(scrollDiv); + return scrollbarWidth + } + + // Static + + static jQueryInterface(config, relatedTarget) { + return this.each(function () { + let data = Data.getData(this, DATA_KEY); + const _config = { + ...Default, + ...Manipulator.getDataAttributes(this), + ...(typeof config === 'object' && config ? config : {}) + }; + + if (!data) { + data = new Modal(this, _config); + } + + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`) + } + + data[config](relatedTarget); + } + }) + } +} + +/** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ + +EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { + const target = getElementFromSelector(this); + + if (this.tagName === 'A' || this.tagName === 'AREA') { + event.preventDefault(); + } + + EventHandler.one(target, EVENT_SHOW, showEvent => { + if (showEvent.defaultPrevented) { + // only register focus restorer if modal will actually get shown + return + } + + EventHandler.one(target, EVENT_HIDDEN, () => { + if (isVisible(this)) { + this.focus(); + } + }); + }); + + let data = Data.getData(target, DATA_KEY); + if (!data) { + const config = { + ...Manipulator.getDataAttributes(target), + ...Manipulator.getDataAttributes(this) + }; + + data = new Modal(target, config); + } + + data.show(this); +}); + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Modal to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Modal.jQueryInterface; + $.fn[NAME].Constructor = Modal; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Modal.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap.Modal = Modal; + +export default Modal; diff --git a/build/media_source/vendor/bs5/js/js/modal.es6.min.js b/build/media_source/vendor/bs5/js/js/modal.es6.min.js new file mode 100644 index 0000000000000..b99b5cf317ee6 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/modal.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/event-handler.js";import i from"./dom/manipulator.js";import s from"./dom/selector-engine.js";const o=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const s=Number.parseFloat(e),o=Number.parseFloat(i);return s||o?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0},n=(t,e)=>{let i=!1;const s=e+5;t.addEventListener("transitionend",(function e(){i=!0,t.removeEventListener("transitionend",e)})),setTimeout(()=>{i||(t=>{t.dispatchEvent(new Event("transitionend"))})(t)},s)},d=t=>t.offsetHeight,a="rtl"===document.documentElement.dir,r={backdrop:!0,keyboard:!0,focus:!0},l={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean"};class h extends class{constructor(e){e&&(this._element=e,t.setData(e,this.constructor.DATA_KEY,this))}dispose(){t.removeData(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(e){return t.getData(e,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta1"}}{constructor(t,e){super(t),this._config=this._getConfig(e),this._dialog=s.findOne(".modal-dialog",t),this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollbarWidth=0}static get Default(){return r}static get DATA_KEY(){return"bs.modal"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){if(this._isShown||this._isTransitioning)return;this._element.classList.contains("fade")&&(this._isTransitioning=!0);const i=e.trigger(this._element,"show.bs.modal",{relatedTarget:t});this._isShown||i.defaultPrevented||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),e.on(this._element,"click.dismiss.bs.modal",'[data-bs-dismiss="modal"]',t=>this.hide(t)),e.on(this._dialog,"mousedown.dismiss.bs.modal",()=>{e.one(this._element,"mouseup.dismiss.bs.modal",t=>{t.target===this._element&&(this._ignoreBackdropClick=!0)})}),this._showBackdrop(()=>this._showElement(t)))}hide(t){if(t&&t.preventDefault(),!this._isShown||this._isTransitioning)return;if(e.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const i=this._element.classList.contains("fade");if(i&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),e.off(document,"focusin.bs.modal"),this._element.classList.remove("show"),e.off(this._element,"click.dismiss.bs.modal"),e.off(this._dialog,"mousedown.dismiss.bs.modal"),i){const t=o(this._element);e.one(this._element,"transitionend",t=>this._hideModal(t)),n(this._element,t)}else this._hideModal()}dispose(){[window,this._element,this._dialog].forEach(t=>e.off(t,".bs.modal")),super.dispose(),e.off(document,"focusin.bs.modal"),this._config=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._isTransitioning=null,this._scrollbarWidth=null}handleUpdate(){this._adjustDialog()}_getConfig(t){return((t,e,i)=>{Object.keys(i).forEach(t=>{const s=i[t],o=e[t],n=o&&((d=o)[0]||d).nodeType?"element":(t=>null==t?""+t:{}.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase())(o);var d;if(!new RegExp(s).test(n))throw new Error("modal".toUpperCase()+": "+`Option "${t}" provided type "${n}" `+`but expected type "${s}".`)})})(0,t={...r,...t},l),t}_showElement(t){const i=this._element.classList.contains("fade"),a=s.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,a&&(a.scrollTop=0),i&&d(this._element),this._element.classList.add("show"),this._config.focus&&this._enforceFocus();const r=()=>{this._config.focus&&this._element.focus(),this._isTransitioning=!1,e.trigger(this._element,"shown.bs.modal",{relatedTarget:t})};if(i){const t=o(this._dialog);e.one(this._dialog,"transitionend",r),n(this._dialog,t)}else r()}_enforceFocus(){e.off(document,"focusin.bs.modal"),e.on(document,"focusin.bs.modal",t=>{document===t.target||this._element===t.target||this._element.contains(t.target)||this._element.focus()})}_setEscapeEvent(){this._isShown?e.on(this._element,"keydown.dismiss.bs.modal",t=>{this._config.keyboard&&"Escape"===t.key?(t.preventDefault(),this.hide()):this._config.keyboard||"Escape"!==t.key||this._triggerBackdropTransition()}):e.off(this._element,"keydown.dismiss.bs.modal")}_setResizeEvent(){this._isShown?e.on(window,"resize.bs.modal",()=>this._adjustDialog()):e.off(window,"resize.bs.modal")}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._showBackdrop(()=>{document.body.classList.remove("modal-open"),this._resetAdjustments(),this._resetScrollbar(),e.trigger(this._element,"hidden.bs.modal")})}_removeBackdrop(){this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null}_showBackdrop(t){const i=this._element.classList.contains("fade")?"fade":"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className="modal-backdrop",i&&this._backdrop.classList.add(i),document.body.appendChild(this._backdrop),e.on(this._element,"click.dismiss.bs.modal",t=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"===this._config.backdrop?this._triggerBackdropTransition():this.hide())}),i&&d(this._backdrop),this._backdrop.classList.add("show"),!i)return void t();const s=o(this._backdrop);e.one(this._backdrop,"transitionend",t),n(this._backdrop,s)}else if(!this._isShown&&this._backdrop){this._backdrop.classList.remove("show");const i=()=>{this._removeBackdrop(),t()};if(this._element.classList.contains("fade")){const t=o(this._backdrop);e.one(this._backdrop,"transitionend",i),n(this._backdrop,t)}else i()}else t()}_triggerBackdropTransition(){if(e.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight;t||(this._element.style.overflowY="hidden"),this._element.classList.add("modal-static");const i=o(this._dialog);e.off(this._element,"transitionend"),e.one(this._element,"transitionend",()=>{this._element.classList.remove("modal-static"),t||(e.one(this._element,"transitionend",()=>{this._element.style.overflowY=""}),n(this._element,i))}),n(this._element,i),this._element.focus()}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight;(!this._isBodyOverflowing&&t&&!a||this._isBodyOverflowing&&!t&&a)&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),(this._isBodyOverflowing&&!t&&!a||!this._isBodyOverflowing&&t&&a)&&(this._element.style.paddingRight=this._scrollbarWidth+"px")}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}_checkScrollbar(){const t=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(t.left+t.right){const e=t.style.paddingRight,s=window.getComputedStyle(t)["padding-right"];i.setDataAttribute(t,"padding-right",e),t.style.paddingRight=Number.parseFloat(s)+this._scrollbarWidth+"px"}),s.find(".sticky-top").forEach(t=>{const e=t.style.marginRight,s=window.getComputedStyle(t)["margin-right"];i.setDataAttribute(t,"margin-right",e),t.style.marginRight=Number.parseFloat(s)-this._scrollbarWidth+"px"});const t=document.body.style.paddingRight,e=window.getComputedStyle(document.body)["padding-right"];i.setDataAttribute(document.body,"padding-right",t),document.body.style.paddingRight=Number.parseFloat(e)+this._scrollbarWidth+"px"}document.body.classList.add("modal-open")}_resetScrollbar(){s.find(".fixed-top, .fixed-bottom, .is-fixed, .sticky-top").forEach(t=>{const e=i.getDataAttribute(t,"padding-right");void 0!==e&&(i.removeDataAttribute(t,"padding-right"),t.style.paddingRight=e)}),s.find(".sticky-top").forEach(t=>{const e=i.getDataAttribute(t,"margin-right");void 0!==e&&(i.removeDataAttribute(t,"margin-right"),t.style.marginRight=e)});const t=i.getDataAttribute(document.body,"padding-right");void 0===t?document.body.style.paddingRight="":(i.removeDataAttribute(document.body,"padding-right"),document.body.style.paddingRight=t)}_getScrollbarWidth(){const t=document.createElement("div");t.className="modal-scrollbar-measure",document.body.appendChild(t);const e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}static jQueryInterface(e,s){return this.each((function(){let o=t.getData(this,"bs.modal");const n={...r,...i.getDataAttributes(this),..."object"==typeof e&&e?e:{}};if(o||(o=new h(this,n)),"string"==typeof e){if(void 0===o[e])throw new TypeError(`No method named "${e}"`);o[e](s)}}))}}var c;e.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(s){const o=(t=>{const e=(t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){const i=t.getAttribute("href");e=i&&"#"!==i?i.trim():null}return e})(this);return e?document.querySelector(e):null})();"A"!==this.tagName&&"AREA"!==this.tagName||s.preventDefault(),e.one(o,"show.bs.modal",t=>{t.defaultPrevented||e.one(o,"hidden.bs.modal",()=>{(t=>{if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){const e=getComputedStyle(t),i=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==i.display&&"hidden"!==e.visibility}return!1})(this)&&this.focus()})});let n=t.getData(o,"bs.modal");if(!n){const t={...i.getDataAttributes(o),...i.getDataAttributes(this)};n=new h(o,t)}n.show(this)})),c=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn.modal;t.fn.modal=h.jQueryInterface,t.fn.modal.Constructor=h,t.fn.modal.noConflict=()=>(t.fn.modal=e,h.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap.Modal=h;export default h; diff --git a/build/media_source/vendor/bs5/js/js/popover.es6.js b/build/media_source/vendor/bs5/js/js/popover.es6.js new file mode 100644 index 0000000000000..dacaacb51c625 --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/popover.es6.js @@ -0,0 +1,211 @@ +import Data from './dom/data.js'; +import SelectorEngine from './dom/selector-engine.js'; +import Tooltip from './tooltip.js'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): popover.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'popover'; +const DATA_KEY = 'bs.popover'; +const EVENT_KEY = `.${DATA_KEY}`; +const CLASS_PREFIX = 'bs-popover'; +const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g'); + +const Default = { + ...Tooltip.Default, + placement: 'right', + trigger: 'click', + content: '', + template: '' +}; + +const DefaultType = { + ...Tooltip.DefaultType, + content: '(string|element|function)' +}; + +const Event = { + HIDE: `hide${EVENT_KEY}`, + HIDDEN: `hidden${EVENT_KEY}`, + SHOW: `show${EVENT_KEY}`, + SHOWN: `shown${EVENT_KEY}`, + INSERTED: `inserted${EVENT_KEY}`, + CLICK: `click${EVENT_KEY}`, + FOCUSIN: `focusin${EVENT_KEY}`, + FOCUSOUT: `focusout${EVENT_KEY}`, + MOUSEENTER: `mouseenter${EVENT_KEY}`, + MOUSELEAVE: `mouseleave${EVENT_KEY}` +}; + +const CLASS_NAME_FADE = 'fade'; +const CLASS_NAME_SHOW = 'show'; + +const SELECTOR_TITLE = '.popover-header'; +const SELECTOR_CONTENT = '.popover-body'; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class Popover extends Tooltip { + // Getters + + static get Default() { + return Default + } + + static get NAME() { + return NAME + } + + static get DATA_KEY() { + return DATA_KEY + } + + static get Event() { + return Event + } + + static get EVENT_KEY() { + return EVENT_KEY + } + + static get DefaultType() { + return DefaultType + } + + // Overrides + + isWithContent() { + return this.getTitle() || this._getContent() + } + + setContent() { + const tip = this.getTipElement(); + + // we use append for html objects to maintain js events + this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle()); + let content = this._getContent(); + if (typeof content === 'function') { + content = content.call(this._element); + } + + this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content); + + tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW); + } + + // Private + + _addAttachmentClass(attachment) { + this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`); + } + + _getContent() { + return this._element.getAttribute('data-bs-content') || this.config.content + } + + _cleanTipClass() { + const tip = this.getTipElement(); + const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX); + if (tabClass !== null && tabClass.length > 0) { + tabClass.map(token => token.trim()) + .forEach(tClass => tip.classList.remove(tClass)); + } + } + + // Static + + static jQueryInterface(config) { + return this.each(function () { + let data = Data.getData(this, DATA_KEY); + const _config = typeof config === 'object' ? config : null; + + if (!data && /dispose|hide/.test(config)) { + return + } + + if (!data) { + data = new Popover(this, _config); + Data.setData(this, DATA_KEY, data); + } + + if (typeof config === 'string') { + if (typeof data[config] === 'undefined') { + throw new TypeError(`No method named "${config}"`) + } + + data[config](); + } + }) + } +} + +/** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + * add .Popover to jQuery only if jQuery is present + */ + +onDOMContentLoaded(() => { + const $ = getjQuery(); + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Popover.jQueryInterface; + $.fn[NAME].Constructor = Popover; + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Popover.jQueryInterface + }; + } +}); + +window.Joomla = window.Joomla || {}; +window.Joomla.Bootstrap.Popover = Popover; + +export default Popover; diff --git a/build/media_source/vendor/bs5/js/js/popover.es6.min.js b/build/media_source/vendor/bs5/js/js/popover.es6.min.js new file mode 100644 index 0000000000000..6ec5752e9d3ef --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/popover.es6.min.js @@ -0,0 +1 @@ +import t from"./dom/data.js";import e from"./dom/selector-engine.js";import o from"./tooltip.js";document.documentElement.dir;const n="popover",s=new RegExp("(^|\\s)bs-popover\\S+","g"),r={...o.Default,placement:"right",trigger:"click",content:"",template:''},i={...o.DefaultType,content:"(string|element|function)"},p={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"};class a extends o{static get Default(){return r}static get NAME(){return n}static get DATA_KEY(){return"bs.popover"}static get Event(){return p}static get EVENT_KEY(){return".bs.popover"}static get DefaultType(){return i}isWithContent(){return this.getTitle()||this._getContent()}setContent(){const t=this.getTipElement();this.setElementContent(e.findOne(".popover-header",t),this.getTitle());let o=this._getContent();"function"==typeof o&&(o=o.call(this._element)),this.setElementContent(e.findOne(".popover-body",t),o),t.classList.remove("fade","show")}_addAttachmentClass(t){this.getTipElement().classList.add("bs-popover-"+this.updateAttachment(t))}_getContent(){return this._element.getAttribute("data-bs-content")||this.config.content}_cleanTipClass(){const t=this.getTipElement(),e=t.getAttribute("class").match(s);null!==e&&e.length>0&&e.map(t=>t.trim()).forEach(e=>t.classList.remove(e))}static jQueryInterface(e){return this.each((function(){let o=t.getData(this,"bs.popover");const n="object"==typeof e?e:null;if((o||!/dispose|hide/.test(e))&&(o||(o=new a(this,n),t.setData(this,"bs.popover",o)),"string"==typeof e)){if(void 0===o[e])throw new TypeError(`No method named "${e}"`);o[e]()}}))}}var c;c=()=>{const t=(()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null})();if(t){const e=t.fn[n];t.fn[n]=a.jQueryInterface,t.fn[n].Constructor=a,t.fn[n].noConflict=()=>(t.fn[n]=e,a.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c(),window.Joomla=window.Joomla||{},window.Joomla.Bootstrap.Popover=a;export default a; diff --git a/build/media_source/vendor/bs5/js/js/popper/index.js b/build/media_source/vendor/bs5/js/js/popper/index.js new file mode 100644 index 0000000000000..63e59a672bdee --- /dev/null +++ b/build/media_source/vendor/bs5/js/js/popper/index.js @@ -0,0 +1 @@ +var e="top",t="bottom",n="right",r="left",o="auto",i=[e,t,n,r],a="start",s="end",f="clippingParents",c="viewport",p="popper",u="reference",d=i.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),l=[].concat(i,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),m="beforeRead",h="read",v="afterRead",g="beforeMain",b="main",y="afterMain",O="beforeWrite",w="write",x="afterWrite",j=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function E(e){return e?(e.nodeName||"").toLowerCase():null}function M(e){if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function D(e){return e instanceof M(e).Element||e instanceof Element}function P(e){return e instanceof M(e).HTMLElement||e instanceof HTMLElement}var L={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];P(o)&&E(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});P(r)&&E(r)&&(Object.assign(r.style,i),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]};function k(e){return e.split("-")[0]}function W(e){return{x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}}function B(e,t){var n,r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&((n=r)instanceof M(n).ShadowRoot||n instanceof ShadowRoot)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function R(e){return M(e).getComputedStyle(e)}function A(e){return["table","td","th"].indexOf(E(e))>=0}function H(e){return((D(e)?e.ownerDocument:e.document)||window.document).documentElement}function S(e){return"html"===E(e)?e:e.assignedSlot||e.parentNode||e.host||H(e)}function T(e){if(!P(e)||"fixed"===R(e).position)return null;var t=e.offsetParent;if(t){var n=H(t);if("body"===E(t)&&"static"===R(t).position&&"static"!==R(n).position)return n}return t}function q(e){for(var t=M(e),n=T(e);n&&A(n)&&"static"===R(n).position;)n=T(n);return n&&"body"===E(n)&&"static"===R(n).position?t:n||function(e){for(var t=S(e);P(t)&&["html","body"].indexOf(E(t))<0;){var n=R(t);if("none"!==n.transform||"none"!==n.perspective||n.willChange&&"auto"!==n.willChange)return t;t=t.parentNode}return null}(e)||t}function C(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function N(e,t,n){return Math.max(e,Math.min(t,n))}function V(e){return Object.assign(Object.assign({},{top:0,right:0,bottom:0,left:0}),e)}function I(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}var U={name:"arrow",enabled:!0,phase:"main",fn:function(o){var i,a=o.state,s=o.name,f=a.elements.arrow,c=a.modifiersData.popperOffsets,p=k(a.placement),u=C(p),d=[r,n].indexOf(p)>=0?"height":"width";if(f&&c){var l=a.modifiersData[s+"#persistent"].padding,m=W(f),h="y"===u?e:r,v="y"===u?t:n,g=a.rects.reference[d]+a.rects.reference[u]-c[u]-a.rects.popper[d],b=c[u]-a.rects.reference[u],y=q(f),O=y?"y"===u?y.clientHeight||0:y.clientWidth||0:0,w=g/2-b/2,x=l[h],j=O-m[d]-l[v],E=O/2-m[d]/2+w,M=N(x,E,j),D=u;a.modifiersData[s]=((i={})[D]=M,i.centerOffset=M-E,i)}},effect:function(e){var t=e.state,n=e.options,r=e.name,o=n.element,a=void 0===o?"[data-popper-arrow]":o,s=n.padding,f=void 0===s?0:s;null!=a&&("string"!=typeof a||(a=t.elements.popper.querySelector(a)))&&B(t.elements.popper,a)&&(t.elements.arrow=a,t.modifiersData[r+"#persistent"]={padding:V("number"!=typeof f?f:I(f,i))})},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},z={top:"auto",right:"auto",bottom:"auto",left:"auto"};function _(o){var i,a=o.popper,s=o.popperRect,f=o.placement,c=o.offsets,p=o.position,u=o.gpuAcceleration,d=o.adaptive,l=o.roundOffsets?function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:Math.round(t*r)/r||0,y:Math.round(n*r)/r||0}}(c):c,m=l.x,h=void 0===m?0:m,v=l.y,g=void 0===v?0:v,b=c.hasOwnProperty("x"),y=c.hasOwnProperty("y"),O=r,w=e,x=window;if(d){var j=q(a);j===M(a)&&(j=H(a)),f===e&&(w=t,g-=j.clientHeight-s.height,g*=u?1:-1),f===r&&(O=n,h-=j.clientWidth-s.width,h*=u?1:-1)}var E,D=Object.assign({position:p},d&&z);return u?Object.assign(Object.assign({},D),{},((E={})[w]=y?"0":"",E[O]=b?"0":"",E.transform=(x.devicePixelRatio||1)<2?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",E)):Object.assign(Object.assign({},D),{},((i={})[w]=y?g+"px":"",i[O]=b?h+"px":"",i.transform="",i))}var F={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,f=void 0===s||s,c={placement:k(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign(Object.assign({},t.styles.popper),_(Object.assign(Object.assign({},c),{},{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:f})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign(Object.assign({},t.styles.arrow),_(Object.assign(Object.assign({},c),{},{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-placement":t.placement})},data:{}},X={passive:!0},Y={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,i=void 0===o||o,a=r.resize,s=void 0===a||a,f=M(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&c.forEach((function(e){e.addEventListener("scroll",n.update,X)})),s&&f.addEventListener("resize",n.update,X),function(){i&&c.forEach((function(e){e.removeEventListener("scroll",n.update,X)})),s&&f.removeEventListener("resize",n.update,X)}},data:{}},G={left:"right",right:"left",bottom:"top",top:"bottom"};function J(e){return e.replace(/left|right|bottom|top/g,(function(e){return G[e]}))}var K={start:"end",end:"start"};function Q(e){return e.replace(/start|end/g,(function(e){return K[e]}))}function Z(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function $(e){var t=M(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function ee(e){return Z(H(e)).left+$(e).scrollLeft}function te(e){var t=R(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function ne(e,t){void 0===t&&(t=[]);var n=function e(t){return["html","body","#document"].indexOf(E(t))>=0?t.ownerDocument.body:P(t)&&te(t)?t:e(S(t))}(e),r="body"===E(n),o=M(n),i=r?[o].concat(o.visualViewport||[],te(n)?n:[]):n,a=t.concat(i);return r?a:a.concat(ne(S(i)))}function re(e){return Object.assign(Object.assign({},e),{},{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function oe(e,t){return"viewport"===t?re(function(e){var t=M(e),n=H(e),r=t.visualViewport,o=n.clientWidth,i=n.clientHeight,a=0,s=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:o,height:i,x:a+ee(e),y:s}}(e)):P(t)?function(e){var t=Z(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):re(function(e){var t=H(e),n=$(e),r=e.ownerDocument.body,o=Math.max(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),i=Math.max(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-n.scrollLeft+ee(e),s=-n.scrollTop;return"rtl"===R(r||t).direction&&(a+=Math.max(t.clientWidth,r?r.clientWidth:0)-o),{width:o,height:i,x:a,y:s}}(H(e)))}function ie(e,t,n){var r="clippingParents"===t?function(e){var t=ne(S(e)),n=["absolute","fixed"].indexOf(R(e).position)>=0&&P(e)?q(e):e;return D(n)?t.filter((function(e){return D(e)&&B(e,n)&&"body"!==E(e)})):[]}(e):[].concat(t),o=[].concat(r,[n]),i=o[0],a=o.reduce((function(t,n){var r=oe(e,n);return t.top=Math.max(r.top,t.top),t.right=Math.min(r.right,t.right),t.bottom=Math.min(r.bottom,t.bottom),t.left=Math.max(r.left,t.left),t}),oe(e,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ae(e){return e.split("-")[1]}function se(o){var i,a=o.reference,s=o.element,f=o.placement,c=f?k(f):null,p=f?ae(f):null,u=a.x+a.width/2-s.width/2,d=a.y+a.height/2-s.height/2;switch(c){case e:i={x:u,y:a.y-s.height};break;case t:i={x:u,y:a.y+a.height};break;case n:i={x:a.x+a.width,y:d};break;case r:i={x:a.x-s.width,y:d};break;default:i={x:a.x,y:a.y}}var l=c?C(c):null;if(null!=l){var m="y"===l?"height":"width";switch(p){case"start":i[l]=i[l]-(a[m]/2-s[m]/2);break;case"end":i[l]=i[l]+(a[m]/2-s[m]/2)}}return i}function fe(r,o){void 0===o&&(o={});var a=o,s=a.placement,f=void 0===s?r.placement:s,c=a.boundary,p=void 0===c?"clippingParents":c,u=a.rootBoundary,d=void 0===u?"viewport":u,l=a.elementContext,m=void 0===l?"popper":l,h=a.altBoundary,v=void 0!==h&&h,g=a.padding,b=void 0===g?0:g,y=V("number"!=typeof b?b:I(b,i)),O="popper"===m?"reference":"popper",w=r.elements.reference,x=r.rects.popper,j=r.elements[v?O:m],E=ie(D(j)?j:j.contextElement||H(r.elements.popper),p,d),M=Z(w),P=se({reference:M,element:x,strategy:"absolute",placement:f}),L=re(Object.assign(Object.assign({},x),P)),k="popper"===m?L:M,W={top:E.top-k.top+y.top,bottom:k.bottom-E.bottom+y.bottom,left:E.left-k.left+y.left,right:k.right-E.right+y.right},B=r.modifiersData.offset;if("popper"===m&&B){var R=B[f];Object.keys(W).forEach((function(r){var o=[n,t].indexOf(r)>=0?1:-1,i=[e,t].indexOf(r)>=0?"y":"x";W[r]+=R[i]*o}))}return W}function ce(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,a=n.rootBoundary,s=n.padding,f=n.flipVariations,c=n.allowedAutoPlacements,p=void 0===c?l:c,u=ae(r),m=u?f?d:d.filter((function(e){return ae(e)===u})):i,h=m.filter((function(e){return p.indexOf(e)>=0}));0===h.length&&(h=m);var v=h.reduce((function(t,n){return t[n]=fe(e,{placement:n,boundary:o,rootBoundary:a,padding:s})[k(n)],t}),{});return Object.keys(v).sort((function(e,t){return v[e]-v[t]}))}var pe={name:"flip",enabled:!0,phase:"main",fn:function(o){var i=o.state,a=o.options,s=o.name;if(!i.modifiersData[s]._skip){for(var f=a.mainAxis,c=void 0===f||f,p=a.altAxis,u=void 0===p||p,d=a.fallbackPlacements,l=a.padding,m=a.boundary,h=a.rootBoundary,v=a.altBoundary,g=a.flipVariations,b=void 0===g||g,y=a.allowedAutoPlacements,O=i.options.placement,w=k(O),x=d||(w!==O&&b?function(e){if("auto"===k(e))return[];var t=J(e);return[Q(e),t,Q(t)]}(O):[J(O)]),j=[O].concat(x).reduce((function(e,t){return e.concat("auto"===k(t)?ce(i,{placement:t,boundary:m,rootBoundary:h,padding:l,flipVariations:b,allowedAutoPlacements:y}):t)}),[]),E=i.rects.reference,M=i.rects.popper,D=new Map,P=!0,L=j[0],W=0;W=0,S=H?"width":"height",T=fe(i,{placement:B,boundary:m,rootBoundary:h,altBoundary:v,padding:l}),q=H?A?n:r:A?t:e;E[S]>M[S]&&(q=J(q));var C=J(q),N=[];if(c&&N.push(T[R]<=0),u&&N.push(T[q]<=0,T[C]<=0),N.every((function(e){return e}))){L=B,P=!1;break}D.set(B,N)}if(P)for(var V=function(e){var t=j.find((function(t){var n=D.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return L=t,"break"},I=b?3:1;I>0&&"break"!==V(I);I--);i.placement!==L&&(i.modifiersData[s]._skip=!0,i.placement=L,i.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function ue(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function de(o){return[e,n,t,r].some((function(e){return o[e]>=0}))}var le={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=fe(t,{elementContext:"reference"}),s=fe(t,{altBoundary:!0}),f=ue(a,r),c=ue(s,o,i),p=de(f),u=de(c);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-reference-hidden":p,"data-popper-escaped":u})}},me={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var o=t.state,i=t.options,a=t.name,s=i.offset,f=void 0===s?[0,0]:s,c=l.reduce((function(t,i){return t[i]=function(t,o,i){var a=k(t),s=[r,e].indexOf(a)>=0?-1:1,f="function"==typeof i?i(Object.assign(Object.assign({},o),{},{placement:t})):i,c=f[0],p=f[1];return c=c||0,p=(p||0)*s,[r,n].indexOf(a)>=0?{x:p,y:c}:{x:c,y:p}}(i,o.rects,f),t}),{}),p=c[o.placement],u=p.x,d=p.y;null!=o.modifiersData.popperOffsets&&(o.modifiersData.popperOffsets.x+=u,o.modifiersData.popperOffsets.y+=d),o.modifiersData[a]=c}},he={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=se({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},ve={name:"preventOverflow",enabled:!0,phase:"main",fn:function(o){var i=o.state,a=o.options,s=o.name,f=a.mainAxis,c=void 0===f||f,p=a.altAxis,u=void 0!==p&&p,d=a.boundary,l=a.rootBoundary,m=a.altBoundary,h=a.padding,v=a.tether,g=void 0===v||v,b=a.tetherOffset,y=void 0===b?0:b,O=fe(i,{boundary:d,rootBoundary:l,padding:h,altBoundary:m}),w=k(i.placement),x=ae(i.placement),j=!x,E=C(w),M="x"===E?"y":"x",D=i.modifiersData.popperOffsets,P=i.rects.reference,L=i.rects.popper,B="function"==typeof y?y(Object.assign(Object.assign({},i.rects),{},{placement:i.placement})):y,R={x:0,y:0};if(D){if(c){var A="y"===E?e:r,H="y"===E?t:n,S="y"===E?"height":"width",T=D[E],V=D[E]+O[A],I=D[E]-O[H],U=g?-L[S]/2:0,z="start"===x?P[S]:L[S],_="start"===x?-L[S]:-P[S],F=i.elements.arrow,X=g&&F?W(F):{width:0,height:0},Y=i.modifiersData["arrow#persistent"]?i.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},G=Y[A],J=Y[H],K=N(0,P[S],X[S]),Q=j?P[S]/2-U-K-G-B:z-K-G-B,Z=j?-P[S]/2+U+K+J+B:_+K+J+B,$=i.elements.arrow&&q(i.elements.arrow),ee=$?"y"===E?$.clientTop||0:$.clientLeft||0:0,te=i.modifiersData.offset?i.modifiersData.offset[i.placement][E]:0,ne=D[E]+Q-te-ee,re=D[E]+Z-te,oe=N(g?Math.min(V,ne):V,T,g?Math.max(I,re):I);D[E]=oe,R[E]=oe-T}if(u){var ie="x"===E?e:r,se="x"===E?t:n,ce=D[M],pe=N(ce+O[ie],ce,ce-O[se]);D[M]=pe,R[M]=pe-ce}i.modifiersData[s]=R}},requiresIfExists:["offset"]};function ge(e,t,n){void 0===n&&(n=!1);var r,o,i=H(t),a=Z(e),s=P(t),f={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(s||!s&&!n)&&(("body"!==E(t)||te(i))&&(f=(r=t)!==M(r)&&P(r)?{scrollLeft:(o=r).scrollLeft,scrollTop:o.scrollTop}:$(r)),P(t)?((c=Z(t)).x+=t.clientLeft,c.y+=t.clientTop):i&&(c.x=ee(i))),{x:a.left+f.scrollLeft-c.x,y:a.top+f.scrollTop-c.y,width:a.width,height:a.height}}var be={placement:"bottom",modifiers:[],strategy:"absolute"};function ye(){for(var e=arguments.length,t=new Array(e),n=0;n { + if (obj === null || obj === undefined) { + return `${obj}` + } + + return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() +}; + +/** + * -------------------------------------------------------------------------- + * Public Util Api + * -------------------------------------------------------------------------- + */ + +const getUID = prefix => { + do { + prefix += Math.floor(Math.random() * MAX_UID); + } while (document.getElementById(prefix)) + + return prefix +}; + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target'); + + if (!selector || selector === '#') { + const hrefAttr = element.getAttribute('href'); + + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; + } + + return selector +}; + +const getSelectorFromElement = element => { + const selector = getSelector(element); + + if (selector) { + return document.querySelector(selector) ? selector : null + } + + return null +}; + +const isElement = obj => (obj[0] || obj).nodeType; + +const typeCheckConfig = (componentName, config, configTypes) => { + Object.keys(configTypes).forEach(property => { + const expectedTypes = configTypes[property]; + const value = config[property]; + const valueType = value && isElement(value) ? + 'element' : + toType(value); + + if (!new RegExp(expectedTypes).test(valueType)) { + throw new Error( + `${componentName.toUpperCase()}: ` + + `Option "${property}" provided type "${valueType}" ` + + `but expected type "${expectedTypes}".`) + } + }); +}; + +const getjQuery = () => { + const { jQuery } = window; + + if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return jQuery + } + + return null +}; + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } +}; + +const isRTL = document.documentElement.dir === 'rtl'; + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const VERSION = '5.0.0-beta1'; + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get VERSION() { + return VERSION + } +} + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-beta1): scrollspy.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'scrollspy'; +const DATA_KEY = 'bs.scrollspy'; +const EVENT_KEY = `.${DATA_KEY}`; +const DATA_API_KEY = '.data-api'; + +const Default = { + offset: 10, + method: 'auto', + target: '' +}; + +const DefaultType = { + offset: 'number', + method: 'string', + target: '(string|element)' +}; + +const EVENT_ACTIVATE = `activate${EVENT_KEY}`; +const EVENT_SCROLL = `scroll${EVENT_KEY}`; +const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`; + +const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; +const CLASS_NAME_ACTIVE = 'active'; + +const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; +const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; +const SELECTOR_NAV_LINKS = '.nav-link'; +const SELECTOR_NAV_ITEMS = '.nav-item'; +const SELECTOR_LIST_ITEMS = '.list-group-item'; +const SELECTOR_DROPDOWN = '.dropdown'; +const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; + +const METHOD_OFFSET = 'offset'; +const METHOD_POSITION = 'position'; + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class ScrollSpy extends BaseComponent { + constructor(element, config) { + super(element); + this._scrollElement = element.tagName === 'BODY' ? window : element; + this._config = this._getConfig(config); + this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`; + this._offsets = []; + this._targets = []; + this._activeTarget = null; + this._scrollHeight = 0; + + EventHandler.on(this._scrollElement, EVENT_SCROLL, event => this._process(event)); + + this.refresh(); + this._process(); + } + + // Getters + + static get Default() { + return Default + } + + static get DATA_KEY() { + return DATA_KEY + } + + // Public + + refresh() { + const autoMethod = this._scrollElement === this._scrollElement.window ? + METHOD_OFFSET : + METHOD_POSITION; + + const offsetMethod = this._config.method === 'auto' ? + autoMethod : + this._config.method; + + const offsetBase = offsetMethod === METHOD_POSITION ? + this._getScrollTop() : + 0; + + this._offsets = []; + this._targets = []; + this._scrollHeight = this._getScrollHeight(); + + const targets = SelectorEngine.find(this._selector); + + targets.map(element => { + const targetSelector = getSelectorFromElement(element); + const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null; + + if (target) { + const targetBCR = target.getBoundingClientRect(); + if (targetBCR.width || targetBCR.height) { + return [ + Manipulator[offsetMethod](target).top + offsetBase, + targetSelector + ] + } + } + + return null + }) + .filter(item => item) + .sort((a, b) => a[0] - b[0]) + .forEach(item => { + this._offsets.push(item[0]); + this._targets.push(item[1]); + }); + } + + dispose() { + super.dispose(); + EventHandler.off(this._scrollElement, EVENT_KEY); + + this._scrollElement = null; + this._config = null; + this._selector = null; + this._offsets = null; + this._targets = null; + this._activeTarget = null; + this._scrollHeight = null; + } + + // Private + + _getConfig(config) { + config = { + ...Default, + ...(typeof config === 'object' && config ? config : {}) + }; + + if (typeof config.target !== 'string' && isElement(config.target)) { + let { id } = config.target; + if (!id) { + id = getUID(NAME); + config.target.id = id; + } + + config.target = `#${id}`; + } + + typeCheckConfig(NAME, config, DefaultType); + + return config + } + + _getScrollTop() { + return this._scrollElement === window ? + this._scrollElement.pageYOffset : + this._scrollElement.scrollTop + } + + _getScrollHeight() { + return this._scrollElement.scrollHeight || Math.max( + document.body.scrollHeight, + document.documentElement.scrollHeight + ) + } + + _getOffsetHeight() { + return this._scrollElement === window ? + window.innerHeight : + this._scrollElement.getBoundingClientRect().height + } + + _process() { + const scrollTop = this._getScrollTop() + this._config.offset; + const scrollHeight = this._getScrollHeight(); + const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); + + if (this._scrollHeight !== scrollHeight) { + this.refresh(); + } + + if (scrollTop >= maxScroll) { + const target = this._targets[this._targets.length - 1]; + + if (this._activeTarget !== target) { + this._activate(target); + } + + return + } + + if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { + this._activeTarget = null; + this._clear(); + return + } + + for (let i = this._offsets.length; i--;) { + const isActiveTarget = this._activeTarget !== this._targets[i] && + scrollTop >= this._offsets[i] && + (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); + + if (isActiveTarget) { + this._activate(this._targets[i]); + } + } + } + + _activate(target) { + this._activeTarget = target; + + this._clear(); + + const queries = this._selector.split(',') + .map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`); + + const link = SelectorEngine.findOne(queries.join(',')); + + if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { + SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)) + .classList.add(CLASS_NAME_ACTIVE); + + link.classList.add(CLASS_NAME_ACTIVE); + } else { + // Set triggered link as active + link.classList.add(CLASS_NAME_ACTIVE); + + SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP) + .forEach(listGroup => { + // Set triggered links parents as active + // With both
    and