"use client";
import { decodeNamedCharacterReference as n } from "../decode-named-character-reference/index.dom.js";
import { decodeNumericCharacterReference as o } from "../micromark-util-decode-numeric-character-reference/index.js";
const a = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
function s(r) {
  return r.replace(a, i);
}
function i(r, c, e) {
  if (c)
    return c;
  if (e.charCodeAt(0) === 35) {
    const t = e.charCodeAt(1), d = t === 120 || t === 88;
    return o(e.slice(d ? 2 : 1), d ? 16 : 10);
  }
  return n(e) || r;
}
export {
  s as decodeString
};
