"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils"),o=require("primereact/tooltip");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(t);function i(){return i=Object.assign||function(t){for(var e=1;e0?e.DomHandler.addClass(t.target,"p-filled"):e.DomHandler.removeClass(t.target,"p-filled"),this.props.onInput&&this.props.onInput(t)}},{key:"resize",value:function(t){var o=this.elementRef&&this.elementRef.current;o&&e.DomHandler.isVisible(o)&&(this.cachedScrollHeight||(this.cachedScrollHeight=o.scrollHeight,o.style.overflow="hidden"),(this.cachedScrollHeight!==o.scrollHeight||t)&&(o.style.height="",o.style.height=o.scrollHeight+"px",parseFloat(o.style.height)>=parseFloat(o.style.maxHeight)?(o.style.overflowY="scroll",o.style.height=o.style.maxHeight):o.style.overflow="hidden",this.cachedScrollHeight=o.scrollHeight))}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.elementRef&&this.elementRef.current&&this.elementRef.current.value.toString().length>0}},{key:"updateForwardRef",value:function(){var t=this.props.forwardRef;t&&("function"==typeof t?t(this.elementRef.current):t.current=this.elementRef.current)}},{key:"componentDidMount",value:function(){this.updateForwardRef(),this.props.tooltip&&this.renderTooltip(),this.props.autoResize&&this.resize(!0)}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(b({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.props.autoResize&&this.resize(!0)}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=o.tip({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=e.classNames("p-inputtextarea p-inputtext p-component",{"p-disabled":this.props.disabled,"p-filled":this.isFilled(),"p-inputtextarea-resizable":this.props.autoResize},this.props.className),o=e.ObjectUtils.findDiffKeys(this.props,g.defaultProps);return n.default.createElement("textarea",i({ref:this.elementRef},o,{className:t,onFocus:this.onFocus,onBlur:this.onBlur,onKeyUp:this.onKeyUp,onInput:this.onInput}))}}])&&l(y.prototype,d),m&&l(y,m),Object.defineProperty(y,"prototype",{writable:!1}),g}();y(m,"defaultProps",{autoResize:!1,tooltip:null,tooltipOptions:null,onInput:null,forwardRef:null}),exports.InputTextarea=n.default.forwardRef((function(t,e){return n.default.createElement(m,i({forwardRef:e},t))}));