"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("prop-types"),u=require("@material-ui/core"),i=require("lodash"),a=require("react/jsx-runtime");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(e),o=l(t),s=u.makeStyles({formControl:{width:function(e){return e.isTablet?"200px":"150px"}}}),d=i.debounce((function(e){e()}),1500);function c(e){var t=e.radius,i=e.editable,l=e.onChange,o=e.isTablet,c=s({isTablet:o}),f=r.useState(t),b=n.default(f,2),p=b[0],m=b[1],q=r.useState(null),T=n.default(q,2),h=T[0],x=T[1];r.useEffect((function(){m(t)}),[t]);return a.jsx(u.Tooltip,{title:i?"":"To make radius active select Subject Well.",children:a.jsx(u.TextField,{type:"number",label:"Radius (miles)",value:p,disabled:!i,onChange:function(e){var r=e.target.value;!Number.isFinite(+r)||+r<0?x("Incorrect radius"):(x(null),d((function(){l(+r)}))),m(r)},error:!!h,helperText:h,className:c.formControl})})}c.propTypes={radius:o.default.number.isRequired,editable:o.default.bool.isRequired,onChange:o.default.func.isRequired,isTablet:o.default.bool.isRequired},module.exports=c;
