"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("react-dom"),n=require("primereact/utils"),i=require("primereact/portal"),o=require("primereact/api");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=r(t),a=r(e),l=r(o);function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;ns.width?(this.containerEl.style.left="0px",this.containerEl.style.right=window.innerWidth-s.width-o+"px"):(this.containerEl.style.right="",this.containerEl.style.left=o+"px"),this.containerEl.style.top=r+"px",n.DomHandler.addClass(this.containerEl,"p-tooltip-active")}else{var c=n.DomHandler.findCollisionPosition(this.state.position),p=this.getTargetOption(t,"my")||this.props.my||c.my,h=this.getTargetOption(t,"at")||this.props.at||c.at;this.containerEl.style.padding="0px",n.DomHandler.flipfitCollision(this.containerEl,t,p,h,(function(t){var e=t.at,o=e.x,r=i.props.at?"center"!==o&&o!==t.my.x?o:e.y:t.at["".concat(c.axis)];i.containerEl.style.padding="",i.setState({position:r},(function(){i.updateContainerPosition(),n.DomHandler.addClass(i.containerEl,"p-tooltip-active")}))}))}}},{key:"updateContainerPosition",value:function(){if(this.containerEl){var t=getComputedStyle(this.containerEl);"left"===this.state.position?this.containerEl.style.left=parseFloat(t.left)-2*parseFloat(t.paddingLeft)+"px":"top"===this.state.position&&(this.containerEl.style.top=parseFloat(t.top)-2*parseFloat(t.paddingTop)+"px")}}},{key:"onMouseEnter",value:function(){this.isAutoHide()||(this.allowHide=!1)}},{key:"onMouseLeave",value:function(t){this.isAutoHide()||(this.allowHide=!0,this.hide(t))}},{key:"bindDocumentResizeListener",value:function(){var t=this;this.documentResizeListener=function(e){n.DomHandler.isTouchDevice()||t.hide(e)},window.addEventListener("resize",this.documentResizeListener)}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"bindScrollListener",value:function(){var t=this;this.scrollHandler||(this.scrollHandler=new n.ConnectedOverlayScrollHandler(this.currentTarget,(function(e){t.state.visible&&t.hide(e)}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindTargetEvent",value:function(t){if(t){var e=this.getEvents(t),n=e.showEvent,i=e.hideEvent,o=this.getTarget(t);o.addEventListener(n,this.show),o.addEventListener(i,this.hide)}}},{key:"unbindTargetEvent",value:function(t){if(t){var e=this.getEvents(t),n=e.showEvent,i=e.hideEvent,o=this.getTarget(t);o.removeEventListener(n,this.show),o.removeEventListener(i,this.hide)}}},{key:"applyDelay",value:function(t,e){this.clearTimeouts();var n=this.getTargetOption(this.currentTarget,t.toLowerCase())||this.props[t];n?this["".concat(t,"Timeout")]=setTimeout((function(){return e()}),n):e()}},{key:"sendCallback",value:function(t){if(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i