import * as i from "react";
import { getStyleStr as o } from "./utils.mjs";
const p = {
  visibility: "visible !important"
};
function n(m) {
  const [t] = i.useState(() => /* @__PURE__ */ new Map());
  return [(e, r, a) => {
    if (a) {
      if (!t.get(a)) {
        const l = document.createElement("div");
        t.set(a, l);
      }
      const s = t.get(a);
      s.setAttribute("style", o(Object.assign(Object.assign(Object.assign({}, m), {
        backgroundImage: `url('${e}')`,
        backgroundSize: `${Math.floor(r)}px`
      }), p))), s.removeAttribute("class"), a.append(s);
    }
  }, (e) => {
    const r = t.get(e);
    r && e && e.removeChild(r), t.delete(e);
  }, (e) => Array.from(t.values()).includes(e)];
}
export {
  n as default
};
