import f from "./index-url-toolkit.js";
import t from "./index-window.js";
var c = "http://example.com", a = function(o, i) {
  if (/^[a-z]+:/i.test(i))
    return i;
  /^data:/.test(o) && (o = t.location && t.location.href || "");
  var n = typeof t.URL == "function", r = /^\/\//.test(o), u = !t.location && !/\/\//i.test(o);
  if (n ? o = new t.URL(o, t.location || c) : /\/\//i.test(o) || (o = f.buildAbsoluteURL(t.location && t.location.href || "", o)), n) {
    var e = new URL(i, o);
    return u ? e.href.slice(c.length) : r ? e.href.slice(e.protocol.length) : e.href;
  }
  return f.buildAbsoluteURL(o, i);
};
export {
  a as default
};
