import { p as c } from "../.chunks/punycode.es6-CgGegfA_.es.js";
const i = (e = "") => {
  if (e = e.replace(/[\r\n]/g, " ").trim(), e.indexOf("xn--") === -1) return e;
  if (e.indexOf("/") === -1) return c.toUnicode(e);
  const t = a(e);
  let o = t.toLowerCase();
  return o = c.toUnicode(o), t !== o && (e = e.replace(t, o)), e;
}, m = (e) => {
  if (e = e.replace(/[\r\n]/g, " ").trim(), e.indexOf("/") === -1) return c.toASCII(e);
  const t = a(e);
  let o = t.toLowerCase();
  return o = c.toASCII(o), t !== o && (e = e.replace(t, o)), e;
}, a = (e) => e.replace(/(?:^\w+:\/\/)?([^:/]+).*/i, "$1"), g = (e) => (e = i(e), e = C(e), e), C = (e) => {
  const t = a(e), o = t.toLowerCase();
  return t !== o && (e = e.replace(t, o)), e;
}, p = (e) => escape(d(e)), S = (e) => f(unescape(e)), d = (e) => {
  e = e.replace(/\r\n/g, `
`);
  let t = "";
  for (let o = 0; o < e.length; o++) {
    const r = e.charCodeAt(o);
    r < 128 ? t += String.fromCharCode(r) : r > 127 && r < 2048 ? (t += String.fromCharCode(r >> 6 | 192), t += String.fromCharCode(r & 63 | 128)) : (t += String.fromCharCode(r >> 12 | 224), t += String.fromCharCode(r >> 6 & 63 | 128), t += String.fromCharCode(r & 63 | 128));
  }
  return t;
}, f = (e) => {
  let t = "", o = 0, r = 0, n = 0;
  for (; o < e.length; )
    if (r = e.charCodeAt(o), r < 128)
      t += String.fromCharCode(r), o++;
    else if (r > 191 && r < 224)
      n = e.charCodeAt(o + 1), t += String.fromCharCode((r & 31) << 6 | n & 63), o += 2;
    else {
      n = e.charCodeAt(o + 1);
      let s = e.charCodeAt(o + 2);
      t += String.fromCharCode((r & 15) << 12 | (n & 63) << 6 | s & 63), o += 3;
    }
  return t;
};
export {
  S as decode,
  p as encode,
  i as fromPuny,
  a as getHost,
  C as hostToLowerCase,
  g as normalize,
  m as toPuny
};
//# sourceMappingURL=url.js.map
