',\n trigger: 'hover focus',\n offset: 0,\n};\n\nexport default class Tooltip {\n /**\n * Create a new Tooltip.js instance\n * @class Tooltip\n * @param {HTMLElement} reference - The reference element used to position the tooltip\n * @param {Object} options\n * @param {String} options.placement=bottom\n * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),\n * left(-start, -end)`\n *\n * @param {HTMLElement} reference - The DOM node used as reference of the tooltip (it can be a jQuery element).\n * @param {Object} options - Configuration of the tooltip\n * @param {HTMLElement|String|false} options.container=false - Append the tooltip to a specific element.\n * @param {Number|Object} options.delay=0\n * Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type.\n * If a number is supplied, delay is applied to both hide/show.\n * Object structure is: `{ show: 500, hide: 100 }`\n * @param {Boolean} options.html=false - Insert HTML into the tooltip. If false, the content will inserted with `innerText`.\n * @param {String|PlacementFunction} options.placement='top' - One of the allowed placements, or a function returning one of them.\n * @param {String} options.template='
'\n * Base HTML to used when creating the tooltip.\n * The tooltip's `title` will be injected into the `.tooltip-inner` or `.tooltip__inner`.\n * `.tooltip-arrow` or `.tooltip__arrow` will become the tooltip's arrow.\n * The outermost wrapper element should have the `.tooltip` class.\n * @param {String|HTMLElement|TitleFunction} options.title='' - Default title value if `title` attribute isn't present.\n * @param {String} options.trigger='hover focus'\n * How tooltip is triggered - click | hover | focus | manual.\n * You may pass multiple triggers; separate them with a space. `manual` cannot be combined with any other trigger.\n * @param {HTMLElement} options.boundariesElement\n * The element used as boundaries for the tooltip. For more information refer to Popper.js'\n * [boundariesElement docs](https://popper.js.org/popper-documentation.html)\n * @param {Number|String} options.offset=0 - Offset of the tooltip relative to its reference. For more information refer to Popper.js'\n * [offset docs](https://popper.js.org/popper-documentation.html)\n * @return {Object} instance - The generated tooltip instance\n */\n constructor(reference, options) {\n // apply user options over default ones\n options = {...DEFAULT_OPTIONS, ...options};\n\n reference.jquery && (reference = reference[0]);\n\n // cache reference and options\n this.reference = reference;\n this.options = options;\n\n // get events list\n const events = typeof options.trigger === 'string' ? options.trigger.split(' ').filter((trigger) => {\n return ['click', 'hover', 'focus'].indexOf(trigger) !== -1;\n }) : [];\n\n // set initial state\n this._isOpen = false;\n\n // set event listeners\n this._setEventListeners(reference, events, options);\n }\n\n //\n // Public methods\n //\n\n /**\n * Reveals an element's tooltip. This is considered a \"manual\" triggering of the tooltip.\n * Tooltips with zero-length titles are never displayed.\n * @memberof Tooltip\n */\n show = () => this._show(this.reference, this.options);\n\n /**\n * Hides an element’s tooltip. This is considered a “manual” triggering of the tooltip.\n * @memberof Tooltip\n */\n hide = () => this._hide();\n\n /**\n * Hides and destroys an element’s tooltip.\n * @memberof Tooltip\n */\n dispose = () => this._dispose();\n\n /**\n * Toggles an element’s tooltip. This is considered a “manual” triggering of the tooltip.\n * @memberof Tooltip\n */\n toggle = () => {\n if (this._isOpen) {\n return this.hide();\n } else {\n return this.show();\n }\n }\n\n //\n // Defaults\n //\n arrowSelector = '.tooltip-arrow, .tooltip__arrow';\n innerSelector = '.tooltip-inner, .tooltip__inner';\n\n //\n // Private methods\n //\n\n _events = [];\n\n /**\n * Creates a new tooltip node\n * @memberof Tooltip\n * @private\n * @param {HTMLElement} reference\n * @param {String} template\n * @param {String|HTMLElement|TitleFunction} title\n * @param {Boolean} allowHtml\n * @return {HTMLelement} tooltipNode\n */\n _create(reference, template, title, allowHtml) {\n // create tooltip element\n const tooltipGenerator = window.document.createElement('div');\n tooltipGenerator.innerHTML = template;\n const tooltipNode = tooltipGenerator.childNodes[0];\n\n // add title to tooltip\n const titleNode = tooltipGenerator.querySelector(this.innerSelector);\n if (title.nodeType === 1) {\n // if title is a node, append it only if allowHtml is true\n allowHtml && titleNode.appendChild(title);\n }\n else if (Popper.Utils.isFunction(title)) {\n // if title is a function, call it and set innerText or innerHtml depending by `allowHtml` value\n const titleText = title.call(reference);\n allowHtml ? (titleNode.innerHTML = titleText) : (titleNode.innerText = titleText);\n }\n else {\n // if it's just a simple text, set innerText or innerHtml depending by `allowHtml` value\n allowHtml ? (titleNode.innerHTML = title) : (titleNode.innerText = title);\n }\n\n // return the generated tooltip node\n return tooltipNode;\n }\n\n _show(reference, options) {\n // don't show if it's already visible\n if (this._isOpen) { return this; }\n this._isOpen = true;\n\n // if the tooltipNode already exists, just show it\n if (this._tooltipNode) {\n this._tooltipNode.style.display = '';\n this.popperInstance.update();\n return this;\n }\n\n // get title\n const title = reference.getAttribute('title') || options.title;\n\n // don't show tooltip if no title is defined\n if (!title) { return this; }\n\n // create tooltip node\n const tooltipNode = this._create(reference, options.template, title, options.html);\n\n // append tooltip to container: container = false we pick the parent node of the reference\n var container = options.container === false ? reference.parentNode : options.container;\n\n this._append(tooltipNode, container);\n\n const popperOptions = {\n placement: options.placement,\n arrowElement: this.arrowSelector,\n };\n\n if (options.boundariesElement) {\n popperOptions.boundariesElement = options.boundariesElement;\n }\n\n this.popperInstance = new Popper(reference, tooltipNode, popperOptions);\n\n this._tooltipNode = tooltipNode;\n\n return this;\n }\n\n\n _hide(/*reference, options*/) {\n // don't hide if it's already hidden\n if (!this._isOpen) { return this; }\n\n this._isOpen = false;\n\n // hide tooltipNode\n this._tooltipNode.style.display = 'none';\n\n return this;\n }\n\n _dispose() {\n if (this._tooltipNode) {\n this._hide();\n\n // destroy instance\n this.popperInstance.destroy();\n\n // remove event listeners\n this._events.forEach(({func, event }) => {\n this._tooltipNode.removeEventListener(event, func);\n });\n this._events = [];\n\n // destroy tooltipNode\n this._tooltipNode.parentNode.removeChild(this._tooltipNode);\n this._tooltipNode = null;\n }\n return this;\n }\n\n _findContainer(container) {\n // if container is a query, get the relative element\n if (typeof container === 'string') {\n container = window.document.querySelector(container);\n }\n // if container is `false`, set it to body\n else if (container === false) {\n container = window.document.body;\n }\n return container;\n }\n\n /**\n * Append tooltip to container\n * @memberof Tooltip\n * @private\n * @param {HTMLElement} tooltip\n * @param {HTMLElement|String|false} container\n */\n _append(tooltipNode, container) {\n container.appendChild(tooltipNode);\n }\n\n _setEventListeners(reference, events, options) {\n const directEvents = events.map((event) => {\n switch(event) {\n case 'hover':\n return 'mouseenter';\n case 'focus':\n return 'focus';\n case 'click':\n return 'click';\n default:\n return;\n }\n });\n\n const oppositeEvents = events.map((event) => {\n switch(event) {\n case 'hover':\n return 'mouseleave';\n case 'focus':\n return 'blur';\n case 'click':\n return 'click';\n default:\n return;\n }\n }).filter(event => !!event);\n\n // schedule show tooltip\n directEvents.forEach((event) => {\n const func = (evt) => {\n if (this._isOpen === true) { return; }\n evt.usedByTooltip = true;\n this._scheduleShow(reference, options.delay, options, evt);\n };\n this._events.push({ event, func });\n reference.addEventListener(event, func);\n });\n\n // schedule hide tooltip\n oppositeEvents.forEach((event) => {\n const func = (evt) => {\n if (evt.usedByTooltip === true) { return; }\n this._scheduleHide(reference, options.delay, options, evt);\n };\n this._events.push({ event, func });\n reference.addEventListener(event, func);\n });\n }\n\n _scheduleShow(reference, delay, options/*, evt */) {\n // defaults to 0\n const computedDelay = (delay && delay.show) || delay || 0;\n window.setTimeout(() => this._show(reference, options), computedDelay);\n }\n\n _scheduleHide(reference, delay, options, evt) {\n // defaults to 0\n const computedDelay = (delay && delay.hide) || delay || 0;\n window.setTimeout(() => {\n if (this._isOpen === false) { return; }\n if (!document.body.contains(this._tooltipNode)) { return; }\n\n // if we are hiding because of a mouseleave, we must check that the new\n // reference isn't the tooltip, because in this case we don't want to hide it\n if (evt.type === 'mouseleave') {\n const isSet = this._setTooltipNodeEvent(evt, reference, delay, options);\n\n // if we set the new event, don't hide the tooltip yet\n // the new event will take care to hide it if necessary\n if (isSet) { return; }\n }\n\n this._hide(reference, options);\n }, computedDelay);\n }\n\n _setTooltipNodeEvent = (evt, reference, delay, options) => {\n const relatedreference = evt.relatedreference || evt.toElement;\n\n const callback = (evt2) => {\n const relatedreference2 = evt2.relatedreference || evt2.toElement;\n\n // Remove event listener after call\n this._tooltipNode.removeEventListener(evt.type, callback);\n\n // If the new reference is not the reference element\n if (!this._isElOrChildOfEl(relatedreference2, reference)) {\n\n // Schedule to hide tooltip\n this._scheduleHide(reference, options.delay, options, evt2);\n }\n };\n\n if (this._isElOrChildOfEl(relatedreference, this._tooltipNode)) {\n // listen to mouseleave on the tooltip element to be able to hide the tooltip\n this._tooltipNode.addEventListener(evt.type, callback);\n return true;\n }\n\n return false;\n }\n\n _isElOrChildOfEl(a, b) {\n return a === b || b.contains(a);\n }\n}\n\n\n/**\n * Placement function, its context is the Tooltip instance.\n * @memberof Tooltip\n * @callback PlacementFunction\n * @param {HTMLElement} tooltip - tooltip DOM node.\n * @param {HTMLElement} reference - reference DOM node.\n * @return {String} placement - One of the allowed placement options.\n */\n\n/**\n * Title function, its context is the Tooltip instance.\n * @memberof Tooltip\n * @callback TitleFunction\n * @return {String} placement - The desired title.\n */\n"],"names":["DEFAULT_OPTIONS","Tooltip","reference","options","jquery","events","trigger","split","filter","indexOf","_isOpen","_setEventListeners","template","title","allowHtml","tooltipGenerator","window","document","createElement","innerHTML","tooltipNode","childNodes","titleNode","querySelector","innerSelector","nodeType","appendChild","Popper","Utils","isFunction","titleText","call","innerText","_tooltipNode","style","display","popperInstance","update","getAttribute","_create","html","container","parentNode","_append","popperOptions","placement","arrowSelector","boundariesElement","_hide","destroy","_events","forEach","func","event","removeEventListener","removeChild","body","directEvents","map","oppositeEvents","evt","usedByTooltip","_scheduleShow","delay","push","addEventListener","_scheduleHide","computedDelay","show","setTimeout","_show","hide","contains","type","isSet","_setTooltipNodeEvent","a","b","dispose","_dispose","toggle","relatedreference","toElement","callback","evt2","relatedreference2","_isElOrChildOfEl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,kBAAkB;eACT,KADS;WAEb,CAFa;UAGd,KAHc;eAIT,KAJS;WAKb,EALa;cAMV,8GANU;aAOX,aAPW;YAQZ;CARZ;;IA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