import{Bt as e,J as t,Or as n,Sr as r,St as i,Tr as a,Xn as o,Y as s,cn as c,dn as ee,et as te,fn as l,it as u,m as d,mr as f,r as p}from"./jsx-runtime-NwRKtVrk.js";import{_ as m,g as h,l as g}from"./CopyOutlined-bJLUKQgS.js";import{n as _,t as ne}from"./statusUtils-G17j4Ng-.js";import{i as re,r as ie}from"./Input-yLjViSX8.js";var v=()=>f()&&window.document.documentElement,y=n(a()),b=e=>{let{componentCls:t,paddingLG:n}=e,r=`${t}-textarea`;return{[`textarea${t}`]:{maxWidth:`100%`,height:`auto`,minHeight:e.controlHeight,lineHeight:e.lineHeight,verticalAlign:`bottom`,transition:`all ${e.motionDurationSlow}`,resize:`vertical`,[`&${t}-mouse-active`]:{transition:`all ${e.motionDurationSlow}, height 0s, width 0s`}},[`${t}-textarea-affix-wrapper-resize-dirty`]:{width:`auto`},[r]:{position:`relative`,"&-show-count":{[`${t}-data-count`]:{position:`absolute`,bottom:e.calc(e.fontSize).mul(e.lineHeight).mul(-1).equal(),insetInlineEnd:0,color:e.colorTextDescription,whiteSpace:`nowrap`,pointerEvents:`none`}},[`
        &-allow-clear > ${t},
        &-affix-wrapper${r}-has-feedback ${t}
      `]:{paddingInlineEnd:n},[`&-affix-wrapper${t}-affix-wrapper`]:{padding:0,[`> textarea${t}`]:{fontSize:`inherit`,border:`none`,outline:`none`,background:`transparent`,minHeight:e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),"&:focus":{boxShadow:`none !important`}},[`${t}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${t}-clear-icon`]:{position:`absolute`,insetInlineEnd:e.paddingInline,insetBlockStart:e.paddingXS},[`${r}-suffix`]:{position:`absolute`,top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:`inline-flex`,alignItems:`center`,margin:`auto`,pointerEvents:`none`}}},[`&-affix-wrapper${t}-affix-wrapper-rtl`]:{[`${t}-suffix`]:{[`${t}-data-count`]:{direction:`ltr`,insetInlineStart:0}}},[`&-affix-wrapper${t}-affix-wrapper-sm`]:{[`${t}-suffix`]:{[`${t}-clear-icon`]:{insetInlineEnd:e.paddingInlineSM}}}}}},x=i([`Input`,`TextArea`],t=>b(e(t,m(t))),h,{resetFont:!1}),S=(0,y.forwardRef)((e,n)=>{let{prefixCls:i,bordered:a=!0,size:f,disabled:m,status:h,allowClear:v,classNames:b,rootClassName:S,className:C,style:w,styles:T,variant:E,showCount:D,onMouseDown:O,onResize:k,...A}=e,{getPrefixCls:j,direction:M,allowClear:N,autoComplete:P,className:F,style:I,classNames:L,styles:R}=c(`textArea`),z=y.useContext(u),ae=m??z,{status:B,hasFeedback:V,feedbackIcon:H}=y.useContext(d),U=ne(B,h),[W,G]=ee([L,b],[R,T],{props:e}),K=y.useRef(null);y.useImperativeHandle(n,()=>({resizableTextArea:K.current?.resizableTextArea,focus:e=>{o(K.current?.resizableTextArea?.textArea,e)},blur:()=>K.current?.blur(),nativeElement:K.current?.nativeElement||null}));let q=j(`input`,i),J=te(q),[Y,oe]=g(q,S);x(q,J);let{compactSize:se,compactItemClassnames:ce}=t(q,M),X=s(e=>f??se??e),[Z,le]=p(`textArea`,E,a),ue=re({allowClear:v,contextAllowClear:N,componentName:`TextArea`}),[Q,$]=y.useState(!1),[de,fe]=y.useState(!1),pe=e=>{$(!0),O?.(e);let t=()=>{$(!1),document.removeEventListener(`mouseup`,t)};document.addEventListener(`mouseup`,t)},me=e=>{if(k?.(e),Q&&l(getComputedStyle)){let e=K.current?.nativeElement?.querySelector(`textarea`);e&&getComputedStyle(e).resize===`both`&&fe(!0)}};return y.createElement(ie,{autoComplete:P,...A,style:{...G.root,...I,...w},styles:G,disabled:ae,allowClear:ue,className:r(oe,J,C,S,ce,F,W.root,{[`${q}-textarea-affix-wrapper-resize-dirty`]:de}),classNames:{...W,textarea:r({[`${q}-sm`]:X===`small`,[`${q}-lg`]:X===`large`},Y,W.textarea,Q&&`${q}-mouse-active`),variant:r({[`${q}-${Z}`]:le},_(q,U)),affixWrapper:r(`${q}-textarea-affix-wrapper`,{[`${q}-affix-wrapper-rtl`]:M===`rtl`,[`${q}-affix-wrapper-sm`]:X===`small`,[`${q}-affix-wrapper-lg`]:X===`large`,[`${q}-textarea-show-count`]:D||e.count?.show},Y)},prefixCls:q,suffix:V&&y.createElement(`span`,{className:`${q}-textarea-suffix`},H),showCount:D,ref:K,onResize:me,onMouseDown:pe})});export{v as n,S as t};