!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("querystring")):"function"==typeof define&&define.amd?define(["exports","querystring"],t):t(e.nativeUrl={},e.querystring)}(this,function(e,t){t=t&&t.hasOwnProperty("default")?t.default:t;var o=/https?|ftp|gopher|file/;function r(e){"string"==typeof e&&(e=v(e));var r=function(e,t,o){var r=e.auth,a=e.hostname,s=e.protocol||"",n=e.pathname||"",p=e.hash||"",c=e.query||"",h=!1;r=r?encodeURIComponent(r).replace(/%3A/i,":")+"@":"",e.host?h=r+e.host:a&&(h=r+(~a.indexOf(":")?"["+a+"]":a),e.port&&(h+=":"+e.port)),c&&"object"==typeof c&&(c=t.encode(c));var l=e.search||c&&"?"+c||"";return s&&":"!==s.substr(-1)&&(s+=":"),e.slashes||(!s||o.test(s))&&!1!==h?(h="//"+(h||""),n&&"/"!==n[0]&&(n="/"+n)):h||(h=""),p&&"#"!==p[0]&&(p="#"+p),l&&"?"!==l[0]&&(l="?"+l),{protocol:s,host:h,pathname:n=n.replace(/[?#]/g,encodeURIComponent),search:l=l.replace("#","%23"),hash:p}}(e,t,o);return""+r.protocol+r.host+r.pathname+r.search+r.hash}var a="http://",s="w.w",n=a+s,p=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,c=/https?|ftp|gopher|file/;function h(e,t){var o="string"==typeof e?v(e):e;e="object"==typeof e?r(e):e;var s=v(t),h="";o.protocol&&!o.slashes&&(h=o.protocol,e=e.replace(o.protocol,""),h+="/"===t[0]||"/"===e[0]?"/":""),h&&s.protocol&&(h="",s.slashes||(h=s.protocol,t=t.replace(s.protocol,"")));var l=e.match(p);l&&!s.protocol&&(e=e.substr((h=l[1]+(l[2]||"")).length),/^\/\/[^/]/.test(t)&&(h=h.slice(0,-1)));var i=new URL(e,n+"/"),u=new URL(t,i).toString().replace(n,""),f=s.protocol||o.protocol;return f+=o.slashes||s.slashes?"//":"",!h&&f?u=u.replace(a,f):h&&(u=u.replace(a,"")),c.test(u)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==u.slice(-1)||(u=u.slice(0,-1)),h&&(u=h+("/"===u[0]?u.substr(1):u)),u}function l(){}l.prototype.parse=v,l.prototype.format=r,l.prototype.resolve=h,l.prototype.resolveObject=h;var i=/^https?|ftp|gopher|file/,u=/^(.*?)([#?].*)/,f=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,d=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function v(e,o,a){if(void 0===o&&(o=!1),void 0===a&&(a=!1),e&&"object"==typeof e&&e instanceof l)return e;var p=(e=e.trim()).match(u);e=p?p[1].replace(/\\/g,"/")+p[2]:e.replace(/\\/g,"/"),d.test(e)&&"/"!==e.slice(-1)&&(e+="/");var c=!/(^javascript)/.test(e)&&e.match(f),h=m.test(e),v="";c&&(i.test(c[1])||(v=c[1].toLowerCase(),e=""+c[2]+c[3]),c[2]||(h=!1,i.test(c[1])?(v=c[1],e=""+c[3]):e="//"+c[3]),3!==c[2].length&&1!==c[2].length||(v=c[1],e="/"+c[3]));var g,y=(p?p[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),b=y&&y[1],U=new l,C="",j="";try{g=new URL(e)}catch(t){C=t,v||a||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(j="/",e=e.substr(1));try{g=new URL(e,n)}catch(e){return U.protocol=v,U.href=v,U}}U.slashes=h&&!j,U.host=g.host===s?"":g.host,U.hostname=g.hostname===s?"":g.hostname.replace(/(\[|\])/g,""),U.protocol=C?v||null:g.protocol,U.search=g.search.replace(/\\/g,"%5C"),U.hash=g.hash.replace(/\\/g,"%5C");var w=e.split("#");!U.search&&~w[0].indexOf("?")&&(U.search="?"),U.hash||""!==w[1]||(U.hash="#"),U.query=o?t.decode(g.search.substr(1)):U.search.substr(1),U.pathname=j+(c?function(e){return e.replace(/['^|`]/g,function(e){return"%"+e.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{return decodeURIComponent(t).split("").map(function(e){var t=e.charCodeAt();return t>256||/^[a-z0-9]$/i.test(e)?e:"%"+t.toString(16).toUpperCase()}).join("")}catch(e){return t}})}(g.pathname):g.pathname),"about:"===U.protocol&&"blank"===U.pathname&&(U.protocol="",U.pathname=""),C&&"/"!==e[0]&&(U.pathname=U.pathname.substr(1)),v&&!i.test(v)&&"/"!==e.slice(-1)&&"/"===U.pathname&&(U.pathname=""),U.path=U.pathname+U.search,U.auth=[g.username,g.password].map(decodeURIComponent).filter(Boolean).join(":"),U.port=g.port,b&&!U.host.endsWith(b)&&(U.host+=b,U.port=b.slice(1)),U.href=j?""+U.pathname+U.search+U.hash:r(U);var O=/^(file)/.test(U.href)?["host","hostname"]:[];return Object.keys(U).forEach(function(e){~O.indexOf(e)||(U[e]=U[e]||null)}),U}e.parse=v,e.format=r,e.resolve=h,e.resolveObject=function(e,t){return v(h(e,t))},e.Url=l});
//# sourceMappingURL=index.umd.js.map
