(function(){"use strict";BX.namespace("BX.UI");if(BX.UI.Hint){return}var t=function(t,e){var i=e.getBoundingClientRect();var n=i.x;var s=i.x+i.width;var o=i.y;var a=i.y+i.height;return n<=t.x&&t.x<=s&&o<=t.y&&t.y<=a};function e(t){t=t||{};this.id="ui-hint-popup-"+ +new Date;if(t.id){this.id=t.id}if(t.attributeName){this.attributeName=t.attributeName}if(t.classNameIcon){this.classNameIcon=t.classNameIcon}if(t.className){this.className=t.className}if(t.attributeInitName){this.attributeInitName=t.attributeInitName}if(t.content){if(!BX.type.isDomNode(t.content)){throw new Error("Parameter `content` should be a DOM Node.")}this.content=t.content}if(t.popup){if(!(t.popup instanceof BX.PopupWindow)){throw new Error("Parameter `popup` should be an instance of BX.PopupWindow.")}this.popup=t.popup}if(t.popupParameters){this.popupParameters=t.popupParameters}this.initByClassName();BX.ready(this.initByClassName.bind(this))}e.prototype={attributeName:"data-hint",attributeHtmlName:"data-hint-html",attributeInitName:"data-hint-init",attributeInteractivityName:"data-hint-interactivity",className:"ui-hint",classNameIcon:"ui-hint-icon",classNameContent:"ui-hint-content",classNamePopup:"ui-hint-popup",classNamePopupInteractivity:"ui-hint-popup-interactivity",popup:null,content:null,popupParameters:null,ownerDocument:null,cursorPosition:{x:0,y:0},anchorNode:null,createInstance:function(t){return new e(t)},initByClassName:function(){var t=document.getElementsByClassName(this.className);t=BX.convert.nodeListToArray(t);t.forEach(this.initNode,this)},init:function(t){t=t||document.body;var e=t.querySelectorAll("["+this.attributeName+"]");e=BX.convert.nodeListToArray(e);e.forEach(this.initNode,this);this.initOwnerDocument(t)},initOwnerDocument:function(t){if(t.ownerDocument===this.ownerDocument){return}this.ownerDocument=t.ownerDocument;BX.bind(this.ownerDocument,"mousemove",(t=>{this.cursorPosition.x=t.x;this.cursorPosition.y=t.y}))},createNode:function(t){var e=document.createElement("span");e.setAttribute(this.attributeName,t);this.initNode(e);return e},initNode:function(t){if(t.getAttribute(this.attributeInitName)){return}t.setAttribute(this.attributeInitName,"y");var e=t.getAttribute(this.attributeName);if(!BX.type.isNotEmptyString(e)){return}if(!t.hasAttribute(this.attributeHtmlName)){e=BX.util.htmlspecialchars(e)}if(!t.hasAttribute("data-hint-no-icon")){BX.addClass(t,this.className);t.innerHTML="";var i=document.createElement("span");BX.addClass(i,this.classNameIcon);t.appendChild(i)}if(t.hasAttribute("data-hint-center")){BX.bind(t,"mouseenter",this.show.bind(this,t,e,true))}else{BX.bind(t,"mouseenter",this.show.bind(this,t,e,false))}BX.bind(t,"mouseleave",this.hide.bind(this,t))},show:function(t,e,i){this.anchorNode=t;if(!this.content){this.content=document.createElement("div");BX.addClass(this.content,this.classNameContent)}if(!this.popup){var n=this.popupParameters||{};if(typeof n.zIndex==="undefined"){n.zIndex=1e3}if(typeof n.darkMode==="undefined"){n.darkMode=true}if(typeof n.animationOptions==="undefined"){}if(typeof n.animation==="undefined"){n.animation="fading-slide"}if(typeof n.content==="undefined"){n.content=this.content}if(typeof n.className==="undefined"){n.className=this.classNamePopup}if(i===true){if(typeof n.offsetLeft==="undefined"){n.offsetLeft=0}if(typeof n.angle==="undefined"){n.angle={offset:0}}if(typeof n.events==="undefined"){n.events={onPopupShow:function(){this.offsetLeft=this.getPopupContainer().offsetWidth?23+(t.offsetWidth-this.getPopupContainer().offsetWidth)/2:false;setTimeout(function(){this.angle.offset=this.getPopupContainer().offsetWidth?this.getPopupContainer().offsetWidth/2-16:false;this.angle.element.style.left=this.angle.offset?this.angle.offset+"px":false}.bind(this),0)}}}}else{if(typeof n.angle==="undefined"){n.angle={offset:t.offsetWidth?23+t.offsetWidth/2:false}}}this.popup=new BX.PopupWindow(this.id,t,n)}if(t.hasAttribute(this.attributeInteractivityName)){BX.Dom.addClass(this.popup.getPopupContainer(),this.classNamePopupInteractivity)}else{BX.Dom.removeClass(this.popup.getPopupContainer(),this.classNamePopupInteractivity)}this.content.innerHTML=e;this.popup.setBindElement(t);this.popup.show();if(i===true){this.popup.getPopupContainer().style.visibility="hidden";setTimeout(function(){this.popup.getPopupContainer().style.visibility=""}.bind(this),10)}this.timer=null},hide:function(e){if(!this.popup){return}if(e&&e.hasAttribute(this.attributeInteractivityName)){setTimeout((()=>{if(this.popup&&!t(this.cursorPosition,this.popup.getPopupContainer())){this.popup.close()}}),100)}else{this.popup.close()}}};BX.UI.Hint=new e})(); //# sourceMappingURL=ui.hint.map.js