{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{\"use strict\";var e=n(379),t=n.n(e),r=n(454);function o(e){if(!e.hasAttribute(\"autocompleted\")){e.setAttribute(\"autocompleted\",\"\");var t=new window.CustomEvent(\"onautocomplete\",{bubbles:!0,cancelable:!0,detail:null});e.dispatchEvent(t)||(e.value=\"\")}}function a(e){e.hasAttribute(\"autocompleted\")&&(e.removeAttribute(\"autocompleted\"),e.dispatchEvent(new window.CustomEvent(\"onautocomplete\",{bubbles:!0,cancelable:!1,detail:null})))}t()(r.Z,{insert:\"head\",singleton:!1}),r.Z.locals,n(810),document.addEventListener(\"animationstart\",(function(e){\"onautofillstart\"===e.animationName?o(e.target):a(e.target)}),!0),document.addEventListener(\"input\",(function(e){\"insertReplacementText\"!==e.inputType&&\"data\"in e?a(e.target):o(e.target)}),!0)})()})();","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport getComputedStyle from \"./dom-utils/getComputedStyle.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport validateModifiers from \"./utils/validateModifiers.js\";\nimport uniqueBy from \"./utils/uniqueBy.js\";\nimport getBasePlacement from \"./utils/getBasePlacement.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nimport { auto } from \"./enums.js\";\nvar INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';\nvar INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n }); // Validate the provided modifiers so that the consumer will get warned\n // if one of the modifiers is invalid for any reason\n\n if (process.env.NODE_ENV !== \"production\") {\n var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {\n var name = _ref.name;\n return name;\n });\n validateModifiers(modifiers);\n\n if (getBasePlacement(state.options.placement) === auto) {\n var flipModifier = state.orderedModifiers.find(function (_ref2) {\n var name = _ref2.name;\n return name === 'flip';\n });\n\n if (!flipModifier) {\n console.error(['Popper: \"auto\" placements require the \"flip\" modifier be', 'present and enabled to work.'].join(' '));\n }\n }\n\n var _getComputedStyle = getComputedStyle(popper),\n marginTop = _getComputedStyle.marginTop,\n marginRight = _getComputedStyle.marginRight,\n marginBottom = _getComputedStyle.marginBottom,\n marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can\n // cause bugs with positioning, so we'll warn the consumer\n\n\n if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {\n return parseFloat(margin);\n })) {\n console.warn(['Popper: CSS \"margin\" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));\n }\n }\n\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n var __debug_loops__ = 0;\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (process.env.NODE_ENV !== \"production\") {\n __debug_loops__ += 1;\n\n if (__debug_loops__ > 100) {\n console.error(INFINITE_LOOP_ERROR);\n break;\n }\n }\n\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref3) {\n var name = _ref3.name,\n _ref3$options = _ref3.options,\n options = _ref3$options === void 0 ? {} : _ref3$options,\n effect = _ref3.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref) {\n var x = _ref.x,\n y = _ref.y;\n var win = window;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n\n if (process.env.NODE_ENV !== \"production\") {\n var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';\n\n if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {\n return transitionProperty.indexOf(property) >= 0;\n })) {\n console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: \"transform\", \"top\", \"right\", \"bottom\", \"left\".', '\\n\\n', 'Disable the \"computeStyles\" modifier\\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\\n\\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));\n }\n }\n\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, \"auto\" cannot be used to allow \"bottom-start\".', 'Use \"auto-start\" instead.'].join(' '));\n }\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!isHTMLElement(arrowElement)) {\n console.error(['Popper: \"arrow\" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: \"arrow\" modifier\\'s `element` must be a child of the popper', 'element.'].join(' '));\n }\n\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","/**\r\n * --------------------------------------------------------------------------\r\n * Bootstrap (v5.0.0-beta2): dom/data.js\r\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\r\n * --------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * ------------------------------------------------------------------------\r\n * Constants\r\n * ------------------------------------------------------------------------\r\n */\r\n\r\nconst mapData = (() => {\r\n const storeData = {};\r\n let id = 1;\r\n return {\r\n set(element, key, data) {\r\n if (typeof element[key] === 'undefined') {\r\n element[key] = {\r\n key,\r\n id,\r\n };\r\n id++;\r\n }\r\n\r\n storeData[element[key].id] = data;\r\n },\r\n get(element, key) {\r\n if (!element || typeof element[key] === 'undefined') {\r\n return null;\r\n }\r\n\r\n const keyProperties = element[key];\r\n if (keyProperties.key === key) {\r\n return storeData[keyProperties.id];\r\n }\r\n\r\n return null;\r\n },\r\n delete(element, key) {\r\n if (typeof element[key] === 'undefined') {\r\n return;\r\n }\r\n\r\n const keyProperties = element[key];\r\n if (keyProperties.key === key) {\r\n delete storeData[keyProperties.id];\r\n delete element[key];\r\n }\r\n },\r\n };\r\n})();\r\n\r\nconst Data = {\r\n setData(instance, key, data) {\r\n mapData.set(instance, key, data);\r\n },\r\n getData(instance, key) {\r\n return mapData.get(instance, key);\r\n },\r\n removeData(instance, key) {\r\n mapData.delete(instance, key);\r\n },\r\n};\r\n\r\nexport default Data;\r\n","/**\r\n * --------------------------------------------------------------------------\r\n * Bootstrap (v5.0.0-beta2): util/index.js\r\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\r\n * --------------------------------------------------------------------------\r\n */\r\n\r\nconst MAX_UID = 1000000;\r\nconst MILLISECONDS_MULTIPLIER = 1000;\r\nconst TRANSITION_END = 'transitionend';\r\n\r\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\r\nconst toType = (obj) => {\r\n if (obj === null || obj === undefined) {\r\n return `${obj}`;\r\n }\r\n\r\n return {}.toString\r\n .call(obj)\r\n .match(/\\s([a-z]+)/i)[1]\r\n .toLowerCase();\r\n};\r\n\r\n/**\r\n * --------------------------------------------------------------------------\r\n * Public Util Api\r\n * --------------------------------------------------------------------------\r\n */\r\n\r\nconst getUID = (prefix) => {\r\n do {\r\n prefix += Math.floor(Math.random() * MAX_UID);\r\n } while (document.getElementById(prefix));\r\n\r\n return prefix;\r\n};\r\n\r\nconst getSelector = (element) => {\r\n let selector = element.getAttribute('data-mdb-target');\r\n\r\n if (!selector || selector === '#') {\r\n const hrefAttr = element.getAttribute('href');\r\n\r\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;\r\n }\r\n\r\n return selector;\r\n};\r\n\r\nconst getSelectorFromElement = (element) => {\r\n const selector = getSelector(element);\r\n\r\n if (selector) {\r\n return document.querySelector(selector) ? selector : null;\r\n }\r\n\r\n return null;\r\n};\r\n\r\nconst getElementFromSelector = (element) => {\r\n const selector = getSelector(element);\r\n\r\n return selector ? document.querySelector(selector) : null;\r\n};\r\n\r\nconst getTransitionDurationFromElement = (element) => {\r\n if (!element) {\r\n return 0;\r\n }\r\n\r\n // Get transition-duration of the element\r\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element);\r\n\r\n const floatTransitionDuration = Number.parseFloat(transitionDuration);\r\n const floatTransitionDelay = Number.parseFloat(transitionDelay);\r\n\r\n // Return 0 if element or transition duration is not found\r\n if (!floatTransitionDuration && !floatTransitionDelay) {\r\n return 0;\r\n }\r\n\r\n // If multiple durations are defined, take the first\r\n transitionDuration = transitionDuration.split(',')[0];\r\n transitionDelay = transitionDelay.split(',')[0];\r\n\r\n return (\r\n (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *\r\n MILLISECONDS_MULTIPLIER\r\n );\r\n};\r\n\r\nconst triggerTransitionEnd = (element) => {\r\n element.dispatchEvent(new Event(TRANSITION_END));\r\n};\r\n\r\nconst isElement = (obj) => (obj[0] || obj).nodeType;\r\n\r\nconst emulateTransitionEnd = (element, duration) => {\r\n let called = false;\r\n const durationPadding = 5;\r\n const emulatedDuration = duration + durationPadding;\r\n\r\n function listener() {\r\n called = true;\r\n element.removeEventListener(TRANSITION_END, listener);\r\n }\r\n\r\n element.addEventListener(TRANSITION_END, listener);\r\n setTimeout(() => {\r\n if (!called) {\r\n triggerTransitionEnd(element);\r\n }\r\n }, emulatedDuration);\r\n};\r\n\r\nconst typeCheckConfig = (componentName, config, configTypes) => {\r\n Object.keys(configTypes).forEach((property) => {\r\n const expectedTypes = configTypes[property];\r\n const value = config[property];\r\n const valueType = value && isElement(value) ? 'element' : toType(value);\r\n\r\n if (!new RegExp(expectedTypes).test(valueType)) {\r\n throw new Error(\r\n `${componentName.toUpperCase()}: ` +\r\n `Option \"${property}\" provided type \"${valueType}\" ` +\r\n `but expected type \"${expectedTypes}\".`\r\n );\r\n }\r\n });\r\n};\r\n\r\nconst isVisible = (element) => {\r\n if (!element) {\r\n return false;\r\n }\r\n\r\n if (element.style && element.parentNode && element.parentNode.style) {\r\n const elementStyle = getComputedStyle(element);\r\n const parentNodeStyle = getComputedStyle(element.parentNode);\r\n\r\n return (\r\n elementStyle.display !== 'none' &&\r\n parentNodeStyle.display !== 'none' &&\r\n elementStyle.visibility !== 'hidden'\r\n );\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst findShadowRoot = (element) => {\r\n if (!document.documentElement.attachShadow) {\r\n return null;\r\n }\r\n\r\n // Can find the shadow root otherwise it'll return the document\r\n if (typeof element.getRootNode === 'function') {\r\n const root = element.getRootNode();\r\n return root instanceof ShadowRoot ? root : null;\r\n }\r\n\r\n if (element instanceof ShadowRoot) {\r\n return element;\r\n }\r\n\r\n // when we don't find a shadow root\r\n if (!element.parentNode) {\r\n return null;\r\n }\r\n\r\n return findShadowRoot(element.parentNode);\r\n};\r\n\r\nconst noop = () => function () {};\r\n\r\nconst reflow = (element) => element.offsetHeight;\r\n\r\nconst getjQuery = () => {\r\n const { jQuery } = window;\r\n\r\n if (jQuery && !document.body.hasAttribute('data-mdb-no-jquery')) {\r\n return jQuery;\r\n }\r\n\r\n return null;\r\n};\r\n\r\nconst onDOMContentLoaded = (callback) => {\r\n if (document.readyState === 'loading') {\r\n document.addEventListener('DOMContentLoaded', callback);\r\n } else {\r\n callback();\r\n }\r\n};\r\n\r\nconst isRTL = document.documentElement.dir === 'rtl';\r\n\r\nconst array = (collection) => {\r\n return Array.from(collection);\r\n};\r\n\r\nconst element = (tag) => {\r\n return document.createElement(tag);\r\n};\r\n\r\nconst defineJQueryPlugin = (name, plugin) => {\r\n onDOMContentLoaded(() => {\r\n const $ = getjQuery();\r\n /* istanbul ignore if */\r\n if ($) {\r\n const JQUERY_NO_CONFLICT = $.fn[name];\r\n $.fn[name] = plugin.jQueryInterface;\r\n $.fn[name].Constructor = plugin;\r\n $.fn[name].noConflict = () => {\r\n $.fn[name] = JQUERY_NO_CONFLICT;\r\n return plugin.jQueryInterface;\r\n };\r\n }\r\n });\r\n};\r\n\r\nexport {\r\n getjQuery,\r\n TRANSITION_END,\r\n getUID,\r\n getSelectorFromElement,\r\n getElementFromSelector,\r\n getTransitionDurationFromElement,\r\n triggerTransitionEnd,\r\n isElement,\r\n emulateTransitionEnd,\r\n typeCheckConfig,\r\n isVisible,\r\n findShadowRoot,\r\n noop,\r\n reflow,\r\n array,\r\n element,\r\n onDOMContentLoaded,\r\n isRTL,\r\n defineJQueryPlugin,\r\n};\r\n","/**\r\n * --------------------------------------------------------------------------\r\n * Bootstrap (v5.0.0-beta2): dom/event-handler.js\r\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\r\n * --------------------------------------------------------------------------\r\n */\r\n\r\nimport { getjQuery } from '../util/index';\r\n\r\n/**\r\n * ------------------------------------------------------------------------\r\n * Constants\r\n * ------------------------------------------------------------------------\r\n */\r\n\r\nconst $ = getjQuery();\r\nconst namespaceRegex = /[^.]*(?=\\..*)\\.|.*/;\r\nconst stripNameRegex = /\\..*/;\r\nconst stripUidRegex = /::\\d+$/;\r\nconst eventRegistry = {}; // Events storage\r\nlet uidEvent = 1;\r\nconst customEvents = {\r\n mouseenter: 'mouseover',\r\n mouseleave: 'mouseout',\r\n};\r\nconst nativeEvents = [\r\n 'click',\r\n 'dblclick',\r\n 'mouseup',\r\n 'mousedown',\r\n 'contextmenu',\r\n 'mousewheel',\r\n 'DOMMouseScroll',\r\n 'mouseover',\r\n 'mouseout',\r\n 'mousemove',\r\n 'selectstart',\r\n 'selectend',\r\n 'keydown',\r\n 'keypress',\r\n 'keyup',\r\n 'orientationchange',\r\n 'touchstart',\r\n 'touchmove',\r\n 'touchend',\r\n 'touchcancel',\r\n 'pointerdown',\r\n 'pointermove',\r\n 'pointerup',\r\n 'pointerleave',\r\n 'pointercancel',\r\n 'gesturestart',\r\n 'gesturechange',\r\n 'gestureend',\r\n 'focus',\r\n 'blur',\r\n 'change',\r\n 'reset',\r\n 'select',\r\n 'submit',\r\n 'focusin',\r\n 'focusout',\r\n 'load',\r\n 'unload',\r\n 'beforeunload',\r\n 'resize',\r\n 'move',\r\n 'DOMContentLoaded',\r\n 'readystatechange',\r\n 'error',\r\n 'abort',\r\n 'scroll',\r\n];\r\n\r\n/**\r\n * ------------------------------------------------------------------------\r\n * Private methods\r\n * ------------------------------------------------------------------------\r\n */\r\n\r\nfunction getUidEvent(element, uid) {\r\n return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++;\r\n}\r\n\r\nfunction getEvent(element) {\r\n const uid = getUidEvent(element);\r\n\r\n element.uidEvent = uid;\r\n eventRegistry[uid] = eventRegistry[uid] || {};\r\n\r\n return eventRegistry[uid];\r\n}\r\n\r\nfunction bootstrapHandler(element, fn) {\r\n return function handler(event) {\r\n event.delegateTarget = element;\r\n\r\n if (handler.oneOff) {\r\n EventHandler.off(element, event.type, fn);\r\n }\r\n\r\n return fn.apply(element, [event]);\r\n };\r\n}\r\n\r\nfunction bootstrapDelegationHandler(element, selector, fn) {\r\n return function handler(event) {\r\n const domElements = element.querySelectorAll(selector);\r\n\r\n for (let { target } = event; target && target !== this; target = target.parentNode) {\r\n for (let i = domElements.length; i--; '') {\r\n if (domElements[i] === target) {\r\n event.delegateTarget = target;\r\n\r\n if (handler.oneOff) {\r\n EventHandler.off(element, event.type, fn);\r\n }\r\n\r\n return fn.apply(target, [event]);\r\n }\r\n }\r\n }\r\n\r\n // To please ESLint\r\n return null;\r\n };\r\n}\r\n\r\nfunction findHandler(events, handler, delegationSelector = null) {\r\n const uidEventList = Object.keys(events);\r\n\r\n for (let i = 0, len = uidEventList.length; i < len; i++) {\r\n const event = events[uidEventList[i]];\r\n\r\n if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {\r\n return event;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction normalizeParams(originalTypeEvent, handler, delegationFn) {\r\n const delegation = typeof handler === 'string';\r\n const originalHandler = delegation ? delegationFn : handler;\r\n\r\n // allow to get the native events from namespaced events ('click.bs.button' --> 'click')\r\n let typeEvent = originalTypeEvent.replace(stripNameRegex, '');\r\n const custom = customEvents[typeEvent];\r\n\r\n if (custom) {\r\n typeEvent = custom;\r\n }\r\n\r\n const isNative = nativeEvents.indexOf(typeEvent) > -1;\r\n\r\n if (!isNative) {\r\n typeEvent = originalTypeEvent;\r\n }\r\n\r\n return [delegation, originalHandler, typeEvent];\r\n}\r\n\r\nfunction addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {\r\n if (typeof originalTypeEvent !== 'string' || !element) {\r\n return;\r\n }\r\n\r\n if (!handler) {\r\n handler = delegationFn;\r\n delegationFn = null;\r\n }\r\n\r\n const [delegation, originalHandler, typeEvent] = normalizeParams(\r\n originalTypeEvent,\r\n handler,\r\n delegationFn\r\n );\r\n const events = getEvent(element);\r\n const handlers = events[typeEvent] || (events[typeEvent] = {});\r\n const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);\r\n\r\n if (previousFn) {\r\n previousFn.oneOff = previousFn.oneOff && oneOff;\r\n\r\n return;\r\n }\r\n\r\n const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));\r\n const fn = delegation\r\n ? bootstrapDelegationHandler(element, handler, delegationFn)\r\n : bootstrapHandler(element, handler);\r\n\r\n fn.delegationSelector = delegation ? handler : null;\r\n fn.originalHandler = originalHandler;\r\n fn.oneOff = oneOff;\r\n fn.uidEvent = uid;\r\n handlers[uid] = fn;\r\n\r\n element.addEventListener(typeEvent, fn, delegation);\r\n}\r\n\r\nfunction removeHandler(element, events, typeEvent, handler, delegationSelector) {\r\n const fn = findHandler(events[typeEvent], handler, delegationSelector);\r\n\r\n if (!fn) {\r\n return;\r\n }\r\n\r\n element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));\r\n delete events[typeEvent][fn.uidEvent];\r\n}\r\n\r\nfunction removeNamespacedHandlers(element, events, typeEvent, namespace) {\r\n const storeElementEvent = events[typeEvent] || {};\r\n\r\n Object.keys(storeElementEvent).forEach((handlerKey) => {\r\n if (handlerKey.indexOf(namespace) > -1) {\r\n const event = storeElementEvent[handlerKey];\r\n\r\n removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);\r\n }\r\n });\r\n}\r\n\r\nconst EventHandler = {\r\n on(element, event, handler, delegationFn) {\r\n addHandler(element, event, handler, delegationFn, false);\r\n },\r\n\r\n one(element, event, handler, delegationFn) {\r\n addHandler(element, event, handler, delegationFn, true);\r\n },\r\n\r\n off(element, originalTypeEvent, handler, delegationFn) {\r\n if (typeof originalTypeEvent !== 'string' || !element) {\r\n return;\r\n }\r\n\r\n const [delegation, originalHandler, typeEvent] = normalizeParams(\r\n originalTypeEvent,\r\n handler,\r\n delegationFn\r\n );\r\n const inNamespace = typeEvent !== originalTypeEvent;\r\n const events = getEvent(element);\r\n const isNamespace = originalTypeEvent.charAt(0) === '.';\r\n\r\n if (typeof originalHandler !== 'undefined') {\r\n // Simplest case: handler is passed, remove that listener ONLY.\r\n if (!events || !events[typeEvent]) {\r\n return;\r\n }\r\n\r\n removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);\r\n return;\r\n }\r\n\r\n if (isNamespace) {\r\n Object.keys(events).forEach((elementEvent) => {\r\n removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));\r\n });\r\n }\r\n\r\n const storeElementEvent = events[typeEvent] || {};\r\n Object.keys(storeElementEvent).forEach((keyHandlers) => {\r\n const handlerKey = keyHandlers.replace(stripUidRegex, '');\r\n\r\n if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {\r\n const event = storeElementEvent[keyHandlers];\r\n\r\n removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);\r\n }\r\n });\r\n },\r\n\r\n trigger(element, event, args) {\r\n if (typeof event !== 'string' || !element) {\r\n return null;\r\n }\r\n\r\n const typeEvent = event.replace(stripNameRegex, '');\r\n const inNamespace = event !== typeEvent;\r\n const isNative = nativeEvents.indexOf(typeEvent) > -1;\r\n\r\n let jQueryEvent;\r\n let bubbles = true;\r\n let nativeDispatch = true;\r\n let defaultPrevented = false;\r\n let evt = null;\r\n\r\n if (inNamespace && $) {\r\n jQueryEvent = $.Event(event, args);\r\n\r\n $(element).trigger(jQueryEvent);\r\n bubbles = !jQueryEvent.isPropagationStopped();\r\n nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();\r\n defaultPrevented = jQueryEvent.isDefaultPrevented();\r\n }\r\n\r\n if (isNative) {\r\n evt = document.createEvent('HTMLEvents');\r\n evt.initEvent(typeEvent, bubbles, true);\r\n } else {\r\n evt = new CustomEvent(event, {\r\n bubbles,\r\n cancelable: true,\r\n });\r\n }\r\n\r\n // merge custom informations in our event\r\n if (typeof args !== 'undefined') {\r\n Object.keys(args).forEach((key) => {\r\n Object.defineProperty(evt, key, {\r\n get() {\r\n return args[key];\r\n },\r\n });\r\n });\r\n }\r\n\r\n if (defaultPrevented) {\r\n evt.preventDefault();\r\n }\r\n\r\n if (nativeDispatch) {\r\n element.dispatchEvent(evt);\r\n }\r\n\r\n if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {\r\n jQueryEvent.preventDefault();\r\n }\r\n\r\n return evt;\r\n },\r\n};\r\n\r\nexport const EventHandlerMulti = {\r\n on(element, eventsName, handler, delegationFn) {\r\n const events = eventsName.split(' ');\r\n\r\n for (let i = 0; i < events.length; i++) {\r\n EventHandler.on(element, events[i], handler, delegationFn);\r\n }\r\n },\r\n off(element, originalTypeEvent, handler, delegationFn) {\r\n const events = originalTypeEvent.split(' ');\r\n\r\n for (let i = 0; i < events.length; i++) {\r\n EventHandler.off(element, events[i], handler, delegationFn);\r\n }\r\n },\r\n};\r\n\r\nexport default EventHandler;\r\n","/**\r\n * --------------------------------------------------------------------------\r\n * Bootstrap (v5.0.0-beta2): dom/manipulator.js\r\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\r\n * --------------------------------------------------------------------------\r\n */\r\n\r\nfunction normalizeData(val) {\r\n if (val === 'true') {\r\n return true;\r\n }\r\n\r\n if (val === 'false') {\r\n return false;\r\n }\r\n\r\n if (val === Number(val).toString()) {\r\n return Number(val);\r\n }\r\n\r\n if (val === '' || val === 'null') {\r\n return null;\r\n }\r\n\r\n return val;\r\n}\r\n\r\nfunction normalizeDataKey(key) {\r\n return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`);\r\n}\r\n\r\nconst Manipulator = {\r\n setDataAttribute(element, key, value) {\r\n element.setAttribute(`data-mdb-${normalizeDataKey(key)}`, value);\r\n },\r\n\r\n removeDataAttribute(element, key) {\r\n element.removeAttribute(`data-mdb-${normalizeDataKey(key)}`);\r\n },\r\n\r\n getDataAttributes(element) {\r\n if (!element) {\r\n return {};\r\n }\r\n\r\n const attributes = {\r\n ...element.dataset,\r\n };\r\n\r\n Object.keys(attributes)\r\n .filter((key) => key.startsWith('mdb'))\r\n .forEach((key) => {\r\n let pureKey = key.replace(/^mdb/, '');\r\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);\r\n attributes[pureKey] = normalizeData(attributes[key]);\r\n });\r\n\r\n return attributes;\r\n },\r\n\r\n getDataAttribute(element, key) {\r\n return normalizeData(element.getAttribute(`data-mdb-${normalizeDataKey(key)}`));\r\n },\r\n\r\n offset(element) {\r\n const rect = element.getBoundingClientRect();\r\n\r\n return {\r\n top: rect.top + document.body.scrollTop,\r\n left: rect.left + document.body.scrollLeft,\r\n };\r\n },\r\n\r\n position(element) {\r\n return {\r\n top: element.offsetTop,\r\n left: element.offsetLeft,\r\n };\r\n },\r\n\r\n style(element, style) {\r\n Object.assign(element.style, style);\r\n },\r\n\r\n toggleClass(element, className) {\r\n if (!element) {\r\n return;\r\n }\r\n\r\n if (element.classList.contains(className)) {\r\n element.classList.remove(className);\r\n } else {\r\n element.classList.add(className);\r\n }\r\n },\r\n\r\n addClass(element, className) {\r\n if (element.classList.contains(className)) return;\r\n element.classList.add(className);\r\n },\r\n\r\n addStyle(element, style) {\r\n Object.keys(style).forEach((property) => {\r\n element.style[property] = style[property];\r\n });\r\n },\r\n\r\n removeClass(element, className) {\r\n if (!element.classList.contains(className)) return;\r\n element.classList.remove(className);\r\n },\r\n\r\n hasClass(element, className) {\r\n return element.classList.contains(className);\r\n },\r\n};\r\n\r\nexport default Manipulator;\r\n","/**\r\n * --------------------------------------------------------------------------\r\n * Bootstrap (v5.0.0-beta2): dom/selector-engine.js\r\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\r\n * --------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * ------------------------------------------------------------------------\r\n * Constants\r\n * ------------------------------------------------------------------------\r\n */\r\n\r\nconst NODE_TEXT = 3;\r\n\r\nconst SelectorEngine = {\r\n closest(element, selector) {\r\n return element.closest(selector);\r\n },\r\n\r\n matches(element, selector) {\r\n return element.matches(selector);\r\n },\r\n\r\n find(selector, element = document.documentElement) {\r\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector));\r\n },\r\n\r\n findOne(selector, element = document.documentElement) {\r\n return Element.prototype.querySelector.call(element, selector);\r\n },\r\n\r\n children(element, selector) {\r\n const children = [].concat(...element.children);\r\n\r\n return children.filter((child) => child.matches(selector));\r\n },\r\n\r\n parents(element, selector) {\r\n const parents = [];\r\n\r\n let ancestor = element.parentNode;\r\n\r\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\r\n if (this.matches(ancestor, selector)) {\r\n parents.push(ancestor);\r\n }\r\n\r\n ancestor = ancestor.parentNode;\r\n }\r\n\r\n return parents;\r\n },\r\n\r\n prev(element, selector) {\r\n let previous = element.previousElementSibling;\r\n\r\n while (previous) {\r\n if (previous.matches(selector)) {\r\n return [previous];\r\n }\r\n\r\n previous = previous.previousElementSibling;\r\n }\r\n\r\n return [];\r\n },\r\n\r\n next(element, selector) {\r\n let next = element.nextElementSibling;\r\n\r\n while (next) {\r\n if (this.matches(next, selector)) {\r\n return [next];\r\n }\r\n\r\n next = next.nextElementSibling;\r\n }\r\n\r\n return [];\r\n },\r\n};\r\n\r\nexport default SelectorEngine;\r\n","import { element, getjQuery, onDOMContentLoaded } from '../mdb/util/index';\r\nimport Data from '../mdb/dom/data';\r\nimport EventHandler from '../mdb/dom/event-handler';\r\nimport Manipulator from '../mdb/dom/manipulator';\r\nimport SelectorEngine from '../mdb/dom/selector-engine';\r\nimport 'detect-autofill';\r\n\r\n/**\r\n * ------------------------------------------------------------------------\r\n * Constants\r\n * ------------------------------------------------------------------------\r\n */\r\n\r\nconst NAME = 'input';\r\nconst DATA_KEY = 'mdb.input';\r\nconst CLASSNAME_WRAPPER = 'form-outline';\r\nconst CLASSNAME_ACTIVE = 'active';\r\nconst CLASSNAME_NOTCH = 'form-notch';\r\nconst CLASSNAME_NOTCH_LEADING = 'form-notch-leading';\r\nconst CLASSNAME_NOTCH_MIDDLE = 'form-notch-middle';\r\nconst CLASSNAME_NOTCH_TRAILING = 'form-notch-trailing';\r\nconst CLASSNAME_PLACEHOLDER_ACTIVE = 'placeholder-active';\r\nconst CLASSNAME_HELPER = 'form-helper';\r\nconst CLASSNAME_COUNTER = 'form-counter';\r\n\r\nconst SELECTOR_OUTLINE_INPUT = `.${CLASSNAME_WRAPPER} input`;\r\nconst SELECTOR_OUTLINE_TEXTAREA = `.${CLASSNAME_WRAPPER} textarea`;\r\nconst SELECTOR_NOTCH = `.${CLASSNAME_NOTCH}`;\r\nconst SELECTOR_NOTCH_LEADING = `.${CLASSNAME_NOTCH_LEADING}`;\r\nconst SELECTOR_NOTCH_MIDDLE = `.${CLASSNAME_NOTCH_MIDDLE}`;\r\nconst SELECTOR_HELPER = `.${CLASSNAME_HELPER}`;\r\n\r\n/**\r\n * ------------------------------------------------------------------------\r\n * Class Definition\r\n * ------------------------------------------------------------------------\r\n */\r\n\r\nclass Input {\r\n constructor(element) {\r\n this._element = element;\r\n this._label = null;\r\n this._labelWidth = 0;\r\n this._labelMarginLeft = 0;\r\n this._notchLeading = null;\r\n this._notchMiddle = null;\r\n this._notchTrailing = null;\r\n this._initiated = false;\r\n this._helper = null;\r\n this._counter = false;\r\n this._counterElement = null;\r\n this._maxLength = 0;\r\n this._leadingIcon = null;\r\n if (this._element) {\r\n Data.setData(element, DATA_KEY, this);\r\n this.init();\r\n }\r\n }\r\n\r\n // Getters\r\n static get NAME() {\r\n return NAME;\r\n }\r\n\r\n get input() {\r\n const inputElement =\r\n SelectorEngine.findOne('input', this._element) ||\r\n SelectorEngine.findOne('textarea', this._element);\r\n return inputElement;\r\n }\r\n\r\n // Public\r\n init() {\r\n if (this._initiated) {\r\n return;\r\n }\r\n this._getLabelData();\r\n this._applyDivs();\r\n this._applyNotch();\r\n this._activate();\r\n this._getHelper();\r\n this._getCounter();\r\n this._initiated = true;\r\n }\r\n\r\n update() {\r\n this._getLabelData();\r\n this._getNotchData();\r\n this._applyNotch();\r\n this._activate();\r\n this._getHelper();\r\n this._getCounter();\r\n }\r\n\r\n forceActive() {\r\n Manipulator.addClass(this.input, CLASSNAME_ACTIVE);\r\n }\r\n\r\n forceInactive() {\r\n Manipulator.removeClass(this.input, CLASSNAME_ACTIVE);\r\n }\r\n\r\n dispose() {\r\n this._removeBorder();\r\n\r\n Data.removeData(this._element, DATA_KEY);\r\n this._element = null;\r\n }\r\n\r\n // Private\r\n\r\n /*\r\n _getIcons() {\r\n this._leadingIcon = SelectorEngine.findOne('i.leading', this._element);\r\n\r\n if (this._leadingIcon !== null) {\r\n this._applyLeadingIcon();\r\n }\r\n }\r\n\r\n _applyLeadingIcon() {\r\n this._label.innerHTML = ` ${this._label.innerHTML}`;\r\n this._label.insertBefore(this._leadingIcon, this._label.firstChild);\r\n }\r\n */\r\n\r\n _getLabelData() {\r\n this._label = SelectorEngine.findOne('label', this._element);\r\n if (this._label === null) {\r\n this._showPlaceholder();\r\n } else {\r\n this._getLabelWidth();\r\n this._getLabelPositionInInputGroup();\r\n this._toggleDefaultDatePlaceholder();\r\n }\r\n }\r\n\r\n _getHelper() {\r\n this._helper = SelectorEngine.findOne(SELECTOR_HELPER, this._element);\r\n }\r\n\r\n _getCounter() {\r\n this._counter = Manipulator.getDataAttribute(this.input, 'showcounter');\r\n if (this._counter) {\r\n this._maxLength = this.input.maxLength;\r\n this._showCounter();\r\n }\r\n }\r\n\r\n _showCounter() {\r\n const counters = SelectorEngine.find('.form-counter', this._element);\r\n if (counters.length > 0) {\r\n return;\r\n }\r\n this._counterElement = document.createElement('div');\r\n Manipulator.addClass(this._counterElement, CLASSNAME_COUNTER);\r\n const actualLength = this.input.value.length;\r\n this._counterElement.innerHTML = `${actualLength} / ${this._maxLength}`;\r\n this._helper.appendChild(this._counterElement);\r\n this._bindCounter();\r\n }\r\n\r\n _bindCounter() {\r\n EventHandler.on(this.input, 'input', () => {\r\n const actualLength = this.input.value.length;\r\n this._counterElement.innerHTML = `${actualLength} / ${this._maxLength}`;\r\n });\r\n }\r\n\r\n _toggleDefaultDatePlaceholder(input = this.input) {\r\n const isTypeDate = input.getAttribute('type') === 'date';\r\n\r\n if (!isTypeDate) {\r\n return;\r\n }\r\n\r\n const isInputFocused = document.activeElement === input;\r\n\r\n if (!isInputFocused && !input.value) {\r\n input.style.opacity = 0;\r\n } else {\r\n input.style.opacity = 1;\r\n }\r\n }\r\n\r\n _showPlaceholder() {\r\n Manipulator.addClass(this.input, CLASSNAME_PLACEHOLDER_ACTIVE);\r\n }\r\n\r\n _getNotchData() {\r\n this._notchMiddle = SelectorEngine.findOne(SELECTOR_NOTCH_MIDDLE, this._element);\r\n this._notchLeading = SelectorEngine.findOne(SELECTOR_NOTCH_LEADING, this._element);\r\n }\r\n\r\n _getLabelWidth() {\r\n this._labelWidth = this._label.clientWidth * 0.8 + 8;\r\n }\r\n\r\n _getLabelPositionInInputGroup() {\r\n this._labelMarginLeft = 0;\r\n\r\n if (!this._element.classList.contains('input-group')) return;\r\n const input = this.input;\r\n const prefix = SelectorEngine.prev(input, '.input-group-text')[0];\r\n if (prefix === undefined) {\r\n this._labelMarginLeft = 0;\r\n } else {\r\n this._labelMarginLeft = prefix.offsetWidth - 1;\r\n }\r\n }\r\n\r\n _applyDivs() {\r\n const allNotchWrappers = SelectorEngine.find(SELECTOR_NOTCH, this._element);\r\n const notchWrapper = element('div');\r\n Manipulator.addClass(notchWrapper, CLASSNAME_NOTCH);\r\n this._notchLeading = element('div');\r\n Manipulator.addClass(this._notchLeading, CLASSNAME_NOTCH_LEADING);\r\n this._notchMiddle = element('div');\r\n Manipulator.addClass(this._notchMiddle, CLASSNAME_NOTCH_MIDDLE);\r\n this._notchTrailing = element('div');\r\n Manipulator.addClass(this._notchTrailing, CLASSNAME_NOTCH_TRAILING);\r\n if (allNotchWrappers.length >= 1) {\r\n return;\r\n }\r\n notchWrapper.append(this._notchLeading);\r\n notchWrapper.append(this._notchMiddle);\r\n notchWrapper.append(this._notchTrailing);\r\n this._element.append(notchWrapper);\r\n }\r\n\r\n _applyNotch() {\r\n this._notchMiddle.style.width = `${this._labelWidth}px`;\r\n this._notchLeading.style.width = `${this._labelMarginLeft + 9}px`;\r\n\r\n if (this._label === null) return;\r\n this._label.style.marginLeft = `${this._labelMarginLeft}px`;\r\n }\r\n\r\n _removeBorder() {\r\n const border = SelectorEngine.findOne(SELECTOR_NOTCH, this._element);\r\n if (border) border.remove();\r\n }\r\n\r\n _activate(event) {\r\n onDOMContentLoaded(() => {\r\n this._getElements(event);\r\n const input = event ? event.target : this.input;\r\n\r\n if (input.value !== '') {\r\n Manipulator.addClass(input, CLASSNAME_ACTIVE);\r\n }\r\n this._toggleDefaultDatePlaceholder(input);\r\n });\r\n }\r\n\r\n _getElements(event) {\r\n if (event) {\r\n this._element = event.target.parentNode;\r\n this._label = SelectorEngine.findOne('label', this._element);\r\n }\r\n\r\n if (event && this._label) {\r\n const prevLabelWidth = this._labelWidth;\r\n this._getLabelData();\r\n\r\n if (prevLabelWidth !== this._labelWidth) {\r\n this._notchMiddle = SelectorEngine.findOne('.form-notch-middle', event.target.parentNode);\r\n this._notchLeading = SelectorEngine.findOne(\r\n SELECTOR_NOTCH_LEADING,\r\n event.target.parentNode\r\n );\r\n this._applyNotch();\r\n }\r\n }\r\n }\r\n\r\n _deactivate(event) {\r\n const input = event ? event.target : this.input;\r\n\r\n if (input.value === '') {\r\n input.classList.remove(CLASSNAME_ACTIVE);\r\n }\r\n this._toggleDefaultDatePlaceholder(input);\r\n }\r\n\r\n static activate(instance) {\r\n return function (event) {\r\n instance._activate(event);\r\n };\r\n }\r\n\r\n static deactivate(instance) {\r\n return function (event) {\r\n instance._deactivate(event);\r\n };\r\n }\r\n\r\n static jQueryInterface(config, options) {\r\n return this.each(function () {\r\n let data = Data.getData(this, DATA_KEY);\r\n const _config = typeof config === 'object' && config;\r\n if (!data && /dispose/.test(config)) {\r\n return;\r\n }\r\n if (!data) {\r\n data = new Input(this, _config);\r\n }\r\n if (typeof config === 'string') {\r\n if (typeof data[config] === 'undefined') {\r\n throw new TypeError(`No method named \"${config}\"`);\r\n }\r\n data[config](options);\r\n }\r\n });\r\n }\r\n\r\n static getInstance(element) {\r\n return Data.getData(element, DATA_KEY);\r\n }\r\n\r\n static getOrCreateInstance(element, config = {}) {\r\n return (\r\n this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)\r\n );\r\n }\r\n}\r\n\r\nEventHandler.on(document, 'focus', SELECTOR_OUTLINE_INPUT, Input.activate(new Input()));\r\nEventHandler.on(document, 'input', SELECTOR_OUTLINE_INPUT, Input.activate(new Input()));\r\nEventHandler.on(document, 'blur', SELECTOR_OUTLINE_INPUT, Input.deactivate(new Input()));\r\n\r\nEventHandler.on(document, 'focus', SELECTOR_OUTLINE_TEXTAREA, Input.activate(new Input()));\r\nEventHandler.on(document, 'input', SELECTOR_OUTLINE_TEXTAREA, Input.activate(new Input()));\r\nEventHandler.on(document, 'blur', SELECTOR_OUTLINE_TEXTAREA, Input.deactivate(new Input()));\r\n\r\nEventHandler.on(window, 'shown.bs.modal', (e) => {\r\n SelectorEngine.find(SELECTOR_OUTLINE_INPUT, e.target).forEach((element) => {\r\n const instance = Input.getInstance(element.parentNode);\r\n if (!instance) {\r\n return;\r\n }\r\n instance.update();\r\n });\r\n SelectorEngine.find(SELECTOR_OUTLINE_TEXTAREA, e.target).forEach((element) => {\r\n const instance = Input.getInstance(element.parentNode);\r\n if (!instance) {\r\n return;\r\n }\r\n instance.update();\r\n });\r\n});\r\n\r\nEventHandler.on(window, 'shown.bs.dropdown', (e) => {\r\n const target = e.target.parentNode.querySelector('.dropdown-menu');\r\n if (target) {\r\n SelectorEngine.find(SELECTOR_OUTLINE_INPUT, target).forEach((element) => {\r\n const instance = Input.getInstance(element.parentNode);\r\n if (!instance) {\r\n return;\r\n }\r\n instance.update();\r\n });\r\n SelectorEngine.find(SELECTOR_OUTLINE_TEXTAREA, target).forEach((element) => {\r\n const instance = Input.getInstance(element.parentNode);\r\n if (!instance) {\r\n return;\r\n }\r\n instance.update();\r\n });\r\n }\r\n});\r\n\r\nEventHandler.on(window, 'shown.bs.tab', (e) => {\r\n let targetId;\r\n\r\n if (e.target.href) {\r\n targetId = e.target.href.split('#')[1];\r\n } else {\r\n targetId = Manipulator.getDataAttribute(e.target, 'target').split('#')[1];\r\n }\r\n\r\n const target = SelectorEngine.findOne(`#${targetId}`);\r\n SelectorEngine.find(SELECTOR_OUTLINE_INPUT, target).forEach((element) => {\r\n const instance = Input.getInstance(element.parentNode);\r\n if (!instance) {\r\n return;\r\n }\r\n instance.update();\r\n });\r\n SelectorEngine.find(SELECTOR_OUTLINE_TEXTAREA, target).forEach((element) => {\r\n const instance = Input.getInstance(element.parentNode);\r\n if (!instance) {\r\n return;\r\n }\r\n instance.update();\r\n });\r\n});\r\n\r\n// auto-init\r\nSelectorEngine.find(`.${CLASSNAME_WRAPPER}`).map((element) => new Input(element));\r\n\r\n// form reset handler\r\nEventHandler.on(window, 'reset', (e) => {\r\n SelectorEngine.find(SELECTOR_OUTLINE_INPUT, e.target).forEach((element) => {\r\n const instance = Input.getInstance(element.parentNode);\r\n if (!instance) {\r\n return;\r\n }\r\n instance.forceInactive();\r\n });\r\n SelectorEngine.find(SELECTOR_OUTLINE_TEXTAREA, e.target).forEach((element) => {\r\n const instance = Input.getInstance(element.parentNode);\r\n if (!instance) {\r\n return;\r\n }\r\n instance.forceInactive();\r\n });\r\n});\r\n\r\n// auto-fill\r\nEventHandler.on(window, 'onautocomplete', (e) => {\r\n const instance = Input.getInstance(e.target.parentNode);\r\n if (!instance || !e.cancelable) {\r\n return;\r\n }\r\n instance.forceActive();\r\n});\r\n\r\nonDOMContentLoaded(() => {\r\n const $ = getjQuery();\r\n\r\n if ($) {\r\n const JQUERY_NO_CONFLICT = $.fn[NAME];\r\n $.fn[NAME] = Input.jQueryInterface;\r\n $.fn[NAME].Constructor = Input;\r\n $.fn[NAME].noConflict = () => {\r\n $.fn[NAME] = JQUERY_NO_CONFLICT;\r\n return Input.jQueryInterface;\r\n };\r\n }\r\n});\r\n\r\nexport default Input;\r\n","import SelectorEngine from '../../mdb/dom/selector-engine';\r\nimport Manipulator from '../../mdb/dom/manipulator';\r\n\r\nconst SELECTOR_FORM_CHECK_INPUT = '.form-check-input';\r\n\r\nconst CLASS_NAME_SELECTED = 'selected';\r\nconst CLASS_NAME_ACITVE = 'active';\r\n\r\nclass SelectOption {\r\n constructor(\r\n id,\r\n nativeOption,\r\n multiple,\r\n value,\r\n label,\r\n selected,\r\n disabled,\r\n hidden,\r\n secondaryText,\r\n groupId,\r\n icon\r\n ) {\r\n this.id = id;\r\n this.nativeOption = nativeOption;\r\n this.multiple = multiple;\r\n this.value = value;\r\n this.label = label;\r\n this.selected = selected;\r\n this.disabled = disabled;\r\n this.hidden = hidden;\r\n this.secondaryText = secondaryText;\r\n this.groupId = groupId;\r\n this.icon = icon;\r\n this.node = null;\r\n this.active = false;\r\n }\r\n\r\n select() {\r\n if (this.multiple) {\r\n this._selectMultiple();\r\n } else {\r\n this._selectSingle();\r\n }\r\n }\r\n\r\n _selectSingle() {\r\n if (!this.selected) {\r\n Manipulator.addClass(this.node, CLASS_NAME_SELECTED);\r\n this.node.setAttribute('aria-selected', true);\r\n this.selected = true;\r\n\r\n if (this.nativeOption) {\r\n this.nativeOption.selected = true;\r\n }\r\n }\r\n }\r\n\r\n _selectMultiple() {\r\n if (!this.selected) {\r\n const checkbox = SelectorEngine.findOne(SELECTOR_FORM_CHECK_INPUT, this.node);\r\n checkbox.checked = true;\r\n Manipulator.addClass(this.node, CLASS_NAME_SELECTED);\r\n this.node.setAttribute('aria-selected', true);\r\n this.selected = true;\r\n\r\n if (this.nativeOption) {\r\n this.nativeOption.selected = true;\r\n }\r\n }\r\n }\r\n\r\n deselect() {\r\n if (this.multiple) {\r\n this._deselectMultiple();\r\n } else {\r\n this._deselectSingle();\r\n }\r\n }\r\n\r\n _deselectSingle() {\r\n if (this.selected) {\r\n Manipulator.removeClass(this.node, CLASS_NAME_SELECTED);\r\n this.node.setAttribute('aria-selected', false);\r\n this.selected = false;\r\n\r\n if (this.nativeOption) {\r\n this.nativeOption.selected = false;\r\n }\r\n }\r\n }\r\n\r\n _deselectMultiple() {\r\n if (this.selected) {\r\n const checkbox = SelectorEngine.findOne(SELECTOR_FORM_CHECK_INPUT, this.node);\r\n checkbox.checked = false;\r\n Manipulator.removeClass(this.node, CLASS_NAME_SELECTED);\r\n this.node.setAttribute('aria-selected', false);\r\n this.selected = false;\r\n\r\n if (this.nativeOption) {\r\n this.nativeOption.selected = false;\r\n }\r\n }\r\n }\r\n\r\n setNode(node) {\r\n this.node = node;\r\n }\r\n\r\n setActiveStyles() {\r\n if (!this.active && !this.multiple) {\r\n this.active = true;\r\n Manipulator.addClass(this.node, CLASS_NAME_ACITVE);\r\n }\r\n }\r\n\r\n removeActiveStyles() {\r\n if (this.active) {\r\n this.active = false;\r\n Manipulator.removeClass(this.node, CLASS_NAME_ACITVE);\r\n }\r\n }\r\n}\r\n\r\nexport default SelectOption;\r\n","class SelectionModel {\r\n constructor(multiple = false) {\r\n this._multiple = multiple;\r\n this._selections = [];\r\n }\r\n\r\n select(option) {\r\n if (this._multiple) {\r\n this._selections.push(option);\r\n } else {\r\n this._selections = [option];\r\n }\r\n }\r\n\r\n deselect(option) {\r\n if (this._multiple) {\r\n const optionIndex = this._selections.findIndex((selection) => option === selection);\r\n this._selections.splice(optionIndex, 1);\r\n } else {\r\n this._selections = [];\r\n }\r\n }\r\n\r\n clear() {\r\n this._selections = [];\r\n }\r\n\r\n get selection() {\r\n return this._selections[0];\r\n }\r\n\r\n get selections() {\r\n return this._selections;\r\n }\r\n\r\n get label() {\r\n return this._selections[0] && this.selection.label;\r\n }\r\n\r\n get labels() {\r\n return this._selections.map((selection) => selection.label).join(', ');\r\n }\r\n\r\n get value() {\r\n return this.selections[0] && this.selection.value;\r\n }\r\n\r\n get values() {\r\n return this._selections.map((selection) => selection.value);\r\n }\r\n}\r\n\r\nexport default SelectionModel;\r\n","export default function allOptionsSelected(options) {\r\n return options\r\n .filter((option) => !option.disabled)\r\n .every((option) => {\r\n return option.selected;\r\n });\r\n}\r\n","import { element } from '../../mdb/util/index';\r\nimport Manipulator from '../../mdb/dom/manipulator';\r\nimport allOptionsSelected from './util';\r\n\r\nconst preventKeydown = (event) => {\r\n if (event.code === 'Tab' || event.code === 'Esc') {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n};\r\n\r\nexport function getWrapperTemplate(id, config, label) {\r\n const wrapper = document.createElement('div');\r\n wrapper.setAttribute('id', id);\r\n wrapper.classList.add('select-wrapper');\r\n\r\n const formOutline = element('div');\r\n Manipulator.addClass(formOutline, 'form-outline');\r\n\r\n if (config.formWhite) {\r\n Manipulator.addClass(formOutline, 'form-white');\r\n }\r\n\r\n const input = element('input');\r\n const role = config.filter ? 'combobox' : 'listbox';\r\n const multiselectable = config.multiple ? 'true' : 'false';\r\n const disabled = config.disabled ? 'true' : 'false';\r\n Manipulator.addClass(input, 'form-control');\r\n Manipulator.addClass(input, 'select-input');\r\n\r\n if (config.size === 'sm') {\r\n Manipulator.addClass(input, 'form-control-sm');\r\n }\r\n\r\n if (config.size === 'lg') {\r\n Manipulator.addClass(input, 'form-control-lg');\r\n }\r\n\r\n input.setAttribute('type', 'text');\r\n input.setAttribute('role', role);\r\n input.setAttribute('aria-multiselectable', multiselectable);\r\n input.setAttribute('aria-disabled', disabled);\r\n input.setAttribute('aria-haspopup', 'true');\r\n input.setAttribute('aria-expanded', false);\r\n\r\n if (config.tabIndex) {\r\n input.setAttribute('tabIndex', config.tabIndex);\r\n }\r\n\r\n if (config.disabled) {\r\n input.setAttribute('disabled', '');\r\n }\r\n\r\n if (config.placeholder !== '') {\r\n input.setAttribute('placeholder', config.placeholder);\r\n }\r\n\r\n if (config.validation) {\r\n Manipulator.addStyle(input, { 'pointer-events': 'none', 'caret-color': 'transparent' });\r\n Manipulator.addStyle(formOutline, { cursor: 'pointer' });\r\n } else {\r\n input.setAttribute('readonly', 'true');\r\n }\r\n\r\n if (config.validation) {\r\n input.setAttribute('required', 'true');\r\n input.setAttribute('aria-required', 'true');\r\n input.addEventListener('keydown', preventKeydown);\r\n }\r\n\r\n const validFeedback = element('div');\r\n Manipulator.addClass(validFeedback, 'valid-feedback');\r\n const validFeedBackText = document.createTextNode(`${config.validFeedback}`);\r\n validFeedback.appendChild(validFeedBackText);\r\n\r\n const invalidFeedback = element('div');\r\n Manipulator.addClass(invalidFeedback, 'invalid-feedback');\r\n const invalidFeedBackText = document.createTextNode(`${config.invalidFeedback}`);\r\n invalidFeedback.appendChild(invalidFeedBackText);\r\n\r\n const clearBtn = element('span');\r\n Manipulator.addClass(clearBtn, 'select-clear-btn');\r\n const clearBtnText = document.createTextNode('\\u2715');\r\n clearBtn.appendChild(clearBtnText);\r\n clearBtn.setAttribute('tabindex', '0');\r\n\r\n const arrow = element('span');\r\n Manipulator.addClass(arrow, 'select-arrow');\r\n\r\n formOutline.appendChild(input);\r\n\r\n if (label) {\r\n formOutline.appendChild(label);\r\n }\r\n\r\n if (config.validation) {\r\n formOutline.appendChild(validFeedback);\r\n formOutline.appendChild(invalidFeedback);\r\n }\r\n\r\n if (config.clearButton) {\r\n formOutline.appendChild(clearBtn);\r\n }\r\n\r\n formOutline.appendChild(arrow);\r\n\r\n wrapper.appendChild(formOutline);\r\n return wrapper;\r\n}\r\n\r\nexport function getDropdownTemplate(\r\n id,\r\n config,\r\n width,\r\n height,\r\n selectAllOption,\r\n options,\r\n customContent\r\n) {\r\n const dropdownContainer = document.createElement('div');\r\n dropdownContainer.classList.add('select-dropdown-container');\r\n\r\n dropdownContainer.setAttribute('id', `${id}`);\r\n dropdownContainer.style.width = `${width}px`;\r\n\r\n const dropdown = document.createElement('div');\r\n dropdown.setAttribute('tabindex', 0);\r\n dropdown.classList.add('select-dropdown');\r\n\r\n const optionsWrapper = element('div');\r\n Manipulator.addClass(optionsWrapper, 'select-options-wrapper');\r\n optionsWrapper.style.maxHeight = `${height}px`;\r\n\r\n const optionsList = getOptionsListTemplate(options, selectAllOption, config);\r\n\r\n optionsWrapper.appendChild(optionsList);\r\n\r\n if (config.filter) {\r\n dropdown.appendChild(getFilterTemplate(config.searchPlaceholder));\r\n }\r\n\r\n dropdown.appendChild(optionsWrapper);\r\n\r\n if (customContent) {\r\n dropdown.appendChild(customContent);\r\n }\r\n\r\n dropdownContainer.appendChild(dropdown);\r\n\r\n return dropdownContainer;\r\n}\r\n\r\nexport function getOptionsListTemplate(options, selectAllOption, config) {\r\n const optionsList = element('div');\r\n Manipulator.addClass(optionsList, 'select-options-list');\r\n\r\n let optionsNodes;\r\n\r\n if (config.multiple) {\r\n optionsNodes = getMultipleOptionsNodes(options, selectAllOption, config);\r\n } else {\r\n optionsNodes = getSingleOptionsNodes(options, config);\r\n }\r\n\r\n optionsNodes.forEach((node) => {\r\n optionsList.appendChild(node);\r\n });\r\n\r\n return optionsList;\r\n}\r\n\r\nexport function getFilterTemplate(placeholder) {\r\n const inputGroup = element('div');\r\n Manipulator.addClass(inputGroup, 'input-group');\r\n const input = element('input');\r\n Manipulator.addClass(input, 'form-control');\r\n Manipulator.addClass(input, 'select-filter-input');\r\n input.placeholder = placeholder;\r\n input.setAttribute('role', 'searchbox');\r\n input.setAttribute('type', 'text');\r\n\r\n inputGroup.appendChild(input);\r\n\r\n return inputGroup;\r\n}\r\n\r\nfunction getSingleOptionsNodes(options, config) {\r\n const nodes = getOptionsNodes(options, config);\r\n return nodes;\r\n}\r\n\r\nfunction getMultipleOptionsNodes(options, selectAllOption, config) {\r\n let selectAllNode = null;\r\n\r\n if (config.selectAll) {\r\n selectAllNode = createSelectAllNode(selectAllOption, options, config);\r\n }\r\n const optionsNodes = getOptionsNodes(options, config);\r\n const nodes = selectAllNode ? [selectAllNode, ...optionsNodes] : optionsNodes;\r\n return nodes;\r\n}\r\n\r\nfunction getOptionsNodes(options, config) {\r\n const nodes = [];\r\n\r\n options.forEach((option) => {\r\n const isOptionGroup = option.hasOwnProperty('options');\r\n if (isOptionGroup) {\r\n const group = createOptionGroupTemplate(option, config);\r\n nodes.push(group);\r\n } else {\r\n nodes.push(createOptionTemplate(option, config));\r\n }\r\n });\r\n\r\n return nodes;\r\n}\r\n\r\nfunction createSelectAllNode(option, options, config) {\r\n const isSelected = allOptionsSelected(options);\r\n const optionNode = element('div');\r\n Manipulator.addClass(optionNode, 'select-option');\r\n Manipulator.addClass(optionNode, 'select-all-option');\r\n Manipulator.addStyle(optionNode, { height: `${config.optionHeight}px` });\r\n optionNode.setAttribute('role', 'option');\r\n optionNode.setAttribute('aria-selected', isSelected);\r\n\r\n if (isSelected) {\r\n Manipulator.addClass(optionNode, 'selected');\r\n }\r\n\r\n optionNode.appendChild(getOptionContentTemplate(option, config));\r\n option.setNode(optionNode);\r\n\r\n return optionNode;\r\n}\r\n\r\nfunction createOptionTemplate(option, config) {\r\n if (option.node) {\r\n return option.node;\r\n }\r\n\r\n const optionNode = element('div');\r\n Manipulator.addClass(optionNode, 'select-option');\r\n Manipulator.addStyle(optionNode, { height: `${config.optionHeight}px` });\r\n Manipulator.setDataAttribute(optionNode, 'id', option.id);\r\n optionNode.setAttribute('role', 'option');\r\n optionNode.setAttribute('aria-selected', option.selected);\r\n optionNode.setAttribute('aria-disabled', option.disabled);\r\n\r\n if (option.selected) {\r\n Manipulator.addClass(optionNode, 'selected');\r\n }\r\n\r\n if (option.disabled) {\r\n Manipulator.addClass(optionNode, 'disabled');\r\n }\r\n\r\n if (option.hidden) {\r\n Manipulator.addClass(optionNode, 'd-none');\r\n }\r\n\r\n optionNode.appendChild(getOptionContentTemplate(option, config));\r\n\r\n if (option.icon) {\r\n optionNode.appendChild(getOptionIconTemplate(option));\r\n }\r\n\r\n option.setNode(optionNode);\r\n\r\n return optionNode;\r\n}\r\n\r\nfunction getOptionContentTemplate(option, config) {\r\n const content = element('span');\r\n Manipulator.addClass(content, 'select-option-text');\r\n\r\n const label = document.createTextNode(option.label);\r\n\r\n if (config.multiple) {\r\n content.appendChild(getCheckboxTemplate(option));\r\n }\r\n\r\n content.appendChild(label);\r\n\r\n if (option.secondaryText || typeof option.secondaryText === 'number') {\r\n content.appendChild(getSecondaryTextTemplate(option.secondaryText));\r\n }\r\n\r\n return content;\r\n}\r\n\r\nfunction getSecondaryTextTemplate(text) {\r\n const span = element('span');\r\n Manipulator.addClass(span, 'select-option-secondary-text');\r\n const textContent = document.createTextNode(text);\r\n span.appendChild(textContent);\r\n return span;\r\n}\r\n\r\nfunction getCheckboxTemplate(option) {\r\n const checkbox = element('input');\r\n checkbox.setAttribute('type', 'checkbox');\r\n Manipulator.addClass(checkbox, 'form-check-input');\r\n\r\n const label = element('label');\r\n\r\n if (option.selected) {\r\n checkbox.setAttribute('checked', true);\r\n }\r\n\r\n if (option.disabled) {\r\n checkbox.setAttribute('disabled', true);\r\n }\r\n\r\n checkbox.appendChild(label);\r\n return checkbox;\r\n}\r\n\r\nfunction getOptionIconTemplate(option) {\r\n const container = element('span');\r\n Manipulator.addClass(container, 'select-option-icon-container');\r\n const image = element('img');\r\n Manipulator.addClass(image, 'select-option-icon');\r\n Manipulator.addClass(image, 'rounded-circle');\r\n image.src = option.icon;\r\n\r\n container.appendChild(image);\r\n return container;\r\n}\r\n\r\nfunction createOptionGroupTemplate(optionGroup, config) {\r\n const group = element('div');\r\n Manipulator.addClass(group, 'select-option-group');\r\n group.setAttribute('role', 'group');\r\n group.setAttribute('id', optionGroup.id);\r\n\r\n if (optionGroup.hidden) {\r\n Manipulator.addClass(group, 'd-none');\r\n }\r\n\r\n const label = element('label');\r\n Manipulator.addClass(label, 'select-option-group-label');\r\n Manipulator.addStyle(label, { height: `${config.optionHeight}px` });\r\n label.setAttribute('for', optionGroup.id);\r\n label.textContent = optionGroup.label;\r\n\r\n group.appendChild(label);\r\n\r\n optionGroup.options.forEach((option) => {\r\n group.appendChild(createOptionTemplate(option, config));\r\n });\r\n\r\n return group;\r\n}\r\n\r\nexport function getFakeValueTemplate(value) {\r\n const fakeValue = element('div');\r\n fakeValue.innerHTML = value;\r\n Manipulator.addClass(fakeValue, 'form-label');\r\n Manipulator.addClass(fakeValue, 'select-fake-value');\r\n\r\n return fakeValue;\r\n}\r\n","import { createPopper } from '@popperjs/core';\r\nimport Data from '../../mdb/dom/data';\r\nimport EventHandler from '../../mdb/dom/event-handler';\r\nimport Manipulator from '../../mdb/dom/manipulator';\r\nimport SelectorEngine from '../../mdb/dom/selector-engine';\r\nimport { typeCheckConfig, getjQuery, getUID, onDOMContentLoaded } from '../../mdb/util/index';\r\nimport Input from '../../free/input';\r\nimport SelectOption from './select-option';\r\nimport SelectionModel from './selection-model';\r\nimport { ESCAPE, ENTER, DOWN_ARROW, UP_ARROW, HOME, END, TAB } from '../../mdb/util/keycodes';\r\nimport allOptionsSelected from './util';\r\nimport {\r\n getWrapperTemplate,\r\n getDropdownTemplate,\r\n getOptionsListTemplate,\r\n getFakeValueTemplate,\r\n} from './templates';\r\n\r\nconst Default = {\r\n autoSelect: false,\r\n container: 'body',\r\n clearButton: false,\r\n disabled: false,\r\n displayedLabels: 5,\r\n formWhite: false,\r\n multiple: false,\r\n optionsSelectedLabel: 'options selected',\r\n optionHeight: 38,\r\n selectAll: true,\r\n selectAllLabel: 'Select all',\r\n searchPlaceholder: 'Search...',\r\n size: 'default',\r\n visibleOptions: 5,\r\n filter: false,\r\n filterDebounce: 300,\r\n noResultText: 'No results',\r\n validation: false,\r\n validFeedback: 'Valid',\r\n invalidFeedback: 'Invalid',\r\n placeholder: '',\r\n};\r\n\r\nconst DefaultType = {\r\n autoSelect: 'boolean',\r\n container: 'string',\r\n clearButton: 'boolean',\r\n disabled: 'boolean',\r\n displayedLabels: 'number',\r\n formWhite: 'boolean',\r\n multiple: 'boolean',\r\n optionsSelectedLabel: 'string',\r\n optionHeight: 'number',\r\n selectAll: 'boolean',\r\n selectAllLabel: 'string',\r\n searchPlaceholder: 'string',\r\n size: 'string',\r\n visibleOptions: 'number',\r\n filter: 'boolean',\r\n filterDebounce: 'number',\r\n noResultText: 'string',\r\n validation: 'boolean',\r\n validFeedback: 'string',\r\n invalidFeedback: 'string',\r\n placeholder: '',\r\n};\r\n\r\nconst NAME = 'select';\r\nconst DATA_KEY = 'mdb.select';\r\n\r\nconst EVENT_KEY = `.${DATA_KEY}`;\r\nconst EVENT_CLOSE = `close${EVENT_KEY}`;\r\nconst EVENT_OPEN = `open${EVENT_KEY}`;\r\nconst EVENT_SELECT = `optionSelect${EVENT_KEY}`;\r\nconst EVENT_DESELECT = `optionDeselect${EVENT_KEY}`;\r\nconst EVENT_VALUE_CHANGE = `valueChange${EVENT_KEY}`;\r\nconst EVENT_CHANGE = 'change';\r\n\r\nconst SELECTOR_SELECT = '.select';\r\nconst SELECTOR_LABEL = '.select-label';\r\nconst SELECTOR_INPUT = '.select-input';\r\nconst SELECTOR_FILTER_INPUT = '.select-filter-input';\r\nconst SELECTOR_DROPDOWN = '.select-dropdown';\r\nconst SELECTOR_OPTIONS_WRAPPER = '.select-options-wrapper';\r\nconst SELECTOR_OPTIONS_LIST = '.select-options-list';\r\nconst SELECTOR_OPTION = '.select-option';\r\nconst SELECTOR_CLEAR_BUTTON = '.select-clear-btn';\r\nconst SELECTOR_CUSTOM_CONTENT = '.select-custom-content';\r\nconst SELECTOR_NO_RESULTS = '.select-no-results';\r\nconst SELECTOR_FORM_OUTLINE = '.form-outline';\r\nconst SELECTOR_TOGGLE = '[data-mdb-toggle]';\r\n\r\nconst CLASS_NAME_INITIALIZED = 'select-initialized';\r\nconst CLASS_NAME_OPEN = 'open';\r\nconst CLASS_NAME_ACTIVE = 'active';\r\nconst CLASS_NAME_FOCUSED = 'focused';\r\nconst CLASS_NAME_OPTION_GROUP_LABEL = 'select-option-group-label';\r\nconst CLASS_NAME_SELECT_ALL_OPTION = 'select-all-option';\r\n\r\nconst ANIMATION_TRANSITION_TIME = 200;\r\n\r\nclass Select {\r\n constructor(element, config) {\r\n this._element = element;\r\n this._config = this._getConfig(config);\r\n this._optionsToRender = this._getOptionsToRender(element);\r\n\r\n // optionsToRender may contain option groups and nested options, in this case\r\n // we need a list of plain options to manage selections and keyboard navigation\r\n this._plainOptions = this._getPlainOptions(this._optionsToRender);\r\n this._filteredOptionsList = null;\r\n\r\n this._selectionModel = new SelectionModel(this.multiple);\r\n\r\n this._activeOptionIndex = -1;\r\n this._activeOption = null;\r\n\r\n this._wrapperId = getUID('select-wrapper-');\r\n this._dropdownContainerId = getUID('select-dropdown-container-');\r\n this._selectAllId = getUID('select-all-');\r\n this._debounceTimeoutId = null;\r\n\r\n this._dropdownHeight = this._config.optionHeight * this._config.visibleOptions;\r\n\r\n this._popper = null;\r\n this._input = null;\r\n this._label = SelectorEngine.next(this._element, SELECTOR_LABEL)[0];\r\n this._fakeValue = null;\r\n this._isFakeValueActive = false;\r\n this._customContent = SelectorEngine.next(element, SELECTOR_CUSTOM_CONTENT)[0];\r\n this._toggleButton = null;\r\n this._elementToggle = null;\r\n\r\n this._wrapper = null;\r\n this._inputEl = null;\r\n this._dropdownContainer = null;\r\n this._container = null;\r\n this._selectAllOption = null;\r\n\r\n this._init();\r\n\r\n this._mutationObserver = null;\r\n this._isOpen = false;\r\n\r\n this._addMutationObserver();\r\n\r\n if (this._element) {\r\n Data.setData(element, DATA_KEY, this);\r\n }\r\n }\r\n\r\n static get NAME() {\r\n return NAME;\r\n }\r\n\r\n get filterInput() {\r\n return SelectorEngine.findOne(SELECTOR_FILTER_INPUT, this._dropdownContainer);\r\n }\r\n\r\n get dropdown() {\r\n return SelectorEngine.findOne(SELECTOR_DROPDOWN, this._dropdownContainer);\r\n }\r\n\r\n get optionsList() {\r\n return SelectorEngine.findOne(SELECTOR_OPTIONS_LIST, this._dropdownContainer);\r\n }\r\n\r\n get optionsWrapper() {\r\n return SelectorEngine.findOne(SELECTOR_OPTIONS_WRAPPER, this._dropdownContainer);\r\n }\r\n\r\n get clearButton() {\r\n return SelectorEngine.findOne(SELECTOR_CLEAR_BUTTON, this._wrapper);\r\n }\r\n\r\n get options() {\r\n return this._filteredOptionsList ? this._filteredOptionsList : this._plainOptions;\r\n }\r\n\r\n get value() {\r\n return this.multiple ? this._selectionModel.values : this._selectionModel.value;\r\n }\r\n\r\n get multiple() {\r\n return this._config.multiple;\r\n }\r\n\r\n get hasSelectAll() {\r\n return this.multiple && this._config.selectAll;\r\n }\r\n\r\n get hasSelection() {\r\n return this._selectionModel.selection || this._selectionModel.selections.length > 0;\r\n }\r\n\r\n _getConfig(config) {\r\n const dataAttributes = Manipulator.getDataAttributes(this._element);\r\n\r\n config = {\r\n ...Default,\r\n ...dataAttributes,\r\n ...config,\r\n };\r\n\r\n if (this._element.hasAttribute('multiple')) {\r\n config.multiple = true;\r\n }\r\n\r\n if (this._element.hasAttribute('disabled')) {\r\n config.disabled = true;\r\n }\r\n\r\n if (this._element.tabIndex) {\r\n config.tabIndex = this._element.getAttribute('tabIndex');\r\n }\r\n\r\n typeCheckConfig(NAME, config, DefaultType);\r\n\r\n return config;\r\n }\r\n\r\n _getOptionsToRender(select) {\r\n const options = [];\r\n\r\n const nodes = select.childNodes;\r\n\r\n nodes.forEach((node) => {\r\n if (node.nodeName === 'OPTGROUP') {\r\n const optionGroup = {\r\n id: getUID('group-'),\r\n label: node.label,\r\n disabled: node.hasAttribute('disabled'),\r\n hidden: node.hasAttribute('hidden'),\r\n options: [],\r\n };\r\n const groupOptions = node.childNodes;\r\n groupOptions.forEach((option) => {\r\n if (option.nodeName === 'OPTION') {\r\n optionGroup.options.push(this._createOptionObject(option, optionGroup));\r\n }\r\n });\r\n options.push(optionGroup);\r\n } else if (node.nodeName === 'OPTION') {\r\n options.push(this._createOptionObject(node));\r\n }\r\n });\r\n return options;\r\n }\r\n\r\n _getPlainOptions(optionsToRender) {\r\n const hasOptionGroup = SelectorEngine.findOne('optgroup', this._element);\r\n\r\n if (!hasOptionGroup) {\r\n return optionsToRender;\r\n }\r\n\r\n const options = [];\r\n\r\n optionsToRender.forEach((option) => {\r\n const isOptionGroup = option.hasOwnProperty('options');\r\n if (isOptionGroup) {\r\n option.options.forEach((nestedOption) => {\r\n options.push(nestedOption);\r\n });\r\n } else {\r\n options.push(option);\r\n }\r\n });\r\n\r\n return options;\r\n }\r\n\r\n _createOptionObject(nativeOption, group = {}) {\r\n const id = getUID('option-');\r\n const groupId = group.id ? group.id : null;\r\n const groupDisabled = group.disabled ? group.disabled : false;\r\n const selected = nativeOption.selected || nativeOption.hasAttribute('selected');\r\n const disabled = nativeOption.hasAttribute('disabled') || groupDisabled;\r\n const hidden = nativeOption.hasAttribute('hidden') || (group && group.hidden);\r\n const multiple = this.multiple;\r\n const value = nativeOption.value;\r\n const label = nativeOption.label;\r\n const secondaryText = Manipulator.getDataAttribute(nativeOption, 'secondaryText');\r\n const icon = Manipulator.getDataAttribute(nativeOption, 'icon');\r\n return new SelectOption(\r\n id,\r\n nativeOption,\r\n multiple,\r\n value,\r\n label,\r\n selected,\r\n disabled,\r\n hidden,\r\n secondaryText,\r\n groupId,\r\n icon\r\n );\r\n }\r\n\r\n _getNavigationOptions() {\r\n const availableOptions = this.options.filter((option) => !option.hidden);\r\n\r\n return this.hasSelectAll ? [this._selectAllOption, ...availableOptions] : availableOptions;\r\n }\r\n\r\n _init() {\r\n this._renderMaterialWrapper();\r\n\r\n this._wrapper = SelectorEngine.findOne(`#${this._wrapperId}`);\r\n this._input = SelectorEngine.findOne(SELECTOR_INPUT, this._wrapper);\r\n\r\n const containerSelector = this._config.container;\r\n\r\n if (containerSelector === 'body') {\r\n this._container = document.body;\r\n } else {\r\n this._container = SelectorEngine.findOne(containerSelector);\r\n }\r\n\r\n this._initOutlineInput();\r\n this._setDefaultSelections();\r\n this._updateInputValue();\r\n this._appendFakeValue();\r\n this._updateFakeLabelPosition();\r\n this._updateLabelPosition();\r\n this._updateClearButtonVisibility();\r\n\r\n this._bindComponentEvents();\r\n\r\n if (this.hasSelectAll) {\r\n this._selectAllOption = this._createSelectAllOption();\r\n }\r\n\r\n this._dropdownContainer = getDropdownTemplate(\r\n this._dropdownContainerId,\r\n this._config,\r\n this._input.offsetWidth,\r\n this._dropdownHeight,\r\n this._selectAllOption,\r\n this._optionsToRender,\r\n this._customContent\r\n );\r\n\r\n this._setFirstActiveOption();\r\n }\r\n\r\n _renderMaterialWrapper() {\r\n const template = getWrapperTemplate(this._wrapperId, this._config, this._label);\r\n this._element.parentNode.insertBefore(template, this._element);\r\n Manipulator.addClass(this._element, CLASS_NAME_INITIALIZED);\r\n template.appendChild(this._element);\r\n }\r\n\r\n _initOutlineInput() {\r\n const inputWrapper = SelectorEngine.findOne(SELECTOR_FORM_OUTLINE, this._wrapper);\r\n const outlineInput = new Input(inputWrapper);\r\n outlineInput.init();\r\n }\r\n\r\n _bindComponentEvents() {\r\n this._listenToComponentKeydown();\r\n this._listenToWrapperClick();\r\n this._listenToClearBtnClick();\r\n this._listenToClearBtnKeydown();\r\n }\r\n\r\n _setDefaultSelections() {\r\n this.options.forEach((option) => {\r\n if (option.selected) {\r\n this._selectionModel.select(option);\r\n }\r\n });\r\n }\r\n\r\n _listenToComponentKeydown() {\r\n EventHandler.on(this._wrapper, 'keydown', this._handleKeydown.bind(this));\r\n }\r\n\r\n _handleKeydown(event) {\r\n if (this._isOpen && !this._config.filter) {\r\n this._handleOpenKeydown(event);\r\n } else {\r\n this._handleClosedKeydown(event);\r\n }\r\n }\r\n\r\n _handleOpenKeydown(event) {\r\n const key = event.keyCode;\r\n const isCloseKey = key === ESCAPE || (key === UP_ARROW && event.altKey) || key === TAB;\r\n\r\n if (key === TAB && this._config.autoSelect && !this.multiple) {\r\n this._handleAutoSelection(this._activeOption);\r\n }\r\n\r\n if (isCloseKey) {\r\n this.close();\r\n this._input.focus();\r\n return;\r\n }\r\n\r\n switch (key) {\r\n case DOWN_ARROW:\r\n this._setNextOptionActive();\r\n this._scrollToOption(this._activeOption);\r\n break;\r\n case UP_ARROW:\r\n this._setPreviousOptionActive();\r\n this._scrollToOption(this._activeOption);\r\n break;\r\n case HOME:\r\n this._setFirstOptionActive();\r\n this._scrollToOption(this._activeOption);\r\n break;\r\n case END:\r\n this._setLastOptionActive();\r\n this._scrollToOption(this._activeOption);\r\n break;\r\n case ENTER:\r\n event.preventDefault();\r\n if (this._activeOption) {\r\n if (this.hasSelectAll && this._activeOptionIndex === 0) {\r\n this._handleSelectAll();\r\n } else {\r\n this._handleSelection(this._activeOption);\r\n }\r\n }\r\n return;\r\n default:\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n }\r\n\r\n _handleClosedKeydown(event) {\r\n const key = event.keyCode;\r\n if (key === ENTER) {\r\n event.preventDefault();\r\n }\r\n const isOpenKey =\r\n key === ENTER ||\r\n (key === DOWN_ARROW && event.altKey) ||\r\n (key === DOWN_ARROW && this.multiple);\r\n\r\n if (isOpenKey) {\r\n this.open();\r\n }\r\n\r\n if (!this.multiple) {\r\n switch (key) {\r\n case DOWN_ARROW:\r\n this._setNextOptionActive();\r\n this._handleSelection(this._activeOption);\r\n break;\r\n case UP_ARROW:\r\n this._setPreviousOptionActive();\r\n this._handleSelection(this._activeOption);\r\n break;\r\n case HOME:\r\n this._setFirstOptionActive();\r\n this._handleSelection(this._activeOption);\r\n break;\r\n case END:\r\n this._setLastOptionActive();\r\n this._handleSelection(this._activeOption);\r\n break;\r\n default:\r\n return;\r\n }\r\n } else {\r\n switch (key) {\r\n case DOWN_ARROW:\r\n this.open();\r\n break;\r\n case UP_ARROW:\r\n this.open();\r\n break;\r\n default:\r\n return;\r\n }\r\n }\r\n\r\n event.preventDefault();\r\n }\r\n\r\n _scrollToOption(option) {\r\n if (!option) {\r\n return;\r\n }\r\n\r\n let optionIndex;\r\n\r\n const visibleOptions = this.options.filter((option) => !option.hidden);\r\n\r\n if (this.hasSelectAll) {\r\n optionIndex = visibleOptions.indexOf(option) + 1;\r\n } else {\r\n optionIndex = visibleOptions.indexOf(option);\r\n }\r\n\r\n const groupsNumber = this._getNumberOfGroupsBeforeOption(optionIndex);\r\n\r\n const scrollToIndex = optionIndex + groupsNumber;\r\n\r\n const list = this.optionsWrapper;\r\n const listHeight = list.offsetHeight;\r\n const optionHeight = this._config.optionHeight;\r\n const scrollTop = list.scrollTop;\r\n\r\n if (optionIndex > -1) {\r\n const optionOffset = scrollToIndex * optionHeight;\r\n const isBelow = optionOffset + optionHeight > scrollTop + listHeight;\r\n const isAbove = optionOffset < scrollTop;\r\n\r\n if (isAbove) {\r\n list.scrollTop = optionOffset;\r\n } else if (isBelow) {\r\n list.scrollTop = optionOffset - listHeight + optionHeight;\r\n } else {\r\n list.scrollTop = scrollTop;\r\n }\r\n }\r\n }\r\n\r\n _getNumberOfGroupsBeforeOption(optionIndex) {\r\n const optionsList = this.options.filter((option) => !option.hidden);\r\n const groupsList = this._optionsToRender.filter((group) => !group.hidden);\r\n const index = this.hasSelectAll ? optionIndex - 1 : optionIndex;\r\n let groupsNumber = 0;\r\n\r\n for (let i = 0; i <= index; i++) {\r\n if (\r\n optionsList[i].groupId &&\r\n groupsList[groupsNumber] &&\r\n groupsList[groupsNumber].id &&\r\n optionsList[i].groupId === groupsList[groupsNumber].id\r\n ) {\r\n groupsNumber++;\r\n }\r\n }\r\n\r\n return groupsNumber;\r\n }\r\n\r\n _setNextOptionActive() {\r\n let index = this._activeOptionIndex + 1;\r\n const options = this._getNavigationOptions();\r\n\r\n if (!options[index]) {\r\n return;\r\n }\r\n\r\n while (options[index].disabled) {\r\n index += 1;\r\n\r\n if (!options[index]) {\r\n return;\r\n }\r\n }\r\n\r\n this._updateActiveOption(options[index], index);\r\n }\r\n\r\n _setPreviousOptionActive() {\r\n let index = this._activeOptionIndex - 1;\r\n const options = this._getNavigationOptions();\r\n\r\n if (!options[index]) {\r\n return;\r\n }\r\n\r\n while (options[index].disabled) {\r\n index -= 1;\r\n\r\n if (!options[index]) {\r\n return;\r\n }\r\n }\r\n\r\n this._updateActiveOption(options[index], index);\r\n }\r\n\r\n _setFirstOptionActive() {\r\n const index = 0;\r\n const options = this._getNavigationOptions();\r\n\r\n this._updateActiveOption(options[index], index);\r\n }\r\n\r\n _setLastOptionActive() {\r\n const options = this._getNavigationOptions();\r\n const index = options.length - 1;\r\n\r\n this._updateActiveOption(options[index], index);\r\n }\r\n\r\n _updateActiveOption(newActiveOption, index) {\r\n const currentActiveOption = this._activeOption;\r\n\r\n if (currentActiveOption) {\r\n currentActiveOption.removeActiveStyles();\r\n }\r\n\r\n newActiveOption.setActiveStyles();\r\n this._activeOptionIndex = index;\r\n this._activeOption = newActiveOption;\r\n }\r\n\r\n _listenToWrapperClick() {\r\n EventHandler.on(this._wrapper, 'click', () => {\r\n this.toggle();\r\n });\r\n }\r\n\r\n _listenToClearBtnClick() {\r\n EventHandler.on(this.clearButton, 'click', (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this._handleClear();\r\n });\r\n }\r\n\r\n _listenToClearBtnKeydown() {\r\n EventHandler.on(this.clearButton, 'keydown', (event) => {\r\n if (event.keyCode === ENTER) {\r\n this._handleClear();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n });\r\n }\r\n\r\n _handleClear() {\r\n if (this.multiple) {\r\n this._selectionModel.clear();\r\n this._deselectAllOptions(this.options);\r\n\r\n if (this.hasSelectAll) {\r\n this._updateSelectAllState();\r\n }\r\n } else {\r\n const selected = this._selectionModel.selection;\r\n this._selectionModel.clear();\r\n selected.deselect();\r\n }\r\n this._updateInputValue();\r\n this._updateFakeLabelPosition();\r\n this._updateLabelPosition();\r\n this._updateClearButtonVisibility();\r\n\r\n this._emitValueChangeEvent(null);\r\n this._emitNativeChangeEvent();\r\n }\r\n\r\n _listenToOptionsClick() {\r\n EventHandler.on(this.optionsWrapper, 'click', (event) => {\r\n const optionGroupLabel = event.target.classList.contains(CLASS_NAME_OPTION_GROUP_LABEL);\r\n\r\n if (optionGroupLabel) {\r\n return;\r\n }\r\n\r\n const target =\r\n event.target.nodeName === 'DIV'\r\n ? event.target\r\n : SelectorEngine.closest(event.target, SELECTOR_OPTION);\r\n const selectAllOption = target.classList.contains(CLASS_NAME_SELECT_ALL_OPTION);\r\n\r\n if (selectAllOption) {\r\n this._handleSelectAll();\r\n return;\r\n }\r\n\r\n const id = target.dataset.mdbId;\r\n const option = this.options.find((option) => option.id === id);\r\n\r\n if (option && !option.disabled) {\r\n this._handleSelection(option);\r\n }\r\n });\r\n }\r\n\r\n _handleSelectAll() {\r\n const selected = this._selectAllOption.selected;\r\n\r\n if (selected) {\r\n this._deselectAllOptions(this.options);\r\n this._selectAllOption.deselect();\r\n } else {\r\n this._selectAllOptions(this.options);\r\n this._selectAllOption.select();\r\n }\r\n\r\n this._updateInputValue();\r\n this._updateFakeLabelPosition();\r\n this._updateLabelPosition();\r\n this._updateClearButtonVisibility();\r\n\r\n this._emitValueChangeEvent(this.value);\r\n this._emitNativeChangeEvent();\r\n }\r\n\r\n _selectAllOptions(options) {\r\n options.forEach((option) => {\r\n if (!option.selected && !option.disabled) {\r\n this._selectionModel.select(option);\r\n option.select();\r\n }\r\n });\r\n }\r\n\r\n _deselectAllOptions(options) {\r\n options.forEach((option) => {\r\n if (option.selected && !option.disabled) {\r\n this._selectionModel.deselect(option);\r\n option.deselect();\r\n }\r\n });\r\n }\r\n\r\n _handleSelection(option) {\r\n if (this.multiple) {\r\n this._handleMultiSelection(option);\r\n\r\n if (this.hasSelectAll) {\r\n this._updateSelectAllState();\r\n }\r\n } else {\r\n this._handleSingleSelection(option);\r\n }\r\n\r\n this._updateInputValue();\r\n this._updateFakeLabelPosition();\r\n this._updateLabelPosition();\r\n this._updateClearButtonVisibility();\r\n }\r\n\r\n _handleAutoSelection(option) {\r\n this._singleOptionSelect(option);\r\n this._updateInputValue();\r\n this._updateFakeLabelPosition();\r\n this._updateLabelPosition();\r\n this._updateClearButtonVisibility();\r\n }\r\n\r\n _handleSingleSelection(option) {\r\n this._singleOptionSelect(option);\r\n this.close();\r\n this._input.focus();\r\n }\r\n\r\n _singleOptionSelect(option) {\r\n const currentSelected = this._selectionModel.selections[0];\r\n\r\n if (currentSelected && currentSelected !== option) {\r\n this._selectionModel.deselect(currentSelected);\r\n currentSelected.deselect();\r\n currentSelected.node.setAttribute('selected', false);\r\n EventHandler.trigger(this._element, EVENT_DESELECT, { value: currentSelected.value });\r\n }\r\n\r\n if (!currentSelected || (currentSelected && option !== currentSelected)) {\r\n this._selectionModel.select(option);\r\n option.select();\r\n option.node.setAttribute('selected', true);\r\n EventHandler.trigger(this._element, EVENT_SELECT, { value: option.value });\r\n this._emitValueChangeEvent(this.value);\r\n this._emitNativeChangeEvent();\r\n }\r\n }\r\n\r\n _handleMultiSelection(option) {\r\n if (option.selected) {\r\n this._selectionModel.deselect(option);\r\n option.deselect();\r\n option.node.setAttribute('selected', false);\r\n EventHandler.trigger(this._element, EVENT_DESELECT, { value: option.value });\r\n } else {\r\n this._selectionModel.select(option);\r\n option.select();\r\n option.node.setAttribute('selected', true);\r\n EventHandler.trigger(this._element, EVENT_SELECT, { value: option.value });\r\n }\r\n\r\n this._emitValueChangeEvent(this.value);\r\n this._emitNativeChangeEvent();\r\n }\r\n\r\n _emitValueChangeEvent(value) {\r\n EventHandler.trigger(this._element, EVENT_VALUE_CHANGE, { value });\r\n }\r\n\r\n _emitNativeChangeEvent() {\r\n EventHandler.trigger(this._element, EVENT_CHANGE);\r\n }\r\n\r\n _updateInputValue() {\r\n const labels = this.multiple ? this._selectionModel.labels : this._selectionModel.label;\r\n let value;\r\n\r\n if (\r\n this.multiple &&\r\n this._config.displayedLabels !== -1 &&\r\n this._selectionModel.selections.length > this._config.displayedLabels\r\n ) {\r\n value = `${this._selectionModel.selections.length} ${this._config.optionsSelectedLabel}`;\r\n } else {\r\n value = labels;\r\n }\r\n\r\n if (!this.multiple && !this._isSelectionValid(this._selectionModel.selection)) {\r\n this._input.value = '';\r\n } else if (this._isLabelEmpty(this._selectionModel.selection)) {\r\n this._input.value = ' ';\r\n } else if (value) {\r\n this._input.value = value;\r\n } else {\r\n // prettier-ignore\r\n // eslint-disable-next-line\r\n this.multiple || !this._optionsToRender[0] ? (this._input.value = '') : (this._input.value = this._optionsToRender[0].label);\r\n }\r\n }\r\n\r\n _isSelectionValid(selection) {\r\n if (selection && (selection.disabled || selection.value === '')) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n _isLabelEmpty(selection) {\r\n if (selection && selection.label === '') {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n _appendFakeValue() {\r\n if (!this._selectionModel.selection || this._selectionModel._multiple) {\r\n return;\r\n }\r\n\r\n const value = this._selectionModel.selection.label;\r\n this._fakeValue = getFakeValueTemplate(value);\r\n const inputWrapper = SelectorEngine.findOne(SELECTOR_FORM_OUTLINE, this._wrapper);\r\n inputWrapper.appendChild(this._fakeValue);\r\n }\r\n\r\n _updateLabelPosition() {\r\n const isInitialized = Manipulator.hasClass(this._element, CLASS_NAME_INITIALIZED);\r\n const isValueEmpty = this._input.value !== '';\r\n if (!this._label) {\r\n return;\r\n }\r\n\r\n if (isInitialized && (isValueEmpty || this._isOpen || this._isFakeValueActive)) {\r\n Manipulator.addClass(this._label, CLASS_NAME_ACTIVE);\r\n } else {\r\n Manipulator.removeClass(this._label, CLASS_NAME_ACTIVE);\r\n }\r\n }\r\n\r\n _updateLabelPositionWhileClosing() {\r\n if (!this._label) {\r\n return;\r\n }\r\n\r\n if (this._input.value !== '' || this._isFakeValueActive) {\r\n Manipulator.addClass(this._label, CLASS_NAME_ACTIVE);\r\n } else {\r\n Manipulator.removeClass(this._label, CLASS_NAME_ACTIVE);\r\n }\r\n }\r\n\r\n _updateFakeLabelPosition() {\r\n if (!this._fakeValue) {\r\n return;\r\n }\r\n\r\n if (this._input.value === '' && this._fakeValue.innerHTML !== '') {\r\n this._isFakeValueActive = true;\r\n Manipulator.addClass(this._fakeValue, CLASS_NAME_ACTIVE);\r\n } else {\r\n this._isFakeValueActive = false;\r\n Manipulator.removeClass(this._fakeValue, CLASS_NAME_ACTIVE);\r\n }\r\n }\r\n\r\n _updateClearButtonVisibility() {\r\n if (!this.clearButton) {\r\n return;\r\n }\r\n\r\n const hasSelection =\r\n this._selectionModel.selection || this._selectionModel.selections.length > 0;\r\n\r\n if (hasSelection) {\r\n Manipulator.addStyle(this.clearButton, { display: 'block' });\r\n } else {\r\n Manipulator.addStyle(this.clearButton, { display: 'none' });\r\n }\r\n }\r\n\r\n _updateSelectAllState() {\r\n const selectAllSelected = this._selectAllOption.selected;\r\n const allSelected = allOptionsSelected(this.options);\r\n if (!allSelected && selectAllSelected) {\r\n this._selectAllOption.deselect();\r\n } else if (allSelected && !selectAllSelected) {\r\n this._selectAllOption.select();\r\n }\r\n }\r\n\r\n toggle() {\r\n if (this._isOpen) {\r\n this.close();\r\n } else {\r\n this.open();\r\n }\r\n }\r\n\r\n open() {\r\n const isDisabled = this._config.disabled;\r\n const openEvent = EventHandler.trigger(this._element, EVENT_OPEN);\r\n\r\n if (this._isOpen || isDisabled || openEvent.defaultPrevented) {\r\n return;\r\n }\r\n\r\n this._openDropdown();\r\n this._updateDropdownWidth();\r\n this._setFirstActiveOption();\r\n this._scrollToOption(this._activeOption);\r\n\r\n if (this._config.filter) {\r\n // We need to wait for popper initialization, otherwise\r\n // dates container will be focused before popper position\r\n // update which can change the scroll position on the page\r\n setTimeout(() => {\r\n this.filterInput.focus();\r\n }, 0);\r\n\r\n this._listenToSelectSearch();\r\n\r\n // New listener for dropdown navigation is needed, because\r\n // we focus search input inside dropdown template, wchich is\r\n // appended to the body. In this case listener attached to the\r\n // select wrapper won't work\r\n this._listenToDropdownKeydown();\r\n }\r\n\r\n this._listenToOptionsClick();\r\n this._listenToOutsideClick();\r\n this._listenToWindowResize();\r\n\r\n this._isOpen = true;\r\n\r\n this._updateLabelPosition();\r\n this._setInputActiveStyles();\r\n }\r\n\r\n _openDropdown() {\r\n this._popper = createPopper(this._input, this._dropdownContainer, {\r\n placement: 'bottom-start',\r\n modifiers: [\r\n {\r\n name: 'offset',\r\n options: {\r\n offset: [0, 1],\r\n },\r\n },\r\n ],\r\n });\r\n this._container.appendChild(this._dropdownContainer);\r\n\r\n // We need to add delay to wait for the popper initialization\r\n // and position update\r\n setTimeout(() => {\r\n Manipulator.addClass(this.dropdown, CLASS_NAME_OPEN);\r\n }, 0);\r\n }\r\n\r\n _updateDropdownWidth() {\r\n const inputWidth = this._input.offsetWidth;\r\n Manipulator.addStyle(this._dropdownContainer, { width: `${inputWidth}px` });\r\n }\r\n\r\n _setFirstActiveOption() {\r\n const options = this._getNavigationOptions();\r\n const currentActive = this._activeOption;\r\n\r\n if (currentActive) {\r\n currentActive.removeActiveStyles();\r\n }\r\n\r\n const firstSelected = this.multiple\r\n ? this._selectionModel.selections[0]\r\n : this._selectionModel.selection;\r\n\r\n if (firstSelected) {\r\n this._activeOption = firstSelected;\r\n firstSelected.setActiveStyles();\r\n this._activeOptionIndex = options.findIndex((option) => option === firstSelected);\r\n } else {\r\n this._activeOption = null;\r\n this._activeOptionIndex = -1;\r\n }\r\n }\r\n\r\n _setInputActiveStyles() {\r\n Manipulator.addClass(this._input, CLASS_NAME_FOCUSED);\r\n }\r\n\r\n _listenToWindowResize() {\r\n EventHandler.on(window, 'resize', this._handleWindowResize.bind(this));\r\n }\r\n\r\n _handleWindowResize() {\r\n if (this._dropdownContainer) {\r\n this._updateDropdownWidth();\r\n }\r\n }\r\n\r\n _listenToSelectSearch() {\r\n this.filterInput.addEventListener('input', (event) => {\r\n const searchTerm = event.target.value;\r\n const debounceTime = this._config.filterDebounce;\r\n this._debounceFilter(searchTerm, debounceTime);\r\n });\r\n }\r\n\r\n _debounceFilter(searchTerm, debounceTime) {\r\n if (this._debounceTimeoutId) {\r\n clearTimeout(this._debounceTimeoutId);\r\n }\r\n\r\n this._debounceTimeoutId = setTimeout(() => {\r\n this._filterOptions(searchTerm);\r\n }, debounceTime);\r\n }\r\n\r\n _filterOptions(searchTerm) {\r\n const filtered = [];\r\n\r\n this._optionsToRender.forEach((option) => {\r\n const isOptionGroup = option.hasOwnProperty('options');\r\n const isValidOption =\r\n !isOptionGroup && option.label.toLowerCase().includes(searchTerm.toLowerCase());\r\n const group = {};\r\n\r\n if (isOptionGroup) {\r\n group.label = option.label;\r\n group.options = this._filter(searchTerm, option.options);\r\n\r\n if (group.options.length > 0) {\r\n filtered.push(group);\r\n }\r\n }\r\n\r\n if (isValidOption) {\r\n filtered.push(option);\r\n }\r\n });\r\n\r\n const hasNoResultsText = this._config.noResultText !== '';\r\n const hasFilteredOptions = filtered.length !== 0;\r\n\r\n if (hasFilteredOptions) {\r\n this._updateOptionsListTemplate(filtered);\r\n this._popper.forceUpdate();\r\n this._filteredOptionsList = this._getPlainOptions(filtered);\r\n\r\n if (this.hasSelectAll) {\r\n this._updateSelectAllState();\r\n }\r\n\r\n this._setFirstActiveOption();\r\n } else if (!hasFilteredOptions && hasNoResultsText) {\r\n const noResultsTemplate = this._getNoResultTemplate();\r\n this.optionsWrapper.innerHTML = noResultsTemplate;\r\n }\r\n }\r\n\r\n _updateOptionsListTemplate(optionsToRender) {\r\n const optionsWrapperContent =\r\n SelectorEngine.findOne(SELECTOR_OPTIONS_LIST, this._dropdownContainer) ||\r\n SelectorEngine.findOne(SELECTOR_NO_RESULTS, this._dropdownContainer);\r\n\r\n const optionsListTemplate = getOptionsListTemplate(\r\n optionsToRender,\r\n this._selectAllOption,\r\n this._config\r\n );\r\n this.optionsWrapper.removeChild(optionsWrapperContent);\r\n this.optionsWrapper.appendChild(optionsListTemplate);\r\n }\r\n\r\n _getNoResultTemplate() {\r\n return `${this._config.noResultText}
`;\r\n }\r\n\r\n _filter(value, options) {\r\n const filterValue = value.toLowerCase();\r\n return options.filter((option) => option.label.toLowerCase().includes(filterValue));\r\n }\r\n\r\n _listenToDropdownKeydown() {\r\n EventHandler.on(this.dropdown, 'keydown', this._handleOpenKeydown.bind(this));\r\n }\r\n\r\n _listenToOutsideClick() {\r\n this._outsideClick = this._handleOutSideClick.bind(this);\r\n EventHandler.on(document, 'click', this._outsideClick);\r\n }\r\n\r\n _handleOutSideClick(event) {\r\n const isSelectContent = this._wrapper && this._wrapper.contains(event.target);\r\n const isDropdown = event.target === this._dropdownContainer;\r\n const isDropdownContent =\r\n this._dropdownContainer && this._dropdownContainer.contains(event.target);\r\n\r\n let isButton;\r\n if (!this._toggleButton) {\r\n this._elementToggle = SelectorEngine.find(SELECTOR_TOGGLE);\r\n }\r\n if (this._elementToggle) {\r\n this._elementToggle.forEach((button) => {\r\n const attributes = Manipulator.getDataAttribute(button, 'toggle');\r\n if (attributes === this._element.id || this._element.classList.contains(attributes)) {\r\n this._toggleButton = button;\r\n isButton = this._toggleButton.contains(event.target);\r\n }\r\n });\r\n }\r\n\r\n if (!isSelectContent && !isDropdown && !isDropdownContent && !isButton) {\r\n this.close();\r\n }\r\n }\r\n\r\n close() {\r\n const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);\r\n\r\n if (!this._isOpen || closeEvent.defaultPrevented) {\r\n return;\r\n }\r\n\r\n if (this._config.filter && this.hasSelectAll) {\r\n this._resetFilterState();\r\n this._updateOptionsListTemplate(this._optionsToRender);\r\n if (this._config.multiple) {\r\n this._updateSelectAllState();\r\n }\r\n }\r\n\r\n this._removeDropdownEvents();\r\n\r\n Manipulator.removeClass(this.dropdown, CLASS_NAME_OPEN);\r\n\r\n setTimeout(() => {\r\n Manipulator.removeClass(this._input, CLASS_NAME_FOCUSED);\r\n if (this._label && !this.hasSelection) {\r\n Manipulator.removeClass(this._label, CLASS_NAME_ACTIVE);\r\n Manipulator.removeClass(this._input, CLASS_NAME_ACTIVE);\r\n }\r\n this._updateLabelPositionWhileClosing();\r\n }, 0);\r\n\r\n setTimeout(() => {\r\n if (this._container && this._dropdownContainer.parentNode === this._container) {\r\n this._container.removeChild(this._dropdownContainer);\r\n }\r\n this._popper.destroy();\r\n this._isOpen = false;\r\n EventHandler.off(this.dropdown, 'transitionend');\r\n }, ANIMATION_TRANSITION_TIME);\r\n }\r\n\r\n _resetFilterState() {\r\n this.filterInput.value = '';\r\n this._filteredOptionsList = null;\r\n }\r\n\r\n _removeDropdownEvents() {\r\n EventHandler.off(document, 'click', this._outsideClick);\r\n\r\n if (this._config.filter) {\r\n EventHandler.off(this.dropdown, 'keydown');\r\n }\r\n\r\n EventHandler.off(this.optionsWrapper, 'click');\r\n }\r\n\r\n _addMutationObserver() {\r\n this._mutationObserver = new MutationObserver(() => {\r\n if (this._wrapper) {\r\n this._updateSelections();\r\n this._updateDisabledState();\r\n }\r\n });\r\n\r\n this._observeMutationObserver();\r\n }\r\n\r\n _updateSelections() {\r\n this._optionsToRender = this._getOptionsToRender(this._element);\r\n this._plainOptions = this._getPlainOptions(this._optionsToRender);\r\n this._selectionModel.clear();\r\n this._setDefaultSelections();\r\n this._updateInputValue();\r\n this._updateFakeLabelPosition();\r\n this._updateLabelPosition();\r\n this._updateClearButtonVisibility();\r\n\r\n if (this.hasSelectAll) {\r\n this._updateSelectAllState();\r\n }\r\n\r\n const hasFilterValue = this._config.filter && this.filterInput && this.filterInput.value;\r\n\r\n if (this._isOpen && !hasFilterValue) {\r\n this._updateOptionsListTemplate(this._optionsToRender);\r\n this._setFirstActiveOption();\r\n } else if (this._isOpen && hasFilterValue) {\r\n this._filterOptions(this.filterInput.value);\r\n this._setFirstActiveOption();\r\n } else {\r\n this._dropdownContainer = getDropdownTemplate(\r\n this._dropdownContainerId,\r\n this._config,\r\n this._input.offsetWidth,\r\n this._dropdownHeight,\r\n this._selectAllOption,\r\n this._optionsToRender,\r\n this._customContent\r\n );\r\n }\r\n }\r\n\r\n _updateDisabledState() {\r\n const input = SelectorEngine.findOne(SELECTOR_INPUT, this._wrapper);\r\n\r\n if (this._element.hasAttribute('disabled')) {\r\n this._config.disabled = true;\r\n input.setAttribute('disabled', '');\r\n } else {\r\n this._config.disabled = false;\r\n input.removeAttribute('disabled');\r\n }\r\n }\r\n\r\n _observeMutationObserver() {\r\n if (!this._mutationObserver) {\r\n return;\r\n }\r\n\r\n this._mutationObserver.observe(this._element, {\r\n attributes: true,\r\n childList: true,\r\n characterData: true,\r\n subtree: true,\r\n });\r\n }\r\n\r\n _disconnectMutationObserver() {\r\n if (this.mutationObserver) {\r\n this._mutationObserver.disconnect();\r\n this._mutationObserver = null;\r\n }\r\n }\r\n\r\n _createSelectAllOption() {\r\n const id = this._selectAllId;\r\n const nativeOption = null;\r\n const multiple = true;\r\n const value = 'select-all';\r\n const label = this._config.selectAllLabel;\r\n const selected = allOptionsSelected(this.options);\r\n const disabled = false;\r\n const hidden = false;\r\n const secondaryText = null;\r\n const groupId = null;\r\n const icon = null;\r\n\r\n return new SelectOption(\r\n id,\r\n nativeOption,\r\n multiple,\r\n value,\r\n label,\r\n selected,\r\n disabled,\r\n hidden,\r\n secondaryText,\r\n groupId,\r\n icon\r\n );\r\n }\r\n\r\n dispose() {\r\n this._removeComponentEvents();\r\n\r\n this._destroyMaterialSelect();\r\n\r\n Data.removeData(this._element, DATA_KEY);\r\n }\r\n\r\n _removeComponentEvents() {\r\n EventHandler.off(this.input, 'click');\r\n EventHandler.off(this.wrapper, this._handleKeydown.bind(this));\r\n EventHandler.off(this.clearButton, 'click');\r\n EventHandler.off(this.clearButton, 'keydown');\r\n EventHandler.off(window, 'resize', this._handleWindowResize.bind(this));\r\n }\r\n\r\n _destroyMaterialSelect() {\r\n if (this._isOpen) {\r\n this.close();\r\n }\r\n\r\n this._destroyMaterialTemplate();\r\n }\r\n\r\n _destroyMaterialTemplate() {\r\n const wrapperParent = this._wrapper.parentNode;\r\n const labels = SelectorEngine.find('label', this._wrapper);\r\n\r\n wrapperParent.appendChild(this._element);\r\n labels.forEach((label) => {\r\n wrapperParent.appendChild(label);\r\n });\r\n\r\n labels.forEach((label) => {\r\n Manipulator.removeClass(label, CLASS_NAME_ACTIVE);\r\n });\r\n Manipulator.removeClass(this._element, CLASS_NAME_INITIALIZED);\r\n wrapperParent.removeChild(this._wrapper);\r\n }\r\n\r\n setValue(value) {\r\n this.options\r\n .filter((option) => option.selected)\r\n .forEach((selection) => (selection.nativeOption.selected = false));\r\n\r\n const isMultipleValue = Array.isArray(value);\r\n\r\n if (isMultipleValue) {\r\n value.forEach((selectionValue) => {\r\n this._selectByValue(selectionValue);\r\n });\r\n } else {\r\n this._selectByValue(value);\r\n }\r\n\r\n this._updateSelections();\r\n }\r\n\r\n _selectByValue(value) {\r\n const correspondingOption = this.options.find((option) => option.value === value);\r\n if (!correspondingOption) {\r\n return false;\r\n }\r\n correspondingOption.nativeOption.selected = true;\r\n return true;\r\n }\r\n\r\n static jQueryInterface(config, options) {\r\n return this.each(function () {\r\n let data = Data.getData(this, DATA_KEY);\r\n const _config = typeof config === 'object' && config;\r\n\r\n if (!data && /dispose/.test(config)) {\r\n return;\r\n }\r\n\r\n if (!data) {\r\n data = new Select(this, _config);\r\n }\r\n\r\n if (typeof config === 'string') {\r\n if (typeof data[config] === 'undefined') {\r\n throw new TypeError(`No method named \"${config}\"`);\r\n }\r\n\r\n data[config](options);\r\n }\r\n });\r\n }\r\n\r\n static getInstance(element) {\r\n return Data.getData(element, DATA_KEY);\r\n }\r\n\r\n static getOrCreateInstance(element, config = {}) {\r\n return (\r\n this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)\r\n );\r\n }\r\n}\r\n\r\nexport default Select;\r\n\r\nconst $ = getjQuery();\r\n\r\nSelectorEngine.find(SELECTOR_SELECT).forEach((select) => {\r\n let instance = Select.getInstance(select);\r\n if (!instance) {\r\n instance = new Select(select);\r\n }\r\n});\r\n\r\n/**\r\n * ------------------------------------------------------------------------\r\n * jQuery\r\n * ------------------------------------------------------------------------\r\n * add .timepicker to jQuery only if jQuery is present\r\n */\r\n\r\nonDOMContentLoaded(() => {\r\n if ($) {\r\n const JQUERY_NO_CONFLICT = $.fn[NAME];\r\n $.fn[NAME] = Select.jQueryInterface;\r\n $.fn[NAME].Constructor = Select;\r\n $.fn[NAME].noConflict = () => {\r\n $.fn[NAME] = JQUERY_NO_CONFLICT;\r\n return Select.jQueryInterface;\r\n };\r\n }\r\n});\r\n","export const LEFT_ARROW = 37;\r\nexport const UP_ARROW = 38;\r\nexport const RIGHT_ARROW = 39;\r\nexport const DOWN_ARROW = 40;\r\nexport const HOME = 36;\r\nexport const END = 35;\r\nexport const PAGE_UP = 33;\r\nexport const PAGE_DOWN = 34;\r\nexport const ENTER = 13;\r\nexport const SPACE = 32;\r\nexport const ESCAPE = 27;\r\nexport const TAB = 9;\r\nexport const BACKSPACE = 8;\r\nexport const DELETE = 46;\r\nexport const A = 65;\r\nexport const B = 66;\r\nexport const C = 67;\r\nexport const D = 68;\r\nexport const E = 69;\r\nexport const F = 70;\r\nexport const G = 71;\r\nexport const H = 72;\r\nexport const I = 73;\r\nexport const J = 74;\r\nexport const K = 75;\r\nexport const L = 76;\r\nexport const M = 77;\r\nexport const N = 78;\r\nexport const O = 79;\r\nexport const P = 80;\r\nexport const Q = 81;\r\nexport const R = 82;\r\nexport const S = 83;\r\nexport const T = 84;\r\nexport const U = 85;\r\nexport const V = 86;\r\nexport const W = 87;\r\nexport const X = 88;\r\nexport const Y = 89;\r\nexport const Z = 90;\r\n"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 115);\n"],"sourceRoot":""}