import{C as T,r as i,u as H,P as U,a as _,O as u,c as x,T as k,q as v}from"./index-BsAdyuxG.js";import{K as b}from"./keyfilter.esm-Bp4LdhxN.js";function g(){return g=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)({}).hasOwnProperty.call(o,r)&&(n[r]=o[r])}return n},g.apply(null,arguments)}function f(n){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(n)}function C(n,t){if(f(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var r=o.call(n,t||"default");if(f(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function M(n){var t=C(n,"string");return f(t)=="symbol"?t:t+""}function V(n,t,o){return(t=M(t))in n?Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[t]=o,n}var Y={root:function(t){var o=t.props,r=t.context,e=t.isFilled;return x("p-inputtextarea p-inputtext p-component",{"p-disabled":o.disabled,"p-filled":e,"p-inputtextarea-resizable":o.autoResize,"p-invalid":o.invalid,"p-variant-filled":o.variant?o.variant==="filled":r&&r.inputStyle==="filled"})}},q=`
@layer primereact {
    .p-inputtextarea-resizable {
        overflow: hidden;
        resize: none;
    }
    
    .p-fluid .p-inputtextarea {
        width: 100%;
    }
}
`,d=T.extend({defaultProps:{__TYPE:"InputTextarea",__parentMetadata:null,autoResize:!1,invalid:!1,variant:null,keyfilter:null,onBlur:null,onFocus:null,onBeforeInput:null,onInput:null,onKeyDown:null,onKeyUp:null,onPaste:null,tooltip:null,tooltipOptions:null,validateOnly:!1,children:void 0,className:null},css:{classes:Y,styles:q}});function h(n,t){var o=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),o.push.apply(o,r)}return o}function O(n){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?h(Object(o),!0).forEach(function(r){V(n,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):h(Object(o)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(o,r))})}return n}var $=i.memo(i.forwardRef(function(n,t){var o=H(),r=i.useContext(U),e=d.getProps(n,r),p=i.useRef(t),y=i.useRef(0),m=d.setMetaData(O(O({props:e},e.__parentMetadata),{},{context:{disabled:e.disabled}})),P=m.ptm,w=m.cx,I=m.isUnstyled;_(d.css.styles,I,{name:"inputtextarea"});var j=function(l){e.autoResize&&c(),e.onFocus&&e.onFocus(l)},K=function(l){e.autoResize&&c(),e.onBlur&&e.onBlur(l)},B=function(l){e.autoResize&&c(),e.onKeyUp&&e.onKeyUp(l)},E=function(l){e.onKeyDown&&e.onKeyDown(l),e.keyfilter&&b.onKeyPress(l,e.keyfilter,e.validateOnly)},F=function(l){e.onBeforeInput&&e.onBeforeInput(l),e.keyfilter&&b.onBeforeInput(l,e.keyfilter,e.validateOnly)},R=function(l){e.onPaste&&e.onPaste(l),e.keyfilter&&b.onPaste(l,e.keyfilter,e.validateOnly)},z=function(l){var a=l.target;e.autoResize&&c(u.isEmpty(a.value)),e.onInput&&e.onInput(l),u.isNotEmpty(a.value)?v.addClass(a,"p-filled"):v.removeClass(a,"p-filled")},c=function(l){var a=p.current;a&&v.isVisible(a)&&(y.current||(y.current=a.scrollHeight,a.style.overflow="hidden"),(y.current!==a.scrollHeight||l)&&(a.style.height="",a.style.height=a.scrollHeight+"px",parseFloat(a.style.height)>=parseFloat(a.style.maxHeight)?(a.style.overflowY="scroll",a.style.height=a.style.maxHeight):a.style.overflow="hidden",y.current=a.scrollHeight))};i.useEffect(function(){u.combinedRefs(p,t)},[p,t]),i.useEffect(function(){e.autoResize&&c(!0)},[e.autoResize]);var S=i.useMemo(function(){return u.isNotEmpty(e.value)||u.isNotEmpty(e.defaultValue)},[e.value,e.defaultValue]),D=u.isNotEmpty(e.tooltip),N=o({ref:p,className:x(e.className,w("root",{context:r,isFilled:S})),onFocus:j,onBlur:K,onKeyUp:B,onKeyDown:E,onBeforeInput:F,onInput:z,onPaste:R},d.getOtherProps(e),P("root"));return i.createElement(i.Fragment,null,i.createElement("textarea",N),D&&i.createElement(k,g({target:p,content:e.tooltip,pt:P("tooltip")},e.tooltipOptions)))}));$.displayName="InputTextarea";export{$ as I};
