import { w as d } from "./Button-DPGn5NZd.js";
import * as t from "react";
import { N as a } from "./PrizeCard-C2El3VOB.js";
function p(e) {
  return d(e).defaultView || window;
}
function w({
  controlled: e,
  default: n,
  name: o,
  state: s = "value"
}) {
  const {
    current: r
  } = t.useRef(e !== void 0), [i, u] = t.useState(n), l = r ? e : i;
  if (process.env.NODE_ENV !== "production") {
    t.useEffect(() => {
      r !== (e !== void 0) && console.error([`MUI: A component is changing the ${r ? "" : "un"}controlled ${s} state of ${o} to be ${r ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${o} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
`));
    }, [s, o, e]);
    const {
      current: c
    } = t.useRef(n);
    t.useEffect(() => {
      !r && !Object.is(c, n) && console.error([`MUI: A component is changing the default ${s} state of an uncontrolled ${o} after being initialized. To suppress this warning opt to use a controlled ${o}.`].join(`
`));
    }, [JSON.stringify(n)]);
  }
  const f = t.useCallback((c) => {
    r || u(c);
  }, []);
  return [l, f];
}
function g(e) {
  const n = t.useRef(e);
  return a(() => {
    n.current = e;
  }), t.useRef((...o) => (
    // @ts-expect-error hide `this`
    (0, n.current)(...o)
  )).current;
}
export {
  g as a,
  p as o,
  w as u
};
