!function(t){"use strict";var y=/^[a-z]+:/,d=/[-a-z0-9]+(\.[-a-z0-9])*:\d+/i,v=/\/\/(.*?)(?::(.*?))?@/,r=/^win/i,g=/:$/,m=/^\?/,q=/^#/,w=/(.*\/)/,A=/^\/{2,}/,e=/'/g,o=/%([ef][0-9a-f])%([89ab][0-9a-f])%([89ab][0-9a-f])/gi,n=/%([cd][0-9a-f])%([89ab][0-9a-f])/gi,i=/%([0-7][0-9a-f])/gi,p=/\+/g,s=/^\w:$/,C=/[^/#?]/;var a,I="undefined"==typeof window&&"undefined"!=typeof global&&"function"==typeof require,S=I?t.require:null,b={protocol:"protocol",host:"hostname",port:"port",path:"pathname",query:"search",hash:"hash"},j={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function x(){return I?(a||(a="file://"+(process.platform.match(r)?"/":"")+S("fs").realpathSync(".")),a):document.location.href}function h(t,r,e){var o,n,i;r||(r=x()),I?o=S("url").parse(r):(o=document.createElement("a")).href=r;var s,p,a=(p={path:!0,query:!0,hash:!0},(s=r)&&y.test(s)&&(p.protocol=!0,p.host=!0,d.test(s)&&(p.port=!0),v.test(s)&&(p.user=!0,p.pass=!0)),p);for(n in i=r.match(v)||[],b)a[n]?t[n]=o[b[n]]||"":t[n]="";if(t.protocol=t.protocol.replace(g,""),t.query=t.query.replace(m,""),t.hash=z(t.hash.replace(q,"")),t.user=z(i[1]||""),t.pass=z(i[2]||""),t.port=j[t.protocol]==t.port||0==t.port?"":t.port,!a.protocol&&C.test(r.charAt(0))&&(t.path=r.split("?")[0].split("#")[0]),!a.protocol&&e){var h=new U(x().match(w)[0]),u=h.path.split("/"),c=t.path.split("/"),f=["protocol","user","pass","host","port"],l=f.length;for(u.pop(),n=0;n