"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { formatUrl: () => formatUrl }); module.exports = __toCommonJS(src_exports); var import_querystring_builder = require("@smithy/querystring-builder"); function formatUrl(request) { const { port, query } = request; let { protocol, path, hostname } = request; if (protocol && protocol.slice(-1) !== ":") { protocol += ":"; } if (port) { hostname += `:${port}`; } if (path && path.charAt(0) !== "/") { path = `/${path}`; } let queryString = query ? (0, import_querystring_builder.buildQueryString)(query) : ""; if (queryString && queryString[0] !== "?") { queryString = `?${queryString}`; } let auth = ""; if (request.username != null || request.password != null) { const username = request.username ?? ""; const password = request.password ?? ""; auth = `${username}:${password}@`; } let fragment = ""; if (request.fragment) { fragment = `#${request.fragment}`; } return `${protocol}//${auth}${hostname}${path}${queryString}${fragment}`; } __name(formatUrl, "formatUrl"); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { formatUrl });