"use client";
import { asciiAlphanumeric as f } from "../micromark-util-character/index.js";
function h(r) {
  const s = [];
  let t = -1, n = 0, o = 0;
  for (; ++t < r.length; ) {
    const e = r.charCodeAt(t);
    let i = "";
    if (e === 37 && f(r.charCodeAt(t + 1)) && f(r.charCodeAt(t + 2)))
      o = 2;
    else if (e < 128)
      /[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(e)) || (i = String.fromCharCode(e));
    else if (e > 55295 && e < 57344) {
      const c = r.charCodeAt(t + 1);
      e < 56320 && c > 56319 && c < 57344 ? (i = String.fromCharCode(e, c), o = 1) : i = "�";
    } else
      i = String.fromCharCode(e);
    i && (s.push(r.slice(n, t), encodeURIComponent(i)), n = t + o + 1, i = ""), o && (t += o, o = 0);
  }
  return s.join("") + r.slice(n);
}
export {
  h as normalizeUri
};
