import { useMemo as a } from "react";
import { canUseDOM as l, sanitizeSvg as g } from "../components/utils.es.js";
function m(e) {
  return a(() => {
    if (!l())
      return {
        isValid: !0,
        svgAttributes: {},
        innerSvgContent: e
      };
    const r = g(e, {
      allowStyles: !1,
      forbiddenAttributes: [],
      forbiddenTags: []
    });
    if (!r)
      return console.warn("InlineSvg: Failed to sanitize SVG data"), {
        isValid: !1,
        svgAttributes: {},
        innerSvgContent: ""
      };
    const t = new DOMParser().parseFromString(r, "image/svg+xml").querySelector("svg");
    if (!t)
      return console.warn("InlineSvg: No SVG element found in markup"), {
        isValid: !1,
        svgAttributes: {},
        innerSvgContent: ""
      };
    const n = {};
    for (const s of Array.from(t.attributes)) {
      const i = s.name.replace(
        /[-:]([a-z])/g,
        (f, o) => o.toUpperCase()
      );
      n[i] = s.value;
    }
    return {
      isValid: !0,
      svgAttributes: n,
      innerSvgContent: t.innerHTML
    };
  }, [e]);
}
export {
  m as u
};
//# sourceMappingURL=use-inline-svg-D-aaBVBt.es.js.map
