1export function normalizeHostedServer(value: string): string {
2 const url = new URL(value);
3 if (
4 url.protocol !== "https:" ||
5 url.username ||
6 url.password ||
7 url.search ||
8 url.hash ||
9 url.pathname !== "/"
10 ) {
11 throw new Error("Enter an HTTPS server address without a path.");
12 }
13 return url.origin;
14}