import { t as __commonJSMin } from "./chunk-BNovOVIE.js";
var require_constants = /* @__PURE__ */ __commonJSMin(((e) => {
  Object.defineProperty(e, "__esModule", { value: true }), e.BLANK_URL = e.relativeFirstCharacters = e.whitespaceEscapeCharsRegex = e.urlSchemeRegex = e.ctrlCharactersRegex = e.htmlCtrlEntityRegex = e.htmlEntitiesRegex = e.invalidProtocolRegex = void 0, e.invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im, e.htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g, e.htmlCtrlEntityRegex = /&(newline|tab);/gi, e.ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim, e.urlSchemeRegex = /^.+(:|&colon;)/gim, e.whitespaceEscapeCharsRegex = /(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g, e.relativeFirstCharacters = [".", "/"], e.BLANK_URL = "about:blank";
})), require_dist = /* @__PURE__ */ __commonJSMin(((e) => {
  Object.defineProperty(e, "__esModule", { value: true }), e.sanitizeUrl = void 0;
  var n = require_constants();
  function r(e2) {
    return n.relativeFirstCharacters.indexOf(e2[0]) > -1;
  }
  function i(e2) {
    return e2.replace(n.ctrlCharactersRegex, "").replace(n.htmlEntitiesRegex, function(e3, t) {
      return String.fromCharCode(t);
    });
  }
  function a(e2) {
    return URL.canParse(e2);
  }
  function o(e2) {
    try {
      return decodeURIComponent(e2);
    } catch {
      return e2;
    }
  }
  function s(e2) {
    if (!e2) return n.BLANK_URL;
    var t, s2 = o(e2.trim());
    do
      s2 = i(s2).replace(n.htmlCtrlEntityRegex, "").replace(n.ctrlCharactersRegex, "").replace(n.whitespaceEscapeCharsRegex, "").trim(), s2 = o(s2), t = s2.match(n.ctrlCharactersRegex) || s2.match(n.htmlEntitiesRegex) || s2.match(n.htmlCtrlEntityRegex) || s2.match(n.whitespaceEscapeCharsRegex);
    while (t && t.length > 0);
    var c = s2;
    if (!c) return n.BLANK_URL;
    if (r(c)) return c;
    var l = c.trimStart(), u = l.match(n.urlSchemeRegex);
    if (!u) return c;
    var d = u[0].toLowerCase().trim();
    if (n.invalidProtocolRegex.test(d)) return n.BLANK_URL;
    var f = l.replace(/\\/g, "/");
    if (d === "mailto:" || d.includes("://")) return f;
    if (d === "http:" || d === "https:") {
      if (!a(f)) return n.BLANK_URL;
      var p = new URL(f);
      return p.protocol = p.protocol.toLowerCase(), p.hostname = p.hostname.toLowerCase(), p.toString();
    }
    return f;
  }
  e.sanitizeUrl = s;
}));
export {
  require_dist as t
};
