"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e);exports.useCustomShrink=function(e){var n=e.startIcon,u=e.endIcon,o=e.onFocus,l=e.onBlur,s=e.value,f=e.InputProps,a=t.useState(),i=r.default(a,2),d=i[0],c=i[1],p=t.useState(),v=r.default(p,2),h=v[0],b=v[1],m=t.useState("string"==typeof s&&0!==s.length||"number"==typeof s&&0!==String(s).length||!(null==f||!f.startAdornment)||!1),g=r.default(m,2),y=g[0],A=g[1],I=t.useRef(null),S=t.useRef(null);return t.useEffect((function(){var e,t;c(null===(e=I.current)||void 0===e?void 0:e.offsetWidth),b(null===(t=S.current)||void 0===t?void 0:t.offsetWidth)}),[n,u]),{shrink:y,onInputFocus:function(e){A(!0),o&&o(e)},onInputBlur:function(e){0!==e.target.value.length||null!=f&&f.startAdornment||A(!1),l&&l(e)},startLabelOffset:d,endLabelOffset:h,startAdornmentRef:I,endAdornmentRef:S}};
