',\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 unique ID to our tooltip (needed for accessibility reasons)\n tooltipNode.id = `tooltip_${Math.random().toString(36).substr(2, 10)}`;\n\n // set initial `aria-hidden` state to `false` (it's visible!)\n tooltipNode.setAttribute('aria-hidden', 'false');\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._tooltipNode.setAttribute('aria-hidden', 'false');\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 // Add `aria-describedby` to our reference element for accessibility reasons\n tooltipNode.setAttribute('aria-describedby', tooltipNode.id);\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 this._tooltipNode.setAttribute('aria-hidden', 'true');\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","id","Math","random","toString","substr","setAttribute","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","_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