import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{t as n}from"./useEmotionTheme.Dmt_qJ4x.js";import"./src.D7mXJKB_.js";var r=e(t(),1),i=6.5,a=1,o=e=>{let t=0,{current:n}=e;return n&&(n.style.height=`auto`,t=n.scrollHeight,n.style.height=``),t},s=(e,t,n)=>e>0&&n.current?Math.abs(e-t)>a:!1,c=(e,t)=>{if(e.current&&t.current){let{offsetHeight:n}=e.current;if(n===0)return;t.current.minHeight=n,t.current.maxHeight=n*i}},l=(e,t,n)=>e?`${t+a}px`:n?String(n):``,u=e=>e?`${e}px`:``,d=({textareaRef:e,dependencies:t=[]})=>{let i=n(),a=(0,r.useRef)({minHeight:0,maxHeight:0}),[d,f]=(0,r.useState)(0),[p,m]=(0,r.useState)(!1),h=(0,r.useCallback)(()=>{a.current.minHeight===0&&c(e,a),f(o(e))},[e,f]),g=(0,r.useCallback)(()=>{f(0)},[f]);(0,r.useLayoutEffect)(()=>{e.current&&c(e,a)},[e]),(0,r.useLayoutEffect)(()=>{let{minHeight:t}=a.current;m(s(d,t,e))},[d,e]),(0,r.useLayoutEffect)(()=>{h()},[e,h,...t]);let{maxHeight:_}=a.current,v=i.sizes.minElementHeight;return{isExtended:p,height:l(p,d,v),maxHeight:u(_),updateScrollHeight:h,clearScrollHeight:g}};export{d as t};