import e from"@babel/runtime/helpers/slicedToArray";import{jsx as r}from"react/jsx-runtime";import t from"classnames";import{useRef as i,useState as n,useLayoutEffect as o}from"react";import{debounce as s}from"lodash";import{Tooltip as c}from"../Tooltip/Tooltip.js";import l from"./TextEndTruncated.scss.js";var a=function(a){var m=a.children,u=a.disableTooltip,d=a.maxLines,f=void 0===d?1:d,p=a.testId,h=a.className,v=f>1,b=i(null),T=i(v),x=n(null),L=e(x,2),g=L[0],j=L[1],W=n(!0),w=e(W,2),y=w[0],A=w[1];return T.current=v,o((function(){var e=s((function(){requestAnimationFrame((function(){var e=b.current;e&&(j(e.textContent),A(e.scrollWidth<=e.clientWidth&&(e.scrollHeight<=e.clientHeight||!T.current)))}))}),200),r=new ResizeObserver(e),t=new MutationObserver(e);return b.current&&(r.observe(b.current),t.observe(b.current,{childList:!0,subtree:!0,characterData:!0})),function(){r.disconnect(),t.disconnect()}}),[]),r(c,{title:g,disabled:y||u,children:r("div",{className:t(l.root,v?l.multiLine:l.singleLine,h),style:v?{WebkitLineClamp:f}:void 0,ref:b,"data-testid":p,children:m})})};export{a as TextEndTruncated};
//# sourceMappingURL=TextEndTruncated.js.map
