import { jsx as n } from "react/jsx-runtime";
import { useRef as p, useLayoutEffect as c } from "react";
import o from "prop-types";
import { update as u } from "@arcblock/did-motif";
import { Box as s } from "@mui/material";
function d({ did: i, size: t = 200, animation: l = !1, shape: a = null, responsive: m = !1, ...e }) {
  const r = p(null);
  if (c(() => {
    u(r.current, i, { size: t, animation: l, shape: a });
  }, [i, t, a]), m) {
    const f = { ...e.style, width: "100%" };
    return /* @__PURE__ */ n(s, { component: "svg", ref: r, ...e, style: f, className: "arc-avatar-did-motif" });
  }
  return /* @__PURE__ */ n(
    s,
    {
      component: "span",
      ...e,
      style: { display: "inline-block", width: t, height: t, ...e.style },
      className: "arc-avatar-did-motif",
      children: /* @__PURE__ */ n(s, { component: "svg", ref: r, style: { width: "100%" } })
    }
  );
}
d.propTypes = {
  did: o.string.isRequired,
  size: o.number,
  animation: o.bool,
  // 直接返回 svg 元素, svg 尺寸由父窗口决定 (撑满父窗口)
  responsive: o.bool,
  shape: o.number
};
export {
  d as default
};
