const l = /["&'<>$\x80-\uFFFF]/g, a = /* @__PURE__ */ new Map([
  [34, "&quot;"],
  [38, "&amp;"],
  [39, "&apos;"],
  [60, "&lt;"],
  [62, "&gt;"]
]), x = (
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  String.prototype.codePointAt != null ? (e, t) => e.codePointAt(t) : (
    // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
    (e, t) => (e.charCodeAt(t) & 64512) === 55296 ? (e.charCodeAt(t) - 55296) * 1024 + e.charCodeAt(t + 1) - 56320 + 65536 : e.charCodeAt(t)
  )
);
function i(e) {
  let t = "", c = 0, s;
  for (; (s = l.exec(e)) !== null; ) {
    const n = s.index, o = e.charCodeAt(n), r = a.get(o);
    r !== void 0 ? (t += e.substring(c, n) + r, c = n + 1) : (t += `${e.substring(c, n)}&#x${x(e, n).toString(16)};`, c = l.lastIndex += +((o & 64512) === 55296));
  }
  return t + e.substr(c);
}
function u(e, t) {
  return function(s) {
    let n, o = 0, r = "";
    for (; n = e.exec(s); )
      o !== n.index && (r += s.substring(o, n.index)), r += t.get(n[0].charCodeAt(0)), o = n.index + 1;
    return r + s.substring(o);
  };
}
const d = u(/["&\u00A0]/g, /* @__PURE__ */ new Map([
  [34, "&quot;"],
  [38, "&amp;"],
  [160, "&nbsp;"]
])), p = u(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([
  [38, "&amp;"],
  [60, "&lt;"],
  [62, "&gt;"],
  [160, "&nbsp;"]
]));
export {
  i as encodeXML,
  d as escapeAttribute,
  p as escapeText,
  x as getCodePoint,
  l as xmlReplacer
};
