var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); /* eslint-disable */ this.BX = this.BX || {}; (function (exports,main_core,main_core_events) { 'use strict'; var Tooltip = /*#__PURE__*/function () { function Tooltip() { babelHelpers.classCallCheck(this, Tooltip); } babelHelpers.createClass(Tooltip, null, [{ key: "disable", value: function disable() { this.disabled = true; } }, { key: "enable", value: function enable() { this.disabled = false; } }, { key: "getDisabledStatus", value: function getDisabledStatus() { return this.disabled; } }, { key: "getLoader", value: function getLoader() { return '/bitrix/tools/tooltip.php'; } }, { key: "getIdPrefix", value: function getIdPrefix() { return 'bx-ui-tooltip-'; } }]); return Tooltip; }(); babelHelpers.defineProperty(Tooltip, "disabled", false); babelHelpers.defineProperty(Tooltip, "tooltipsList", {}); var TooltipBalloon = /*#__PURE__*/function () { function TooltipBalloon(params) { babelHelpers.classCallCheck(this, TooltipBalloon); this.node = null; this.userId = null; this.loader = null; this.version = null; this.tracking = false; this.active = false; this.width = 364; // 393 this.height = 215; // 302 this.realAnchor = null; this.coordsLeft = 0; this.coordsTop = 0; this.anchorRight = 0; this.anchorTop = 0; this.hMirror = false; this.vMirror = false; this.rootClassName = ''; this.INFO = null; this.DIV = null; this.ROOT_DIV = null; this.params = {}; this.trackMouseHandle = this.trackMouse.bind(this); this.init(params); this.create(); return this; } babelHelpers.createClass(TooltipBalloon, [{ key: "init", value: function init(params) { this.node = params.node; this.userId = params.userId; this.loader = main_core.Type.isStringFilled(params.loader) ? params.loader : ''; this.version = !main_core.Type.isUndefined(params.version) && parseInt(params.version) > 0 ? parseInt(params.version) : main_core.Type.isStringFilled(this.loader) ? 2 : 3; this.rootClassName = this.node.getAttribute('bx-tooltip-classname'); var paramsString = this.node.getAttribute('bx-tooltip-params'); var anchorParams = {}; if (main_core.Type.isStringFilled(paramsString)) { anchorParams = JSON.parse(paramsString); if (!main_core.Type.isPlainObject(anchorParams)) { anchorParams = {}; } } this.params = anchorParams; } }, { key: "create", value: function create() { if (!Tooltip.getDisabledStatus()) { this.startTrackMouse(); } this.node.addEventListener('mouseout', this.stopTrackMouse.bind(this)); main_core_events.EventEmitter.subscribe('SidePanel.Slider:onOpen', this.onSliderOpen.bind(this)); } }, { key: "onSliderOpen", value: function onSliderOpen() { if (this.tracking) { this.stopTrackMouse(); } else { this.hideTooltip(); } } }, { key: "startTrackMouse", value: function startTrackMouse() { var _this = this; if (this.tracking) { return; } var elCoords = BX.pos(this.node); this.realAnchor = this.node; this.coordsLeft = elCoords.width < 40 ? elCoords.left - 35 : elCoords.left + 0; this.coordsTop = elCoords.top - 245; // 325 this.anchorRight = elCoords.right; this.anchorTop = elCoords.top; this.tracking = true; document.addEventListener('mousemove', this.trackMouseHandle); setTimeout(function () { _this.tickTimer(); }, 500); this.node.addEventListener('mouseout', this.stopTrackMouse.bind(this)); } }, { key: "stopTrackMouse", value: function stopTrackMouse() { var _this2 = this; if (!this.tracking) { return; } document.removeEventListener('mousemove', this.trackMouseHandle); this.active = false; setTimeout(function () { _this2.hideTooltip(); }, 500); this.tracking = false; } }, { key: "trackMouse", value: function trackMouse(e) { if (!this.tracking) { return; } var current = e && e.pageX ? { x: e.pageX, y: e.pageY } : { x: e.clientX + document.body.scrollLeft, y: e.clientY + document.body.scrollTop }; if (current.x < 0) { current.x = 0; } if (current.y < 0) { current.y = 0; } current.time = this.tracking; if (!this.active) { this.active = current; } else { if (this.active.x >= current.x - 1 && this.active.x <= current.x + 1 && this.active.y >= current.y - 1 && this.active.y <= current.y + 1) { if (this.active.time + 20 /*2sec*/ <= current.time) { this.showTooltip(); } } else { this.active = current; } } } }, { key: "tickTimer", value: function tickTimer() { var _this3 = this; if (!this.tracking) { return; } this.tracking++; if (this.active) { if (this.active.time + 5 /*0.5sec*/ <= this.tracking) { this.showTooltip(); } } setTimeout(function () { _this3.tickTimer(); }, 100); } }, { key: "hideTooltip", value: function hideTooltip() { if (this.tracking) { return; } this.showOpacityEffect(1); } }, { key: "showOpacityEffect", value: function showOpacityEffect(bFade) { var _this4 = this; var steps = 3; var period = 1; var delta = 1 / steps; var i = 0; var intId = setInterval(function () { i++; if (i > steps) { clearInterval(intId); return; } var op = bFade ? 1 - i * delta : i * delta; if (_this4.DIV != null) { try { _this4.DIV.style.opacity = op; } catch (e) {} finally { if (!bFade && i == 1) { _this4.DIV.classList.add('ui-tooltip-info-shadow-show'); _this4.DIV.style.display = 'block'; } if (bFade && i == steps && _this4.DIV) { _this4.DIV.classList.remove('ui-tooltip-info-shadow-show'); _this4.DIV.classList.add('ui-tooltip-info-shadow-hide'); setTimeout(function () { _this4.DIV.style.display = 'none'; }, 500); } if (bFade) { main_core_events.EventEmitter.emit('onTooltipHide', new main_core_events.BaseEvent({ compatData: [_this4] })); } } } }, period); } }, { key: "showTooltip", value: function showTooltip() { var _this5 = this; var old = document.getElementById("".concat(Tooltip.getIdPrefix()).concat(this.userId)); if (Tooltip.getDisabledStatus() || old && old.classList.contains('ui-tooltip-info-shadow-show')) { return; } if (null == this.DIV && null == this.ROOT_DIV) { this.ROOT_DIV = document.body.appendChild(document.createElement('DIV')); this.ROOT_DIV.style.position = 'absolute'; BX.ZIndexManager.register(this.ROOT_DIV); this.DIV = this.ROOT_DIV.appendChild(document.createElement('DIV')); this.DIV.className = 'bx-ui-tooltip-info-shadow'; this.DIV.style.width = "".concat(this.width, "px"); } var left = this.coordsLeft; var top = this.coordsTop + 30; var arScroll = BX.GetWindowScrollPos(); var body = document.body; this.hMirror = false; this.vMirror = top - arScroll.scrollTop < 0; if (body.clientWidth + arScroll.scrollLeft < left + this.width) { left = this.anchorRight - this.width; this.hMirror = true; } this.ROOT_DIV.style.left = "".concat(parseInt(left), "px"); this.ROOT_DIV.style.top = "".concat(parseInt(top), "px"); BX.ZIndexManager.bringToFront(this.ROOT_DIV); this.ROOT_DIV.addEventListener('click', function (e) { e.stopPropagation(); }); if (main_core.Type.isStringFilled(this.rootClassName)) { this.ROOT_DIV.className = this.rootClassName; } var loader = main_core.Type.isStringFilled(this.loader) ? this.loader : Tooltip.getLoader(); // create stub var stubCreated = false; if ('' == this.DIV.innerHTML) { stubCreated = true; if (this.version >= 3) { main_core.ajax.runComponentAction('bitrix:ui.tooltip', 'getData', { mode: 'ajax', data: { userId: this.userId, params: !main_core.Type.isUndefined(this.params) ? this.params : {} } }).then(function (response) { var detailUrl = main_core.Type.isStringFilled(response.data.user.detailUrl) ? response.data.user.detailUrl : ''; var cardUserName = ''; if (main_core.Type.isStringFilled(response.data.user.nameFormatted)) { var _response$data$user$n = response.data.user.nameFormatted, nameFormatted = _response$data$user$n === void 0 ? '' : _response$data$user$n; if (main_core.Type.isStringFilled(detailUrl)) { cardUserName = "\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t").concat(response.data.user.nameFormatted, "\n\t\t\t\t\t\t\t\t\t\t\t"); } else { cardUserName = "\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tresponse.data.user.nameFormatted\n\t\t\t\t\t\t\t\t\t\t\t"); } } var cardFields = '