index.cjs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. 'use strict';
  2. const n = /[^\0-\x7E]/;
  3. const t = /[\x2E\u3002\uFF0E\uFF61]/g;
  4. const o = {
  5. overflow: "Overflow Error",
  6. "not-basic": "Illegal Input",
  7. "invalid-input": "Invalid Input"
  8. };
  9. const e = Math.floor;
  10. const r = String.fromCharCode;
  11. function s(n2) {
  12. throw new RangeError(o[n2]);
  13. }
  14. const c = function(n2, t2) {
  15. return n2 + 22 + 75 * (n2 < 26) - ((t2 != 0) << 5);
  16. };
  17. const u = function(n2, t2, o2) {
  18. let r2 = 0;
  19. for (n2 = o2 ? e(n2 / 700) : n2 >> 1, n2 += e(n2 / t2); n2 > 455; r2 += 36) {
  20. n2 = e(n2 / 35);
  21. }
  22. return e(r2 + 36 * n2 / (n2 + 38));
  23. };
  24. function toASCII(o2) {
  25. return function(n2, o3) {
  26. const e2 = n2.split("@");
  27. let r2 = "";
  28. e2.length > 1 && (r2 = e2[0] + "@", n2 = e2[1]);
  29. const s2 = function(n3, t2) {
  30. const o4 = [];
  31. let e3 = n3.length;
  32. for (; e3--; ) {
  33. o4[e3] = t2(n3[e3]);
  34. }
  35. return o4;
  36. }((n2 = n2.replace(t, ".")).split("."), o3).join(".");
  37. return r2 + s2;
  38. }(o2, function(t2) {
  39. return n.test(t2) ? "xn--" + function(n2) {
  40. const t3 = [];
  41. const o3 = (n2 = function(n3) {
  42. const t4 = [];
  43. let o4 = 0;
  44. const e2 = n3.length;
  45. for (; o4 < e2; ) {
  46. const r2 = n3.charCodeAt(o4++);
  47. if (r2 >= 55296 && r2 <= 56319 && o4 < e2) {
  48. const e3 = n3.charCodeAt(o4++);
  49. (64512 & e3) == 56320 ? t4.push(((1023 & r2) << 10) + (1023 & e3) + 65536) : (t4.push(r2), o4--);
  50. } else {
  51. t4.push(r2);
  52. }
  53. }
  54. return t4;
  55. }(n2)).length;
  56. let f = 128;
  57. let i = 0;
  58. let l = 72;
  59. for (const o4 of n2) {
  60. o4 < 128 && t3.push(r(o4));
  61. }
  62. const h = t3.length;
  63. let p = h;
  64. for (h && t3.push("-"); p < o3; ) {
  65. let o4 = 2147483647;
  66. for (const t4 of n2) {
  67. t4 >= f && t4 < o4 && (o4 = t4);
  68. }
  69. const a = p + 1;
  70. o4 - f > e((2147483647 - i) / a) && s("overflow"), i += (o4 - f) * a, f = o4;
  71. for (const o5 of n2) {
  72. if (o5 < f && ++i > 2147483647 && s("overflow"), o5 == f) {
  73. let n3 = i;
  74. for (let o6 = 36; ; o6 += 36) {
  75. const s2 = o6 <= l ? 1 : o6 >= l + 26 ? 26 : o6 - l;
  76. if (n3 < s2) {
  77. break;
  78. }
  79. const u2 = n3 - s2;
  80. const f2 = 36 - s2;
  81. t3.push(r(c(s2 + u2 % f2, 0))), n3 = e(u2 / f2);
  82. }
  83. t3.push(r(c(n3, 0))), l = u(i, a, p == h), i = 0, ++p;
  84. }
  85. }
  86. ++i, ++f;
  87. }
  88. return t3.join("");
  89. }(t2) : t2;
  90. });
  91. }
  92. const HASH_RE = /#/g;
  93. const AMPERSAND_RE = /&/g;
  94. const SLASH_RE = /\//g;
  95. const EQUAL_RE = /=/g;
  96. const IM_RE = /\?/g;
  97. const PLUS_RE = /\+/g;
  98. const ENC_CARET_RE = /%5e/gi;
  99. const ENC_BACKTICK_RE = /%60/gi;
  100. const ENC_CURLY_OPEN_RE = /%7b/gi;
  101. const ENC_PIPE_RE = /%7c/gi;
  102. const ENC_CURLY_CLOSE_RE = /%7d/gi;
  103. const ENC_SPACE_RE = /%20/gi;
  104. const ENC_SLASH_RE = /%2f/gi;
  105. const ENC_ENC_SLASH_RE = /%252f/gi;
  106. function encode(text) {
  107. return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
  108. }
  109. function encodeHash(text) {
  110. return encode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
  111. }
  112. function encodeQueryValue(input) {
  113. return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
  114. }
  115. function encodeQueryKey(text) {
  116. return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
  117. }
  118. function encodePath(text) {
  119. return encode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F").replace(ENC_ENC_SLASH_RE, "%2F").replace(AMPERSAND_RE, "%26").replace(PLUS_RE, "%2B");
  120. }
  121. function encodeParam(text) {
  122. return encodePath(text).replace(SLASH_RE, "%2F");
  123. }
  124. function decode(text = "") {
  125. try {
  126. return decodeURIComponent("" + text);
  127. } catch {
  128. return "" + text;
  129. }
  130. }
  131. function decodePath(text) {
  132. return decode(text.replace(ENC_SLASH_RE, "%252F"));
  133. }
  134. function decodeQueryKey(text) {
  135. return decode(text.replace(PLUS_RE, " "));
  136. }
  137. function decodeQueryValue(text) {
  138. return decode(text.replace(PLUS_RE, " "));
  139. }
  140. function encodeHost(name = "") {
  141. return toASCII(name);
  142. }
  143. function parseQuery(parametersString = "") {
  144. const object = {};
  145. if (parametersString[0] === "?") {
  146. parametersString = parametersString.slice(1);
  147. }
  148. for (const parameter of parametersString.split("&")) {
  149. const s = parameter.match(/([^=]+)=?(.*)/) || [];
  150. if (s.length < 2) {
  151. continue;
  152. }
  153. const key = decodeQueryKey(s[1]);
  154. if (key === "__proto__" || key === "constructor") {
  155. continue;
  156. }
  157. const value = decodeQueryValue(s[2] || "");
  158. if (object[key] === void 0) {
  159. object[key] = value;
  160. } else if (Array.isArray(object[key])) {
  161. object[key].push(value);
  162. } else {
  163. object[key] = [object[key], value];
  164. }
  165. }
  166. return object;
  167. }
  168. function encodeQueryItem(key, value) {
  169. if (typeof value === "number" || typeof value === "boolean") {
  170. value = String(value);
  171. }
  172. if (!value) {
  173. return encodeQueryKey(key);
  174. }
  175. if (Array.isArray(value)) {
  176. return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
  177. }
  178. return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
  179. }
  180. function stringifyQuery(query) {
  181. return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
  182. }
  183. const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
  184. const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
  185. const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
  186. const PROTOCOL_SCRIPT_RE = /^[\s\0]*(blob|data|javascript|vbscript):$/i;
  187. const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
  188. const JOIN_LEADING_SLASH_RE = /^\.?\//;
  189. function isRelative(inputString) {
  190. return ["./", "../"].some((string_) => inputString.startsWith(string_));
  191. }
  192. function hasProtocol(inputString, opts = {}) {
  193. if (typeof opts === "boolean") {
  194. opts = { acceptRelative: opts };
  195. }
  196. if (opts.strict) {
  197. return PROTOCOL_STRICT_REGEX.test(inputString);
  198. }
  199. return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
  200. }
  201. function isScriptProtocol(protocol) {
  202. return !!protocol && PROTOCOL_SCRIPT_RE.test(protocol);
  203. }
  204. function hasTrailingSlash(input = "", respectQueryAndFragment) {
  205. if (!respectQueryAndFragment) {
  206. return input.endsWith("/");
  207. }
  208. return TRAILING_SLASH_RE.test(input);
  209. }
  210. function withoutTrailingSlash(input = "", respectQueryAndFragment) {
  211. if (!respectQueryAndFragment) {
  212. return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
  213. }
  214. if (!hasTrailingSlash(input, true)) {
  215. return input || "/";
  216. }
  217. let path = input;
  218. let fragment = "";
  219. const fragmentIndex = input.indexOf("#");
  220. if (fragmentIndex >= 0) {
  221. path = input.slice(0, fragmentIndex);
  222. fragment = input.slice(fragmentIndex);
  223. }
  224. const [s0, ...s] = path.split("?");
  225. return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
  226. }
  227. function withTrailingSlash(input = "", respectQueryAndFragment) {
  228. if (!respectQueryAndFragment) {
  229. return input.endsWith("/") ? input : input + "/";
  230. }
  231. if (hasTrailingSlash(input, true)) {
  232. return input || "/";
  233. }
  234. let path = input;
  235. let fragment = "";
  236. const fragmentIndex = input.indexOf("#");
  237. if (fragmentIndex >= 0) {
  238. path = input.slice(0, fragmentIndex);
  239. fragment = input.slice(fragmentIndex);
  240. if (!path) {
  241. return fragment;
  242. }
  243. }
  244. const [s0, ...s] = path.split("?");
  245. return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
  246. }
  247. function hasLeadingSlash(input = "") {
  248. return input.startsWith("/");
  249. }
  250. function withoutLeadingSlash(input = "") {
  251. return (hasLeadingSlash(input) ? input.slice(1) : input) || "/";
  252. }
  253. function withLeadingSlash(input = "") {
  254. return hasLeadingSlash(input) ? input : "/" + input;
  255. }
  256. function cleanDoubleSlashes(input = "") {
  257. return input.split("://").map((string_) => string_.replace(/\/{2,}/g, "/")).join("://");
  258. }
  259. function withBase(input, base) {
  260. if (isEmptyURL(base) || hasProtocol(input)) {
  261. return input;
  262. }
  263. const _base = withoutTrailingSlash(base);
  264. if (input.startsWith(_base)) {
  265. return input;
  266. }
  267. return joinURL(_base, input);
  268. }
  269. function withoutBase(input, base) {
  270. if (isEmptyURL(base)) {
  271. return input;
  272. }
  273. const _base = withoutTrailingSlash(base);
  274. if (!input.startsWith(_base)) {
  275. return input;
  276. }
  277. const trimmed = input.slice(_base.length);
  278. return trimmed[0] === "/" ? trimmed : "/" + trimmed;
  279. }
  280. function withQuery(input, query) {
  281. const parsed = parseURL(input);
  282. const mergedQuery = { ...parseQuery(parsed.search), ...query };
  283. parsed.search = stringifyQuery(mergedQuery);
  284. return stringifyParsedURL(parsed);
  285. }
  286. function getQuery(input) {
  287. return parseQuery(parseURL(input).search);
  288. }
  289. function isEmptyURL(url) {
  290. return !url || url === "/";
  291. }
  292. function isNonEmptyURL(url) {
  293. return url && url !== "/";
  294. }
  295. function joinURL(base, ...input) {
  296. let url = base || "";
  297. for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
  298. if (url) {
  299. const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
  300. url = withTrailingSlash(url) + _segment;
  301. } else {
  302. url = segment;
  303. }
  304. }
  305. return url;
  306. }
  307. function withHttp(input) {
  308. return withProtocol(input, "http://");
  309. }
  310. function withHttps(input) {
  311. return withProtocol(input, "https://");
  312. }
  313. function withoutProtocol(input) {
  314. return withProtocol(input, "");
  315. }
  316. function withProtocol(input, protocol) {
  317. const match = input.match(PROTOCOL_REGEX);
  318. if (!match) {
  319. return protocol + input;
  320. }
  321. return protocol + input.slice(match[0].length);
  322. }
  323. function normalizeURL(input) {
  324. const parsed = parseURL(input);
  325. parsed.pathname = encodePath(decodePath(parsed.pathname));
  326. parsed.hash = encodeHash(decode(parsed.hash));
  327. parsed.host = encodeHost(decode(parsed.host));
  328. parsed.search = stringifyQuery(parseQuery(parsed.search));
  329. return stringifyParsedURL(parsed);
  330. }
  331. function resolveURL(base = "", ...inputs) {
  332. if (typeof base !== "string") {
  333. throw new TypeError(
  334. `URL input should be string received ${typeof base} (${base})`
  335. );
  336. }
  337. const filteredInputs = inputs.filter((input) => isNonEmptyURL(input));
  338. if (filteredInputs.length === 0) {
  339. return base;
  340. }
  341. const url = parseURL(base);
  342. for (const inputSegment of filteredInputs) {
  343. const urlSegment = parseURL(inputSegment);
  344. if (urlSegment.pathname) {
  345. url.pathname = withTrailingSlash(url.pathname) + withoutLeadingSlash(urlSegment.pathname);
  346. }
  347. if (urlSegment.hash && urlSegment.hash !== "#") {
  348. url.hash = urlSegment.hash;
  349. }
  350. if (urlSegment.search && urlSegment.search !== "?") {
  351. if (url.search && url.search !== "?") {
  352. const queryString = stringifyQuery({
  353. ...parseQuery(url.search),
  354. ...parseQuery(urlSegment.search)
  355. });
  356. url.search = queryString.length > 0 ? "?" + queryString : "";
  357. } else {
  358. url.search = urlSegment.search;
  359. }
  360. }
  361. }
  362. return stringifyParsedURL(url);
  363. }
  364. function isSamePath(p1, p2) {
  365. return decode(withoutTrailingSlash(p1)) === decode(withoutTrailingSlash(p2));
  366. }
  367. function isEqual(a, b, options = {}) {
  368. if (!options.trailingSlash) {
  369. a = withTrailingSlash(a);
  370. b = withTrailingSlash(b);
  371. }
  372. if (!options.leadingSlash) {
  373. a = withLeadingSlash(a);
  374. b = withLeadingSlash(b);
  375. }
  376. if (!options.encoding) {
  377. a = decode(a);
  378. b = decode(b);
  379. }
  380. return a === b;
  381. }
  382. function withFragment(input, hash) {
  383. if (!hash || hash === "#") {
  384. return input;
  385. }
  386. const parsed = parseURL(input);
  387. parsed.hash = hash === "" ? "" : "#" + encodeHash(hash);
  388. return stringifyParsedURL(parsed);
  389. }
  390. function withoutFragment(input) {
  391. return stringifyParsedURL({ ...parseURL(input), hash: "" });
  392. }
  393. const protocolRelative = Symbol.for("ufo:protocolRelative");
  394. function parseURL(input = "", defaultProto) {
  395. const _specialProtoMatch = input.match(
  396. /^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
  397. );
  398. if (_specialProtoMatch) {
  399. const [, _proto, _pathname = ""] = _specialProtoMatch;
  400. return {
  401. protocol: _proto.toLowerCase(),
  402. pathname: _pathname,
  403. href: _proto + _pathname,
  404. auth: "",
  405. host: "",
  406. search: "",
  407. hash: ""
  408. };
  409. }
  410. if (!hasProtocol(input, { acceptRelative: true })) {
  411. return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
  412. }
  413. const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
  414. const [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
  415. const { pathname, search, hash } = parsePath(
  416. path.replace(/\/(?=[A-Za-z]:)/, "")
  417. );
  418. return {
  419. protocol: protocol.toLowerCase(),
  420. auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
  421. host,
  422. pathname,
  423. search,
  424. hash,
  425. [protocolRelative]: !protocol
  426. };
  427. }
  428. function parsePath(input = "") {
  429. const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
  430. return {
  431. pathname,
  432. search,
  433. hash
  434. };
  435. }
  436. function parseAuth(input = "") {
  437. const [username, password] = input.split(":");
  438. return {
  439. username: decode(username),
  440. password: decode(password)
  441. };
  442. }
  443. function parseHost(input = "") {
  444. const [hostname, port] = (input.match(/([^/:]*):?(\d+)?/) || []).splice(1);
  445. return {
  446. hostname: decode(hostname),
  447. port
  448. };
  449. }
  450. function stringifyParsedURL(parsed) {
  451. const pathname = parsed.pathname || "";
  452. const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
  453. const hash = parsed.hash || "";
  454. const auth = parsed.auth ? parsed.auth + "@" : "";
  455. const host = parsed.host || "";
  456. const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
  457. return proto + auth + host + pathname + search + hash;
  458. }
  459. const FILENAME_STRICT_REGEX = /\/([^/]+\.[^/]+)$/;
  460. const FILENAME_REGEX = /\/([^/]+)$/;
  461. function parseFilename(input = "", { strict }) {
  462. const { pathname } = parseURL(input);
  463. const matches = strict ? pathname.match(FILENAME_STRICT_REGEX) : pathname.match(FILENAME_REGEX);
  464. return matches ? matches[1] : void 0;
  465. }
  466. var __defProp = Object.defineProperty;
  467. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  468. var __publicField = (obj, key, value) => {
  469. __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  470. return value;
  471. };
  472. class $URL {
  473. constructor(input = "") {
  474. __publicField(this, "protocol");
  475. __publicField(this, "host");
  476. __publicField(this, "auth");
  477. __publicField(this, "pathname");
  478. __publicField(this, "query", {});
  479. __publicField(this, "hash");
  480. if (typeof input !== "string") {
  481. throw new TypeError(
  482. `URL input should be string received ${typeof input} (${input})`
  483. );
  484. }
  485. const parsed = parseURL(input);
  486. this.protocol = decode(parsed.protocol);
  487. this.host = decode(parsed.host);
  488. this.auth = decode(parsed.auth);
  489. this.pathname = decodePath(parsed.pathname);
  490. this.query = parseQuery(parsed.search);
  491. this.hash = decode(parsed.hash);
  492. }
  493. get hostname() {
  494. return parseHost(this.host).hostname;
  495. }
  496. get port() {
  497. return parseHost(this.host).port || "";
  498. }
  499. get username() {
  500. return parseAuth(this.auth).username;
  501. }
  502. get password() {
  503. return parseAuth(this.auth).password || "";
  504. }
  505. get hasProtocol() {
  506. return this.protocol.length;
  507. }
  508. get isAbsolute() {
  509. return this.hasProtocol || this.pathname[0] === "/";
  510. }
  511. get search() {
  512. const q = stringifyQuery(this.query);
  513. return q.length > 0 ? "?" + q : "";
  514. }
  515. get searchParams() {
  516. const p = new URLSearchParams();
  517. for (const name in this.query) {
  518. const value = this.query[name];
  519. if (Array.isArray(value)) {
  520. for (const v of value) {
  521. p.append(name, v);
  522. }
  523. } else {
  524. p.append(
  525. name,
  526. typeof value === "string" ? value : JSON.stringify(value)
  527. );
  528. }
  529. }
  530. return p;
  531. }
  532. get origin() {
  533. return (this.protocol ? this.protocol + "//" : "") + encodeHost(this.host);
  534. }
  535. get fullpath() {
  536. return encodePath(this.pathname) + this.search + encodeHash(this.hash);
  537. }
  538. get encodedAuth() {
  539. if (!this.auth) {
  540. return "";
  541. }
  542. const { username, password } = parseAuth(this.auth);
  543. return encodeURIComponent(username) + (password ? ":" + encodeURIComponent(password) : "");
  544. }
  545. get href() {
  546. const auth = this.encodedAuth;
  547. const originWithAuth = (this.protocol ? this.protocol + "//" : "") + (auth ? auth + "@" : "") + encodeHost(this.host);
  548. return this.hasProtocol && this.isAbsolute ? originWithAuth + this.fullpath : this.fullpath;
  549. }
  550. append(url) {
  551. if (url.hasProtocol) {
  552. throw new Error("Cannot append a URL with protocol");
  553. }
  554. Object.assign(this.query, url.query);
  555. if (url.pathname) {
  556. this.pathname = withTrailingSlash(this.pathname) + withoutLeadingSlash(url.pathname);
  557. }
  558. if (url.hash) {
  559. this.hash = url.hash;
  560. }
  561. }
  562. toJSON() {
  563. return this.href;
  564. }
  565. toString() {
  566. return this.href;
  567. }
  568. }
  569. function createURL(input) {
  570. return new $URL(input);
  571. }
  572. exports.$URL = $URL;
  573. exports.cleanDoubleSlashes = cleanDoubleSlashes;
  574. exports.createURL = createURL;
  575. exports.decode = decode;
  576. exports.decodePath = decodePath;
  577. exports.decodeQueryKey = decodeQueryKey;
  578. exports.decodeQueryValue = decodeQueryValue;
  579. exports.encode = encode;
  580. exports.encodeHash = encodeHash;
  581. exports.encodeHost = encodeHost;
  582. exports.encodeParam = encodeParam;
  583. exports.encodePath = encodePath;
  584. exports.encodeQueryItem = encodeQueryItem;
  585. exports.encodeQueryKey = encodeQueryKey;
  586. exports.encodeQueryValue = encodeQueryValue;
  587. exports.getQuery = getQuery;
  588. exports.hasLeadingSlash = hasLeadingSlash;
  589. exports.hasProtocol = hasProtocol;
  590. exports.hasTrailingSlash = hasTrailingSlash;
  591. exports.isEmptyURL = isEmptyURL;
  592. exports.isEqual = isEqual;
  593. exports.isNonEmptyURL = isNonEmptyURL;
  594. exports.isRelative = isRelative;
  595. exports.isSamePath = isSamePath;
  596. exports.isScriptProtocol = isScriptProtocol;
  597. exports.joinURL = joinURL;
  598. exports.normalizeURL = normalizeURL;
  599. exports.parseAuth = parseAuth;
  600. exports.parseFilename = parseFilename;
  601. exports.parseHost = parseHost;
  602. exports.parsePath = parsePath;
  603. exports.parseQuery = parseQuery;
  604. exports.parseURL = parseURL;
  605. exports.resolveURL = resolveURL;
  606. exports.stringifyParsedURL = stringifyParsedURL;
  607. exports.stringifyQuery = stringifyQuery;
  608. exports.withBase = withBase;
  609. exports.withFragment = withFragment;
  610. exports.withHttp = withHttp;
  611. exports.withHttps = withHttps;
  612. exports.withLeadingSlash = withLeadingSlash;
  613. exports.withProtocol = withProtocol;
  614. exports.withQuery = withQuery;
  615. exports.withTrailingSlash = withTrailingSlash;
  616. exports.withoutBase = withoutBase;
  617. exports.withoutFragment = withoutFragment;
  618. exports.withoutLeadingSlash = withoutLeadingSlash;
  619. exports.withoutProtocol = withoutProtocol;
  620. exports.withoutTrailingSlash = withoutTrailingSlash;