import * as e from "react";
function f({
  controlled: t,
  default: n,
  name: r,
  state: i = "value"
}) {
  const {
    current: o
  } = e.useRef(t !== void 0), [l, c] = e.useState(n), a = o ? t : l;
  if (process.env.NODE_ENV !== "production") {
    e.useEffect(() => {
    }, [i, r, t]);
    const {
      current: s
    } = e.useRef(n);
    e.useEffect(() => {
      !o && Object.is(s, n);
    }, [JSON.stringify(n)]);
  }
  const u = e.useCallback((s) => {
    o || c(s);
  }, []);
  return [a, u];
}
export {
  f as default
};
