{"version":3,"sources":["Shared/Static/js/lib/tooltip.js"],"names":["global","factory","exports","module","require","define","amd","Tooltip","Popper","this","hasOwnProperty","classCallCheck","instance","Constructor","TypeError","createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","_extends","assign","arguments","source","call","DEFAULT_OPTIONS","container","delay","html","placement","title","template","trigger","offset","arrowSelector","innerSelector","reference","options","_initialiseProps","jquery","events","split","filter","indexOf","_isOpen","_popperOptions","_setEventListeners","value","allowHtml","tooltipGenerator","window","document","createElement","innerHTML","trim","tooltipNode","childNodes","id","Math","random","toString","substr","setAttribute","titleNode","querySelector","_addTitleContent","nodeType","appendChild","functionToCheck","isFunction","titleText","textContent","_isOpening","_tooltipNode","style","visibility","popperInstance","update","getAttribute","_create","_findContainer","_append","popperOptions","modifiers","arrow","element","boundariesElement","preventOverflow","_this","_events","forEach","_ref","func","event","removeEventListener","_hide","destroy","removeOnDestroy","parentNode","removeChild","_this2","directEvents","oppositeEvents","push","evt","usedByTooltip","_scheduleShow","addEventListener","_scheduleHide","closeOnClickOutside","e","popper","contains","_this3","computedDelay","show","_showTimeout","setTimeout","_show","_this4","hide","clearTimeout","body","type","_setTooltipNodeEvent","_clearTitleContent","lastTitle","_this5","dispose","_dispose","toggle","updateTitleContent","_updateTitleContent","relatedreference","toElement","relatedTarget","callback","evt2","relatedreference2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAQC,GACC,iBAAZC,SAA0C,oBAAXC,OAAyBA,OAAOD,QAAUD,EAAQG,QAAQ,WAC9E,mBAAXC,QAAyBA,OAAOC,IAAMD,QAAQ,UAAWJ,GAC/DD,EAAOO,QAAUN,EAAQD,EAAOQ,QAHlC,CAIEC,KAAM,SAAWD,GAAU,aAE7BA,EAASA,GAAUA,EAAOE,eAAe,WAAaF,EAAgB,QAAIA,EAc1E,IAAIG,EAAiB,SAAUC,EAAUC,GACvC,KAAMD,aAAoBC,GACxB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O3F,UAAW2F,EAAO1F,UAG/CvC,KAAK0H,KAAO,WACV,OAAOO,EAAOhC,SAGhBjG,KAAKkI,QAAU,WACb,OAAOD,EAAOE,YAGhBnI,KAAKoI,OAAS,WACZ,OAAIH,EAAOnF,QACFmF,EAAOP,OAEPO,EAAOZ,QAIlBrH,KAAKqI,mBAAqB,SAAUrG,GAClC,OAAOiG,EAAOK,oBAAoBtG,IAGpChC,KAAK2F,WAEL3F,KAAK8H,qBAAuB,SAAUpB,EAAKpE,EAAWT,EAAOU,GAC3D,IAAIgG,EAAmB7B,EAAI6B,kBAAoB7B,EAAI8B,WAAa9B,EAAI+B,cAepE,QAAIR,EAAOtD,aAAauC,SAASqB,KAE/BN,EAAOtD,aAAakC,iBAAiBH,EAAImB,KAf5B,SAASa,EAASC,GAC/B,IAAIC,EAAoBD,EAAKJ,kBAAoBI,EAAKH,WAAaG,EAAKF,cAGxER,EAAOtD,aAAaqB,oBAAoBU,EAAImB,KAAMa,GAG7CpG,EAAU4E,SAAS0B,IAEtBX,EAAOnB,cAAcxE,EAAWC,EAAQV,MAAOU,EAASoG,MAOnD,KAOb,OAAO7I","file":"tooltip.js","sourcesContent":["/**!\r\n * @fileOverview Kickass library to create and place poppers near their reference elements.\r\n * @version 1.3.2\r\n * @license\r\n * Copyright (c) 2016 Federico Zivolo and contributors\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\r\n(function (global, factory) {\r\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('popper')) :\r\n\ttypeof define === 'function' && define.amd ? define(['popper'], factory) :\r\n\t(global.Tooltip = factory(global.Popper));\r\n}(this, (function (Popper) { 'use strict';\r\n\r\nPopper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;\r\n\r\n/**\r\n * Check if the given variable is a function\r\n * @method\r\n * @memberof Popper.Utils\r\n * @argument {Any} functionToCheck - variable to check\r\n * @returns {Boolean} answer to: is a function?\r\n */\r\nfunction isFunction(functionToCheck) {\r\n var getType = {};\r\n return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';\r\n}\r\n\r\nvar classCallCheck = function (instance, Constructor) {\r\n if (!(instance instanceof Constructor)) {\r\n throw new TypeError(\"Cannot call a class as a function\");\r\n }\r\n};\r\n\r\nvar createClass = function () {\r\n function defineProperties(target, props) {\r\n for (var i = 0; i < props.length; i++) {\r\n var descriptor = props[i];\r\n descriptor.enumerable = descriptor.enumerable || false;\r\n descriptor.configurable = true;\r\n if (\"value\" in descriptor) descriptor.writable = true;\r\n Object.defineProperty(target, descriptor.key, descriptor);\r\n }\r\n }\r\n\r\n return function (Constructor, protoProps, staticProps) {\r\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\r\n if (staticProps) defineProperties(Constructor, staticProps);\r\n return Constructor;\r\n };\r\n}();\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nvar _extends = Object.assign || function (target) {\r\n for (var i = 1; i < arguments.length; i++) {\r\n var source = arguments[i];\r\n\r\n for (var key in source) {\r\n if (Object.prototype.hasOwnProperty.call(source, key)) {\r\n target[key] = source[key];\r\n }\r\n }\r\n }\r\n\r\n return target;\r\n};\r\n\r\nvar DEFAULT_OPTIONS = {\r\n container: false,\r\n delay: 0,\r\n html: false,\r\n placement: 'top',\r\n title: '',\r\n template: '
',\r\n trigger: 'hover focus',\r\n offset: 0,\r\n arrowSelector: '.tooltip-arrow, .tooltip__arrow',\r\n innerSelector: '.tooltip-inner, .tooltip__inner'\r\n};\r\n\r\nvar Tooltip = function () {\r\n /**\r\n * Create a new Tooltip.js instance\r\n * @class Tooltip\r\n * @param {HTMLElement} reference - The DOM node used as reference of the tooltip (it can be a jQuery element).\r\n * @param {Object} options\r\n * @param {String} options.placement='top'\r\n * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -end),\r\n * left(-start, -end)`\r\n * @param {String} options.arrowSelector='.tooltip-arrow, .tooltip__arrow' - className used to locate the DOM arrow element in the tooltip.\r\n * @param {String} options.innerSelector='.tooltip-inner, .tooltip__inner' - className used to locate the DOM inner element in the tooltip.\r\n * @param {HTMLElement|String|false} options.container=false - Append the tooltip to a specific element.\r\n * @param {Number|Object} options.delay=0\r\n * Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type.\r\n * If a number is supplied, delay is applied to both hide/show.\r\n * Object structure is: `{ show: 500, hide: 100 }`\r\n * @param {Boolean} options.html=false - Insert HTML into the tooltip. If false, the content will inserted with `textContent`.\r\n * @param {String} [options.template='
']\r\n * Base HTML to used when creating the tooltip.\r\n * The tooltip's `title` will be injected into the `.tooltip-inner` or `.tooltip__inner`.\r\n * `.tooltip-arrow` or `.tooltip__arrow` will become the tooltip's arrow.\r\n * The outermost wrapper element should have the `.tooltip` class.\r\n * @param {String|HTMLElement|TitleFunction} options.title='' - Default title value if `title` attribute isn't present.\r\n * @param {String} [options.trigger='hover focus']\r\n * How tooltip is triggered - click, hover, focus, manual.\r\n * You may pass multiple triggers; separate them with a space. `manual` cannot be combined with any other trigger.\r\n * @param {Boolean} options.closeOnClickOutside=false - Close a popper on click outside of the popper and reference element. This has effect only when options.trigger is 'click'.\r\n * @param {String|HTMLElement} options.boundariesElement\r\n * The element used as boundaries for the tooltip. For more information refer to Popper.js'\r\n * [boundariesElement docs](https://popper.js.org/popper-documentation.html)\r\n * @param {Number|String} options.offset=0 - Offset of the tooltip relative to its reference. For more information refer to Popper.js'\r\n * [offset docs](https://popper.js.org/popper-documentation.html)\r\n * @param {Object} options.popperOptions={} - Popper options, will be passed directly to popper instance. For more information refer to Popper.js'\r\n * [options docs](https://popper.js.org/popper-documentation.html)\r\n * @return {Object} instance - The generated tooltip instance\r\n */\r\n function Tooltip(reference, options) {\r\n classCallCheck(this, Tooltip);\r\n\r\n _initialiseProps.call(this);\r\n\r\n // apply user options over default ones\r\n options = _extends({}, DEFAULT_OPTIONS, options);\r\n\r\n reference.jquery && (reference = reference[0]);\r\n\r\n // cache reference and options\r\n this.reference = reference;\r\n this.options = options;\r\n\r\n // get events list\r\n var events = typeof options.trigger === 'string' ? options.trigger.split(' ').filter(function (trigger) {\r\n return ['click', 'hover', 'focus'].indexOf(trigger) !== -1;\r\n }) : [];\r\n\r\n // set initial state\r\n this._isOpen = false;\r\n this._popperOptions = {};\r\n\r\n // set event listeners\r\n this._setEventListeners(reference, events, options);\r\n }\r\n\r\n //\r\n // Public methods\r\n //\r\n\r\n /**\r\n * Reveals an element's tooltip. This is considered a \"manual\" triggering of the tooltip.\r\n * Tooltips with zero-length titles are never displayed.\r\n * @method Tooltip#show\r\n * @memberof Tooltip\r\n */\r\n\r\n\r\n /**\r\n * Hides an element’s tooltip. This is considered a “manual” triggering of the tooltip.\r\n * @method Tooltip#hide\r\n * @memberof Tooltip\r\n */\r\n\r\n\r\n /**\r\n * Hides and destroys an element’s tooltip.\r\n * @method Tooltip#dispose\r\n * @memberof Tooltip\r\n */\r\n\r\n\r\n /**\r\n * Toggles an element’s tooltip. This is considered a “manual” triggering of the tooltip.\r\n * @method Tooltip#toggle\r\n * @memberof Tooltip\r\n */\r\n\r\n\r\n /**\r\n * Updates the tooltip's title content\r\n * @method Tooltip#updateTitleContent\r\n * @memberof Tooltip\r\n * @param {String|HTMLElement} title - The new content to use for the title\r\n */\r\n\r\n\r\n //\r\n // Private methods\r\n //\r\n\r\n createClass(Tooltip, [{\r\n key: '_create',\r\n\r\n\r\n /**\r\n * Creates a new tooltip node\r\n * @memberof Tooltip\r\n * @private\r\n * @param {HTMLElement} reference\r\n * @param {String} template\r\n * @param {String|HTMLElement|TitleFunction} title\r\n * @param {Boolean} allowHtml\r\n * @return {HTMLElement} tooltipNode\r\n */\r\n value: function _create(reference, template, title, allowHtml) {\r\n // create tooltip element\r\n var tooltipGenerator = window.document.createElement('div');\r\n tooltipGenerator.innerHTML = template.trim();\r\n var tooltipNode = tooltipGenerator.childNodes[0];\r\n\r\n // add unique ID to our tooltip (needed for accessibility reasons)\r\n tooltipNode.id = 'tooltip_' + Math.random().toString(36).substr(2, 10);\r\n\r\n // set initial `aria-hidden` state to `false` (it's visible!)\r\n tooltipNode.setAttribute('aria-hidden', 'false');\r\n\r\n // add title to tooltip\r\n var titleNode = tooltipGenerator.querySelector(this.options.innerSelector);\r\n this._addTitleContent(reference, title, allowHtml, titleNode);\r\n\r\n // return the generated tooltip node\r\n return tooltipNode;\r\n }\r\n }, {\r\n key: '_addTitleContent',\r\n value: function _addTitleContent(reference, title, allowHtml, titleNode) {\r\n if (title.nodeType === 1 || title.nodeType === 11) {\r\n // if title is a element node or document fragment, append it only if allowHtml is true\r\n allowHtml && titleNode.appendChild(title);\r\n } else if (isFunction(title)) {\r\n // if title is a function, call it and set textContent or innerHtml depending by `allowHtml` value\r\n var titleText = title.call(reference);\r\n allowHtml ? titleNode.innerHTML = titleText : titleNode.textContent = titleText;\r\n } else {\r\n // if it's just a simple text, set textContent or innerHtml depending by `allowHtml` value\r\n allowHtml ? titleNode.innerHTML = title : titleNode.textContent = title;\r\n }\r\n }\r\n }, {\r\n key: '_show',\r\n value: function _show(reference, options) {\r\n // don't show if it's already visible\r\n // or if it's not being showed\r\n if (this._isOpen && !this._isOpening) {\r\n return this;\r\n }\r\n this._isOpen = true;\r\n\r\n // if the tooltipNode already exists, just show it\r\n if (this._tooltipNode) {\r\n this._tooltipNode.style.visibility = 'visible';\r\n this._tooltipNode.setAttribute('aria-hidden', 'false');\r\n this.popperInstance.update();\r\n return this;\r\n }\r\n\r\n // get title\r\n var title = reference.getAttribute('title') || options.title;\r\n\r\n // don't show tooltip if no title is defined\r\n if (!title) {\r\n return this;\r\n }\r\n\r\n // create tooltip node\r\n var tooltipNode = this._create(reference, options.template, title, options.html);\r\n\r\n // Add `aria-describedby` to our reference element for accessibility reasons\r\n reference.setAttribute('aria-describedby', tooltipNode.id);\r\n\r\n // append tooltip to container\r\n var container = this._findContainer(options.container, reference);\r\n\r\n this._append(tooltipNode, container);\r\n\r\n this._popperOptions = _extends({}, options.popperOptions, {\r\n placement: options.placement\r\n });\r\n\r\n this._popperOptions.modifiers = _extends({}, this._popperOptions.modifiers, {\r\n arrow: _extends({}, this._popperOptions.modifiers && this._popperOptions.modifiers.arrow, {\r\n element: options.arrowSelector\r\n }),\r\n offset: _extends({}, this._popperOptions.modifiers && this._popperOptions.modifiers.offset, {\r\n offset: options.offset\r\n })\r\n });\r\n\r\n if (options.boundariesElement) {\r\n this._popperOptions.modifiers.preventOverflow = {\r\n boundariesElement: options.boundariesElement\r\n };\r\n }\r\n\r\n this.popperInstance = new Popper(reference, tooltipNode, this._popperOptions);\r\n\r\n this._tooltipNode = tooltipNode;\r\n\r\n return this;\r\n }\r\n }, {\r\n key: '_hide',\r\n value: function _hide() /*reference, options*/{\r\n // don't hide if it's already hidden\r\n if (!this._isOpen) {\r\n return this;\r\n }\r\n\r\n this._isOpen = false;\r\n\r\n // hide tooltipNode\r\n this._tooltipNode.style.visibility = 'hidden';\r\n this._tooltipNode.setAttribute('aria-hidden', 'true');\r\n\r\n return this;\r\n }\r\n }, {\r\n key: '_dispose',\r\n value: function _dispose() {\r\n var _this = this;\r\n\r\n // remove event listeners first to prevent any unexpected behaviour\r\n this._events.forEach(function (_ref) {\r\n var func = _ref.func,\r\n event = _ref.event;\r\n\r\n _this.reference.removeEventListener(event, func);\r\n });\r\n this._events = [];\r\n\r\n if (this._tooltipNode) {\r\n this._hide();\r\n\r\n // destroy instance\r\n this.popperInstance.destroy();\r\n\r\n // destroy tooltipNode if removeOnDestroy is not set, as popperInstance.destroy() already removes the element\r\n if (!this.popperInstance.options.removeOnDestroy) {\r\n this._tooltipNode.parentNode.removeChild(this._tooltipNode);\r\n this._tooltipNode = null;\r\n }\r\n }\r\n return this;\r\n }\r\n }, {\r\n key: '_findContainer',\r\n value: function _findContainer(container, reference) {\r\n // if container is a query, get the relative element\r\n if (typeof container === 'string') {\r\n container = window.document.querySelector(container);\r\n } else if (container === false) {\r\n // if container is `false`, set it to reference parent\r\n container = reference.parentNode;\r\n }\r\n return container;\r\n }\r\n\r\n /**\r\n * Append tooltip to container\r\n * @memberof Tooltip\r\n * @private\r\n * @param {HTMLElement} tooltipNode\r\n * @param {HTMLElement|String|false} container\r\n */\r\n\r\n }, {\r\n key: '_append',\r\n value: function _append(tooltipNode, container) {\r\n container.appendChild(tooltipNode);\r\n }\r\n }, {\r\n key: '_setEventListeners',\r\n value: function _setEventListeners(reference, events, options) {\r\n var _this2 = this;\r\n\r\n var directEvents = [];\r\n var oppositeEvents = [];\r\n\r\n events.forEach(function (event) {\r\n switch (event) {\r\n case 'hover':\r\n directEvents.push('mouseenter');\r\n oppositeEvents.push('mouseleave');\r\n break;\r\n case 'focus':\r\n directEvents.push('focus');\r\n oppositeEvents.push('blur');\r\n break;\r\n case 'click':\r\n directEvents.push('click');\r\n oppositeEvents.push('click');\r\n break;\r\n }\r\n });\r\n\r\n // schedule show tooltip\r\n directEvents.forEach(function (event) {\r\n var func = function func(evt) {\r\n if (_this2._isOpening === true) {\r\n return;\r\n }\r\n evt.usedByTooltip = true;\r\n _this2._scheduleShow(reference, options.delay, options, evt);\r\n };\r\n _this2._events.push({ event: event, func: func });\r\n reference.addEventListener(event, func);\r\n });\r\n\r\n // schedule hide tooltip\r\n oppositeEvents.forEach(function (event) {\r\n var func = function func(evt) {\r\n if (evt.usedByTooltip === true) {\r\n return;\r\n }\r\n _this2._scheduleHide(reference, options.delay, options, evt);\r\n };\r\n _this2._events.push({ event: event, func: func });\r\n reference.addEventListener(event, func);\r\n if (event === 'click' && options.closeOnClickOutside) {\r\n document.addEventListener('mousedown', function (e) {\r\n if (!_this2._isOpening) {\r\n return;\r\n }\r\n var popper = _this2.popperInstance.popper;\r\n if (reference.contains(e.target) || popper.contains(e.target)) {\r\n return;\r\n }\r\n func(e);\r\n }, true);\r\n }\r\n });\r\n }\r\n }, {\r\n key: '_scheduleShow',\r\n value: function _scheduleShow(reference, delay, options /*, evt */) {\r\n var _this3 = this;\r\n\r\n this._isOpening = true;\r\n // defaults to 0\r\n var computedDelay = delay && delay.show || delay || 0;\r\n this._showTimeout = window.setTimeout(function () {\r\n return _this3._show(reference, options);\r\n }, computedDelay);\r\n }\r\n }, {\r\n key: '_scheduleHide',\r\n value: function _scheduleHide(reference, delay, options, evt) {\r\n var _this4 = this;\r\n\r\n this._isOpening = false;\r\n // defaults to 0\r\n var computedDelay = delay && delay.hide || delay || 0;\r\n window.clearTimeout(this._showTimeout);\r\n window.setTimeout(function () {\r\n if (_this4._isOpen === false) {\r\n return;\r\n }\r\n if (!document.body.contains(_this4._tooltipNode)) {\r\n return;\r\n }\r\n\r\n // if we are hiding because of a mouseleave, we must check that the new\r\n // reference isn't the tooltip, because in this case we don't want to hide it\r\n if (evt.type === 'mouseleave') {\r\n var isSet = _this4._setTooltipNodeEvent(evt, reference, delay, options);\r\n\r\n // if we set the new event, don't hide the tooltip yet\r\n // the new event will take care to hide it if necessary\r\n if (isSet) {\r\n return;\r\n }\r\n }\r\n\r\n _this4._hide(reference, options);\r\n }, computedDelay);\r\n }\r\n }, {\r\n key: '_updateTitleContent',\r\n value: function _updateTitleContent(title) {\r\n if (typeof this._tooltipNode === 'undefined') {\r\n if (typeof this.options.title !== 'undefined') {\r\n this.options.title = title;\r\n }\r\n return;\r\n }\r\n var titleNode = this._tooltipNode.querySelector(this.options.innerSelector);\r\n this._clearTitleContent(titleNode, this.options.html, this.reference.getAttribute('title') || this.options.title);\r\n this._addTitleContent(this.reference, title, this.options.html, titleNode);\r\n this.options.title = title;\r\n this.popperInstance.update();\r\n }\r\n }, {\r\n key: '_clearTitleContent',\r\n value: function _clearTitleContent(titleNode, allowHtml, lastTitle) {\r\n if (lastTitle.nodeType === 1 || lastTitle.nodeType === 11) {\r\n allowHtml && titleNode.removeChild(lastTitle);\r\n } else {\r\n allowHtml ? titleNode.innerHTML = '' : titleNode.textContent = '';\r\n }\r\n }\r\n }]);\r\n return Tooltip;\r\n}();\r\n\r\n/**\r\n * Title function, its context is the Tooltip instance.\r\n * @memberof Tooltip\r\n * @callback TitleFunction\r\n * @return {String} placement - The desired title.\r\n */\r\n\r\n\r\nvar _initialiseProps = function _initialiseProps() {\r\n var _this5 = this;\r\n\r\n this.show = function () {\r\n return _this5._show(_this5.reference, _this5.options);\r\n };\r\n\r\n this.hide = function () {\r\n return _this5._hide();\r\n };\r\n\r\n this.dispose = function () {\r\n return _this5._dispose();\r\n };\r\n\r\n this.toggle = function () {\r\n if (_this5._isOpen) {\r\n return _this5.hide();\r\n } else {\r\n return _this5.show();\r\n }\r\n };\r\n\r\n this.updateTitleContent = function (title) {\r\n return _this5._updateTitleContent(title);\r\n };\r\n\r\n this._events = [];\r\n\r\n this._setTooltipNodeEvent = function (evt, reference, delay, options) {\r\n var relatedreference = evt.relatedreference || evt.toElement || evt.relatedTarget;\r\n\r\n var callback = function callback(evt2) {\r\n var relatedreference2 = evt2.relatedreference || evt2.toElement || evt2.relatedTarget;\r\n\r\n // Remove event listener after call\r\n _this5._tooltipNode.removeEventListener(evt.type, callback);\r\n\r\n // If the new reference is not the reference element\r\n if (!reference.contains(relatedreference2)) {\r\n // Schedule to hide tooltip\r\n _this5._scheduleHide(reference, options.delay, options, evt2);\r\n }\r\n };\r\n\r\n if (_this5._tooltipNode.contains(relatedreference)) {\r\n // listen to mouseleave on the tooltip element to be able to hide the tooltip\r\n _this5._tooltipNode.addEventListener(evt.type, callback);\r\n return true;\r\n }\r\n\r\n return false;\r\n };\r\n};\r\n\r\nreturn Tooltip;\r\n\r\n})));\r\n//# sourceMappingURL=tooltip.js.map\r\n"]}