import { jsx as d } from "react/jsx-runtime";
import { useRef as f, useMemo as m, useState as c, useEffect as i } from "react";
import a from "@solana/qr-code-styling";
import { Box as l } from "@mui/material";
const y = {
  margin: 0,
  dotsOptions: {
    type: "dots"
  },
  cornersSquareOptions: {
    type: "extra-rounded"
  },
  cornersDotOptions: {
    type: "dot"
  }
};
function C({ data: s, size: r, image: e = void 0, config: u = {}, ...p }) {
  const o = f(null), n = m(() => ({
    ...y,
    data: s,
    width: r,
    height: r,
    ...e && {
      image: e,
      imageOptions: {
        crossOrigin: "anonymous",
        margin: 0
      }
    },
    ...u
  }), [s, r, e, u]), [t] = c(new a(n));
  return i(() => {
    o.current && t.append(o.current);
  }, [t, o]), i(() => {
    t && t.update(n);
  }, [n, t]), /* @__PURE__ */ d(l, { ref: o, ...p });
}
export {
  C as default
};
