@openeuropa/bcl-bootstrap 0.14.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/build-plugins.js +77 -160
- package/bootstrap-icons.js +211 -1
- package/js/dist/alert.js +6 -137
- package/js/dist/alert.js.map +1 -1
- package/js/dist/base-component.js +7 -109
- package/js/dist/base-component.js.map +1 -1
- package/js/dist/button.js +5 -65
- package/js/dist/button.js.map +1 -1
- package/js/dist/carousel.js +13 -190
- package/js/dist/carousel.js.map +1 -1
- package/js/dist/collapse.js +12 -170
- package/js/dist/collapse.js.map +1 -1
- package/js/dist/dom/data.js +0 -5
- package/js/dist/dom/data.js.map +1 -1
- package/js/dist/dom/event-handler.js +5 -29
- package/js/dist/dom/event-handler.js.map +1 -1
- package/js/dist/dom/manipulator.js +0 -5
- package/js/dist/dom/manipulator.js.map +1 -1
- package/js/dist/dom/selector-engine.js +5 -53
- package/js/dist/dom/selector-engine.js.map +1 -1
- package/js/dist/dropdown.js +23 -212
- package/js/dist/dropdown.js.map +1 -1
- package/js/dist/modal.js +18 -611
- package/js/dist/modal.js.map +1 -1
- package/js/dist/offcanvas.js +19 -610
- package/js/dist/offcanvas.js.map +1 -1
- package/js/dist/popover.js +5 -65
- package/js/dist/popover.js.map +1 -1
- package/js/dist/scrollspy.js +8 -147
- package/js/dist/scrollspy.js.map +1 -1
- package/js/dist/tab.js +8 -127
- package/js/dist/tab.js.map +1 -1
- package/js/dist/toast.js +8 -185
- package/js/dist/toast.js.map +1 -1
- package/js/dist/tooltip.js +18 -277
- package/js/dist/tooltip.js.map +1 -1
- package/js/dist/util/backdrop.js +138 -0
- package/js/dist/util/backdrop.js.map +1 -0
- package/js/dist/util/component-functions.js +42 -0
- package/js/dist/util/component-functions.js.map +1 -0
- package/js/dist/util/focustrap.js +118 -0
- package/js/dist/util/focustrap.js.map +1 -0
- package/js/dist/util/index.js +342 -0
- package/js/dist/util/index.js.map +1 -0
- package/js/dist/util/sanitizer.js +125 -0
- package/js/dist/util/sanitizer.js.map +1 -0
- package/js/dist/util/scrollbar.js +119 -0
- package/js/dist/util/scrollbar.js.map +1 -0
- package/package.json +4 -3
- package/plugins/alert.js +0 -230
- package/plugins/alert.js.map +0 -1
- package/plugins/base-component.js +0 -178
- package/plugins/base-component.js.map +0 -1
- package/plugins/button.js +0 -141
- package/plugins/button.js.map +0 -1
- package/plugins/carousel.js +0 -738
- package/plugins/carousel.js.map +0 -1
- package/plugins/collapse.js +0 -490
- package/plugins/collapse.js.map +0 -1
- package/plugins/dom/data.js +0 -64
- package/plugins/dom/data.js.map +0 -1
- package/plugins/dom/event-handler.js +0 -317
- package/plugins/dom/event-handler.js.map +0 -1
- package/plugins/dom/manipulator.js +0 -84
- package/plugins/dom/manipulator.js.map +0 -1
- package/plugins/dom/selector-engine.js +0 -123
- package/plugins/dom/selector-engine.js.map +0 -1
- package/plugins/dropdown.js +0 -682
- package/plugins/dropdown.js.map +0 -1
- package/plugins/modal.js +0 -1037
- package/plugins/modal.js.map +0 -1
- package/plugins/popover.js +0 -179
- package/plugins/popover.js.map +0 -1
- package/plugins/scrollspy.js +0 -386
- package/plugins/scrollspy.js.map +0 -1
- package/plugins/tab.js +0 -328
- package/plugins/tab.js.map +0 -1
- package/plugins/toast.js +0 -418
- package/plugins/toast.js.map +0 -1
- package/plugins/tooltip.js +0 -1001
- package/plugins/tooltip.js.map +0 -1
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.EventHandler));
|
|
5
|
-
})(this, (function (Data, EventHandler) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
|
10
|
-
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* --------------------------------------------------------------------------
|
|
14
|
-
* Bootstrap (v5.1.3): util/index.js
|
|
15
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
-
* --------------------------------------------------------------------------
|
|
17
|
-
*/
|
|
18
|
-
const MILLISECONDS_MULTIPLIER = 1000;
|
|
19
|
-
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
|
20
|
-
|
|
21
|
-
const getTransitionDurationFromElement = element => {
|
|
22
|
-
if (!element) {
|
|
23
|
-
return 0;
|
|
24
|
-
} // Get transition-duration of the element
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
let {
|
|
28
|
-
transitionDuration,
|
|
29
|
-
transitionDelay
|
|
30
|
-
} = window.getComputedStyle(element);
|
|
31
|
-
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
|
32
|
-
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
|
33
|
-
|
|
34
|
-
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
35
|
-
return 0;
|
|
36
|
-
} // If multiple durations are defined, take the first
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
transitionDuration = transitionDuration.split(',')[0];
|
|
40
|
-
transitionDelay = transitionDelay.split(',')[0];
|
|
41
|
-
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const triggerTransitionEnd = element => {
|
|
45
|
-
element.dispatchEvent(new Event(TRANSITION_END));
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const isElement = obj => {
|
|
49
|
-
if (!obj || typeof obj !== 'object') {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (typeof obj.jquery !== 'undefined') {
|
|
54
|
-
obj = obj[0];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return typeof obj.nodeType !== 'undefined';
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const getElement = obj => {
|
|
61
|
-
if (isElement(obj)) {
|
|
62
|
-
// it's a jQuery object or a node element
|
|
63
|
-
return obj.jquery ? obj[0] : obj;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (typeof obj === 'string' && obj.length > 0) {
|
|
67
|
-
return document.querySelector(obj);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return null;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const execute = callback => {
|
|
74
|
-
if (typeof callback === 'function') {
|
|
75
|
-
callback();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
|
|
80
|
-
if (!waitForTransition) {
|
|
81
|
-
execute(callback);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const durationPadding = 5;
|
|
86
|
-
const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
|
87
|
-
let called = false;
|
|
88
|
-
|
|
89
|
-
const handler = ({
|
|
90
|
-
target
|
|
91
|
-
}) => {
|
|
92
|
-
if (target !== transitionElement) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
called = true;
|
|
97
|
-
transitionElement.removeEventListener(TRANSITION_END, handler);
|
|
98
|
-
execute(callback);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
transitionElement.addEventListener(TRANSITION_END, handler);
|
|
102
|
-
setTimeout(() => {
|
|
103
|
-
if (!called) {
|
|
104
|
-
triggerTransitionEnd(transitionElement);
|
|
105
|
-
}
|
|
106
|
-
}, emulatedDuration);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* --------------------------------------------------------------------------
|
|
111
|
-
* Bootstrap (v5.1.3): base-component.js
|
|
112
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
113
|
-
* --------------------------------------------------------------------------
|
|
114
|
-
*/
|
|
115
|
-
/**
|
|
116
|
-
* ------------------------------------------------------------------------
|
|
117
|
-
* Constants
|
|
118
|
-
* ------------------------------------------------------------------------
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
const VERSION = '5.1.3';
|
|
122
|
-
|
|
123
|
-
class BaseComponent {
|
|
124
|
-
constructor(element) {
|
|
125
|
-
element = getElement(element);
|
|
126
|
-
|
|
127
|
-
if (!element) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
this._element = element;
|
|
132
|
-
Data__default["default"].set(this._element, this.constructor.DATA_KEY, this);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
dispose() {
|
|
136
|
-
Data__default["default"].remove(this._element, this.constructor.DATA_KEY);
|
|
137
|
-
EventHandler__default["default"].off(this._element, this.constructor.EVENT_KEY);
|
|
138
|
-
Object.getOwnPropertyNames(this).forEach(propertyName => {
|
|
139
|
-
this[propertyName] = null;
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
_queueCallback(callback, element, isAnimated = true) {
|
|
144
|
-
executeAfterTransition(callback, element, isAnimated);
|
|
145
|
-
}
|
|
146
|
-
/** Static */
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
static getInstance(element) {
|
|
150
|
-
return Data__default["default"].get(getElement(element), this.DATA_KEY);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
static getOrCreateInstance(element, config = {}) {
|
|
154
|
-
return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
static get VERSION() {
|
|
158
|
-
return VERSION;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
static get NAME() {
|
|
162
|
-
throw new Error('You have to implement the static method "NAME", for each component!');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
static get DATA_KEY() {
|
|
166
|
-
return `bs.${this.NAME}`;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
static get EVENT_KEY() {
|
|
170
|
-
return `.${this.DATA_KEY}`;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return BaseComponent;
|
|
176
|
-
|
|
177
|
-
}));
|
|
178
|
-
//# sourceMappingURL=base-component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-component.js","sources":["../js/src/util/index.js","../js/src/base-component.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nconst toType = obj => {\n if (obj === null || obj === undefined) {\n return `${obj}`\n }\n\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst getUID = prefix => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-bs-target')\n\n if (!selector || selector === '#') {\n let hrefAttr = element.getAttribute('href')\n\n // The only valid content that could double as a selector are IDs or classes,\n // so everything starting with `#` or `.`. If a \"real\" URL is used as the selector,\n // `document.querySelector` will rightfully complain it is invalid.\n // See https://github.com/twbs/bootstrap/issues/32273\n if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {\n return null\n }\n\n // Just in case some CMS puts out a full URL with the anchor appended\n if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {\n hrefAttr = `#${hrefAttr.split('#')[1]}`\n }\n\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null\n }\n\n return selector\n}\n\nconst getSelectorFromElement = element => {\n const selector = getSelector(element)\n\n if (selector) {\n return document.querySelector(selector) ? selector : null\n }\n\n return null\n}\n\nconst getElementFromSelector = element => {\n const selector = getSelector(element)\n\n return selector ? document.querySelector(selector) : null\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element)\n\n const floatTransitionDuration = Number.parseFloat(transitionDuration)\n const floatTransitionDelay = Number.parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n element.dispatchEvent(new Event(TRANSITION_END))\n}\n\nconst isElement = obj => {\n if (!obj || typeof obj !== 'object') {\n return false\n }\n\n if (typeof obj.jquery !== 'undefined') {\n obj = obj[0]\n }\n\n return typeof obj.nodeType !== 'undefined'\n}\n\nconst getElement = obj => {\n if (isElement(obj)) { // it's a jQuery object or a node element\n return obj.jquery ? obj[0] : obj\n }\n\n if (typeof obj === 'string' && obj.length > 0) {\n return document.querySelector(obj)\n }\n\n return null\n}\n\nconst typeCheckConfig = (componentName, config, configTypes) => {\n Object.keys(configTypes).forEach(property => {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new TypeError(\n `${componentName.toUpperCase()}: Option \"${property}\" provided type \"${valueType}\" but expected type \"${expectedTypes}\".`\n )\n }\n })\n}\n\nconst isVisible = element => {\n if (!isElement(element) || element.getClientRects().length === 0) {\n return false\n }\n\n return getComputedStyle(element).getPropertyValue('visibility') === 'visible'\n}\n\nconst isDisabled = element => {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n return true\n }\n\n if (element.classList.contains('disabled')) {\n return true\n }\n\n if (typeof element.disabled !== 'undefined') {\n return element.disabled\n }\n\n return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => {}\n\n/**\n * Trick to restart an element's animation\n *\n * @param {HTMLElement} element\n * @return void\n *\n * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation\n */\nconst reflow = element => {\n // eslint-disable-next-line no-unused-expressions\n element.offsetHeight\n}\n\nconst getjQuery = () => {\n const { jQuery } = window\n\n if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {\n return jQuery\n }\n\n return null\n}\n\nconst DOMContentLoadedCallbacks = []\n\nconst onDOMContentLoaded = callback => {\n if (document.readyState === 'loading') {\n // add listener on the first call when the document is in loading state\n if (!DOMContentLoadedCallbacks.length) {\n document.addEventListener('DOMContentLoaded', () => {\n DOMContentLoadedCallbacks.forEach(callback => callback())\n })\n }\n\n DOMContentLoadedCallbacks.push(callback)\n } else {\n callback()\n }\n}\n\nconst isRTL = () => document.documentElement.dir === 'rtl'\n\nconst defineJQueryPlugin = plugin => {\n onDOMContentLoaded(() => {\n const $ = getjQuery()\n /* istanbul ignore if */\n if ($) {\n const name = plugin.NAME\n const JQUERY_NO_CONFLICT = $.fn[name]\n $.fn[name] = plugin.jQueryInterface\n $.fn[name].Constructor = plugin\n $.fn[name].noConflict = () => {\n $.fn[name] = JQUERY_NO_CONFLICT\n return plugin.jQueryInterface\n }\n }\n })\n}\n\nconst execute = callback => {\n if (typeof callback === 'function') {\n callback()\n }\n}\n\nconst executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {\n if (!waitForTransition) {\n execute(callback)\n return\n }\n\n const durationPadding = 5\n const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding\n\n let called = false\n\n const handler = ({ target }) => {\n if (target !== transitionElement) {\n return\n }\n\n called = true\n transitionElement.removeEventListener(TRANSITION_END, handler)\n execute(callback)\n }\n\n transitionElement.addEventListener(TRANSITION_END, handler)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(transitionElement)\n }\n }, emulatedDuration)\n}\n\n/**\n * Return the previous/next element of a list.\n *\n * @param {array} list The list of elements\n * @param activeElement The active element\n * @param shouldGetNext Choose to get next or previous element\n * @param isCycleAllowed\n * @return {Element|elem} The proper element\n */\nconst getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {\n let index = list.indexOf(activeElement)\n\n // if the element does not exist in the list return an element depending on the direction and if cycle is allowed\n if (index === -1) {\n return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0]\n }\n\n const listLength = list.length\n\n index += shouldGetNext ? 1 : -1\n\n if (isCycleAllowed) {\n index = (index + listLength) % listLength\n }\n\n return list[Math.max(0, Math.min(index, listLength - 1))]\n}\n\nexport {\n getElement,\n getUID,\n getSelectorFromElement,\n getElementFromSelector,\n getTransitionDurationFromElement,\n triggerTransitionEnd,\n isElement,\n typeCheckConfig,\n isVisible,\n isDisabled,\n findShadowRoot,\n noop,\n getNextActiveElement,\n reflow,\n getjQuery,\n onDOMContentLoaded,\n isRTL,\n defineJQueryPlugin,\n execute,\n executeAfterTransition\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data'\nimport {\n executeAfterTransition,\n getElement\n} from './util/index'\nimport EventHandler from './dom/event-handler'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst VERSION = '5.1.3'\n\nclass BaseComponent {\n constructor(element) {\n element = getElement(element)\n\n if (!element) {\n return\n }\n\n this._element = element\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n EventHandler.off(this._element, this.constructor.EVENT_KEY)\n\n Object.getOwnPropertyNames(this).forEach(propertyName => {\n this[propertyName] = null\n })\n }\n\n _queueCallback(callback, element, isAnimated = true) {\n executeAfterTransition(callback, element, isAnimated)\n }\n\n /** Static */\n\n static getInstance(element) {\n return Data.get(getElement(element), this.DATA_KEY)\n }\n\n static getOrCreateInstance(element, config = {}) {\n return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)\n }\n\n static get VERSION() {\n return VERSION\n }\n\n static get NAME() {\n throw new Error('You have to implement the static method \"NAME\", for each component!')\n }\n\n static get DATA_KEY() {\n return `bs.${this.NAME}`\n }\n\n static get EVENT_KEY() {\n return `.${this.DATA_KEY}`\n }\n}\n\nexport default BaseComponent\n"],"names":["MILLISECONDS_MULTIPLIER","TRANSITION_END","getTransitionDurationFromElement","element","transitionDuration","transitionDelay","window","getComputedStyle","floatTransitionDuration","Number","parseFloat","floatTransitionDelay","split","triggerTransitionEnd","dispatchEvent","Event","isElement","obj","jquery","nodeType","getElement","length","document","querySelector","execute","callback","executeAfterTransition","transitionElement","waitForTransition","durationPadding","emulatedDuration","called","handler","target","removeEventListener","addEventListener","setTimeout","VERSION","BaseComponent","constructor","_element","Data","set","DATA_KEY","dispose","remove","EventHandler","off","EVENT_KEY","Object","getOwnPropertyNames","forEach","propertyName","_queueCallback","isAnimated","getInstance","get","getOrCreateInstance","config","NAME","Error"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAGA,MAAMA,uBAAuB,GAAG,IAAhC;EACA,MAAMC,cAAc,GAAG,eAAvB;;EAkEA,MAAMC,gCAAgC,GAAGC,OAAO,IAAI;EAClD,MAAI,CAACA,OAAL,EAAc;EACZ,WAAO,CAAP;EACD,GAHiD;;;EAMlD,MAAI;EAAEC,IAAAA,kBAAF;EAAsBC,IAAAA;EAAtB,MAA0CC,MAAM,CAACC,gBAAP,CAAwBJ,OAAxB,CAA9C;EAEA,QAAMK,uBAAuB,GAAGC,MAAM,CAACC,UAAP,CAAkBN,kBAAlB,CAAhC;EACA,QAAMO,oBAAoB,GAAGF,MAAM,CAACC,UAAP,CAAkBL,eAAlB,CAA7B,CATkD;;EAYlD,MAAI,CAACG,uBAAD,IAA4B,CAACG,oBAAjC,EAAuD;EACrD,WAAO,CAAP;EACD,GAdiD;;;EAiBlDP,EAAAA,kBAAkB,GAAGA,kBAAkB,CAACQ,KAAnB,CAAyB,GAAzB,EAA8B,CAA9B,CAArB;EACAP,EAAAA,eAAe,GAAGA,eAAe,CAACO,KAAhB,CAAsB,GAAtB,EAA2B,CAA3B,CAAlB;EAEA,SAAO,CAACH,MAAM,CAACC,UAAP,CAAkBN,kBAAlB,IAAwCK,MAAM,CAACC,UAAP,CAAkBL,eAAlB,CAAzC,IAA+EL,uBAAtF;EACD,CArBD;;EAuBA,MAAMa,oBAAoB,GAAGV,OAAO,IAAI;EACtCA,EAAAA,OAAO,CAACW,aAAR,CAAsB,IAAIC,KAAJ,CAAUd,cAAV,CAAtB;EACD,CAFD;;EAIA,MAAMe,SAAS,GAAGC,GAAG,IAAI;EACvB,MAAI,CAACA,GAAD,IAAQ,OAAOA,GAAP,KAAe,QAA3B,EAAqC;EACnC,WAAO,KAAP;EACD;;EAED,MAAI,OAAOA,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AA8B,KAAKwC,QAAnC,CAAP;EACD;;EAEyB,SAAnBc,mBAAmB,CAACtD,OAAD,EAAUuD,MAAM,GAAG,EAAnB,EAAuB;EAC/C,WAAO,KAAKH,WAAL,CAAiBpD,OAAjB,KAA6B,IAAI,IAAJ,CAASA,OAAT,EAAkB,OAAOuD,MAAP,KAAkB,QAAlB,GAA6BA,MAA7B,GAAsC,IAAxD,CAApC;EACD;;EAEiB,aAAPrB,OAAO,GAAG;EACnB,WAAOA,OAAP;EACD;;EAEc,aAAJsB,IAAI,GAAG;EAChB,UAAM,IAAIC,KAAJ,CAAU,qEAAV,CAAN;EACD;;EAEkB,aAARjB,QAAQ,GAAG;EACpB,WAAQ,MAAK,KAAKgB,IAAK,EAAvB;EACD;;EAEmB,aAATX,SAAS,GAAG;EACrB,WAAQ,IAAG,KAAKL,QAAS,EAAzB;EACD;;EAjDiB;;;;;;;;"}
|
package/plugins/button.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./base-component.js')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.EventHandler, global.Base));
|
|
5
|
-
})(this, (function (EventHandler, BaseComponent) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
|
10
|
-
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* --------------------------------------------------------------------------
|
|
14
|
-
* Bootstrap (v5.1.3): util/index.js
|
|
15
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
-
* --------------------------------------------------------------------------
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const getjQuery = () => {
|
|
20
|
-
const {
|
|
21
|
-
jQuery
|
|
22
|
-
} = window;
|
|
23
|
-
|
|
24
|
-
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
|
25
|
-
return jQuery;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return null;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const DOMContentLoadedCallbacks = [];
|
|
32
|
-
|
|
33
|
-
const onDOMContentLoaded = callback => {
|
|
34
|
-
if (document.readyState === 'loading') {
|
|
35
|
-
// add listener on the first call when the document is in loading state
|
|
36
|
-
if (!DOMContentLoadedCallbacks.length) {
|
|
37
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
38
|
-
DOMContentLoadedCallbacks.forEach(callback => callback());
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
DOMContentLoadedCallbacks.push(callback);
|
|
43
|
-
} else {
|
|
44
|
-
callback();
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const defineJQueryPlugin = plugin => {
|
|
49
|
-
onDOMContentLoaded(() => {
|
|
50
|
-
const $ = getjQuery();
|
|
51
|
-
/* istanbul ignore if */
|
|
52
|
-
|
|
53
|
-
if ($) {
|
|
54
|
-
const name = plugin.NAME;
|
|
55
|
-
const JQUERY_NO_CONFLICT = $.fn[name];
|
|
56
|
-
$.fn[name] = plugin.jQueryInterface;
|
|
57
|
-
$.fn[name].Constructor = plugin;
|
|
58
|
-
|
|
59
|
-
$.fn[name].noConflict = () => {
|
|
60
|
-
$.fn[name] = JQUERY_NO_CONFLICT;
|
|
61
|
-
return plugin.jQueryInterface;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* --------------------------------------------------------------------------
|
|
69
|
-
* Bootstrap (v5.1.3): button.js
|
|
70
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
71
|
-
* --------------------------------------------------------------------------
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* ------------------------------------------------------------------------
|
|
75
|
-
* Constants
|
|
76
|
-
* ------------------------------------------------------------------------
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
const NAME = 'button';
|
|
80
|
-
const DATA_KEY = 'bs.button';
|
|
81
|
-
const EVENT_KEY = `.${DATA_KEY}`;
|
|
82
|
-
const DATA_API_KEY = '.data-api';
|
|
83
|
-
const CLASS_NAME_ACTIVE = 'active';
|
|
84
|
-
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
|
|
85
|
-
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
|
86
|
-
/**
|
|
87
|
-
* ------------------------------------------------------------------------
|
|
88
|
-
* Class Definition
|
|
89
|
-
* ------------------------------------------------------------------------
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
class Button extends BaseComponent__default["default"] {
|
|
93
|
-
// Getters
|
|
94
|
-
static get NAME() {
|
|
95
|
-
return NAME;
|
|
96
|
-
} // Public
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
toggle() {
|
|
100
|
-
// Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
|
|
101
|
-
this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
|
|
102
|
-
} // Static
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
static jQueryInterface(config) {
|
|
106
|
-
return this.each(function () {
|
|
107
|
-
const data = Button.getOrCreateInstance(this);
|
|
108
|
-
|
|
109
|
-
if (config === 'toggle') {
|
|
110
|
-
data[config]();
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* ------------------------------------------------------------------------
|
|
118
|
-
* Data Api implementation
|
|
119
|
-
* ------------------------------------------------------------------------
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
EventHandler__default["default"].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
const button = event.target.closest(SELECTOR_DATA_TOGGLE);
|
|
126
|
-
const data = Button.getOrCreateInstance(button);
|
|
127
|
-
data.toggle();
|
|
128
|
-
});
|
|
129
|
-
/**
|
|
130
|
-
* ------------------------------------------------------------------------
|
|
131
|
-
* jQuery
|
|
132
|
-
* ------------------------------------------------------------------------
|
|
133
|
-
* add .Button to jQuery only if jQuery is present
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
|
-
defineJQueryPlugin(Button);
|
|
137
|
-
|
|
138
|
-
return Button;
|
|
139
|
-
|
|
140
|
-
}));
|
|
141
|
-
//# sourceMappingURL=button.js.map
|
package/plugins/button.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../js/src/util/index.js","../js/src/button.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nconst toType = obj => {\n if (obj === null || obj === undefined) {\n return `${obj}`\n }\n\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst getUID = prefix => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-bs-target')\n\n if (!selector || selector === '#') {\n let hrefAttr = element.getAttribute('href')\n\n // The only valid content that could double as a selector are IDs or classes,\n // so everything starting with `#` or `.`. If a \"real\" URL is used as the selector,\n // `document.querySelector` will rightfully complain it is invalid.\n // See https://github.com/twbs/bootstrap/issues/32273\n if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {\n return null\n }\n\n // Just in case some CMS puts out a full URL with the anchor appended\n if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {\n hrefAttr = `#${hrefAttr.split('#')[1]}`\n }\n\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null\n }\n\n return selector\n}\n\nconst getSelectorFromElement = element => {\n const selector = getSelector(element)\n\n if (selector) {\n return document.querySelector(selector) ? selector : null\n }\n\n return null\n}\n\nconst getElementFromSelector = element => {\n const selector = getSelector(element)\n\n return selector ? document.querySelector(selector) : null\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element)\n\n const floatTransitionDuration = Number.parseFloat(transitionDuration)\n const floatTransitionDelay = Number.parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n element.dispatchEvent(new Event(TRANSITION_END))\n}\n\nconst isElement = obj => {\n if (!obj || typeof obj !== 'object') {\n return false\n }\n\n if (typeof obj.jquery !== 'undefined') {\n obj = obj[0]\n }\n\n return typeof obj.nodeType !== 'undefined'\n}\n\nconst getElement = obj => {\n if (isElement(obj)) { // it's a jQuery object or a node element\n return obj.jquery ? obj[0] : obj\n }\n\n if (typeof obj === 'string' && obj.length > 0) {\n return document.querySelector(obj)\n }\n\n return null\n}\n\nconst typeCheckConfig = (componentName, config, configTypes) => {\n Object.keys(configTypes).forEach(property => {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new TypeError(\n `${componentName.toUpperCase()}: Option \"${property}\" provided type \"${valueType}\" but expected type \"${expectedTypes}\".`\n )\n }\n })\n}\n\nconst isVisible = element => {\n if (!isElement(element) || element.getClientRects().length === 0) {\n return false\n }\n\n return getComputedStyle(element).getPropertyValue('visibility') === 'visible'\n}\n\nconst isDisabled = element => {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n return true\n }\n\n if (element.classList.contains('disabled')) {\n return true\n }\n\n if (typeof element.disabled !== 'undefined') {\n return element.disabled\n }\n\n return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => {}\n\n/**\n * Trick to restart an element's animation\n *\n * @param {HTMLElement} element\n * @return void\n *\n * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation\n */\nconst reflow = element => {\n // eslint-disable-next-line no-unused-expressions\n element.offsetHeight\n}\n\nconst getjQuery = () => {\n const { jQuery } = window\n\n if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {\n return jQuery\n }\n\n return null\n}\n\nconst DOMContentLoadedCallbacks = []\n\nconst onDOMContentLoaded = callback => {\n if (document.readyState === 'loading') {\n // add listener on the first call when the document is in loading state\n if (!DOMContentLoadedCallbacks.length) {\n document.addEventListener('DOMContentLoaded', () => {\n DOMContentLoadedCallbacks.forEach(callback => callback())\n })\n }\n\n DOMContentLoadedCallbacks.push(callback)\n } else {\n callback()\n }\n}\n\nconst isRTL = () => document.documentElement.dir === 'rtl'\n\nconst defineJQueryPlugin = plugin => {\n onDOMContentLoaded(() => {\n const $ = getjQuery()\n /* istanbul ignore if */\n if ($) {\n const name = plugin.NAME\n const JQUERY_NO_CONFLICT = $.fn[name]\n $.fn[name] = plugin.jQueryInterface\n $.fn[name].Constructor = plugin\n $.fn[name].noConflict = () => {\n $.fn[name] = JQUERY_NO_CONFLICT\n return plugin.jQueryInterface\n }\n }\n })\n}\n\nconst execute = callback => {\n if (typeof callback === 'function') {\n callback()\n }\n}\n\nconst executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {\n if (!waitForTransition) {\n execute(callback)\n return\n }\n\n const durationPadding = 5\n const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding\n\n let called = false\n\n const handler = ({ target }) => {\n if (target !== transitionElement) {\n return\n }\n\n called = true\n transitionElement.removeEventListener(TRANSITION_END, handler)\n execute(callback)\n }\n\n transitionElement.addEventListener(TRANSITION_END, handler)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(transitionElement)\n }\n }, emulatedDuration)\n}\n\n/**\n * Return the previous/next element of a list.\n *\n * @param {array} list The list of elements\n * @param activeElement The active element\n * @param shouldGetNext Choose to get next or previous element\n * @param isCycleAllowed\n * @return {Element|elem} The proper element\n */\nconst getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {\n let index = list.indexOf(activeElement)\n\n // if the element does not exist in the list return an element depending on the direction and if cycle is allowed\n if (index === -1) {\n return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0]\n }\n\n const listLength = list.length\n\n index += shouldGetNext ? 1 : -1\n\n if (isCycleAllowed) {\n index = (index + listLength) % listLength\n }\n\n return list[Math.max(0, Math.min(index, listLength - 1))]\n}\n\nexport {\n getElement,\n getUID,\n getSelectorFromElement,\n getElementFromSelector,\n getTransitionDurationFromElement,\n triggerTransitionEnd,\n isElement,\n typeCheckConfig,\n isVisible,\n isDisabled,\n findShadowRoot,\n noop,\n getNextActiveElement,\n reflow,\n getjQuery,\n onDOMContentLoaded,\n isRTL,\n defineJQueryPlugin,\n execute,\n executeAfterTransition\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.1.3): button.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin } from './util/index'\nimport EventHandler from './dom/event-handler'\nimport BaseComponent from './base-component'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'button'\nconst DATA_KEY = 'bs.button'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst CLASS_NAME_ACTIVE = 'active'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"button\"]'\n\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Button extends BaseComponent {\n // Getters\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n toggle() {\n // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method\n this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE))\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Button.getOrCreateInstance(this)\n\n if (config === 'toggle') {\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {\n event.preventDefault()\n\n const button = event.target.closest(SELECTOR_DATA_TOGGLE)\n const data = Button.getOrCreateInstance(button)\n\n data.toggle()\n})\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Button to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(Button)\n\nexport default Button\n"],"names":["getjQuery","jQuery","window","document","body","hasAttribute","DOMContentLoadedCallbacks","onDOMContentLoaded","callback","readyState","length","addEventListener","forEach","push","defineJQueryPlugin","plugin","$","name","NAME","JQUERY_NO_CONFLICT","fn","jQueryInterface","Constructor","noConflict","DATA_KEY","EVENT_KEY","DATA_API_KEY","CLASS_NAME_ACTIVE","SELECTOR_DATA_TOGGLE","EVENT_CLICK_DATA_API","Button","BaseComponent","toggle","_element","setAttribute","classList","config","each","data","getOrCreateInstance","EventHandler","on","event","preventDefault","button","target","closest"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAqMA,MAAMA,SAAS,GAAG,MAAM;EACtB,QAAM;EAAEC,IAAAA;EAAF,MAAaC,MAAnB;;EAEA,MAAID,MAAM,IAAI,CAACE,QAAQ,CAACC,IAAT,CAAcC,YAAd,CAA2B,mBAA3B,CAAf,EAAgE;EAC9D,WAAOJ,MAAP;EACD;;EAED,SAAO,IAAP;EACD,CARD;;EAUA,MAAMK,yBAAyB,GAAG,EAAlC;;EAEA,MAAMC,kBAAkB,GAAGC,QAAQ,IAAI;EACrC,MAAIL,QAAQ,CAACM,UAAT,KAAwB,SAA5B,EAAuC;EACrC;EACA,QAAI,CAACH,yBAAyB,CAACI,MAA/B,EAAuC;EACrCP,MAAAA,QAAQ,CAACQ,gBAAT,CAA0B,kBAA1B,EAA8C,MAAM;EAClDL,QAAAA,yBAAyB,CAACM,OAA1B,CAAkCJ,QAAQ,IAAIA,QAAQ,EAAtD;EACD,OAFD;EAGD;;EAEDF,IAAAA,yBAAyB,CAACO,IAA1B,CAA+BL,QAA/B;EACD,GATD,MASO;EACLA,IAAAA,QAAQ;EACT;EACF,CAbD;;EAiBA,MAAMM,kBAAkB,GAAGC,MAAM,IA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