"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.useShrink=function(t){var n=t.propOnFocus,r=t.propOnBlur,o=t.value,u=t.suffix,f=t.prefix,l=t.status,i=String(o).length>0,s=e.useState(!1),a=s[0],c=s[1],p=e.useState({left:0,right:0}),v=p[0],d=p[1],h=e.useRef(null),g=e.useRef(null),x=function(){var e,t,n,r=(null===(e=function(e,t){if(e&&t&&e!==t){for(var n=0,r=0,o=e;o&&o!==t;)n+=o.offsetLeft,r+=o.offsetTop,o=o.parentElement;return{offsetLeft:n,offsetTop:r}}}(g.current,h.current))||void 0===e?void 0:e.offsetLeft)||0;d({left:r,right:((null===(t=h.current)||void 0===t?void 0:t.offsetWidth)||0)-r-((null===(n=g.current)||void 0===n?void 0:n.offsetWidth)||0)})},y=e.useCallback((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];null==n||n.apply(void 0,e),c(!0)}),[n]),L=e.useCallback((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];null==r||r.apply(void 0,e),c(!1),x()}),[r]);return e.useLayoutEffect(x,[f,u,l]),e.useMemo((function(){var e=i||a;return{ref:h,inputRef:g,InputLabelProps:{component:"div",shrink:e,style:{padding:e?"0px":"0 ".concat(v.right,"px 0 ").concat(v.left,"px")}},onFocus:y,onBlur:L}}),[i,a,y,L,v])};
