"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractURLFromManifest = void 0;
const extractDappURLFromManifest_1 = require("./extractDappURLFromManifest");
/** Returns dapp dappURL or live app URL from manifest. */
function extractURLFromManifest(manifest) {
    if (!manifest) {
        return undefined;
    }
    const dappUrl = (0, extractDappURLFromManifest_1.extractDappURLFromManifest)(manifest);
    if (dappUrl) {
        return dappUrl;
    }
    try {
        if (manifest.url && manifest.url instanceof URL) {
            return manifest.url;
        }
        const url = new URL(manifest.url);
        return url;
    }
    catch {
        // Invalid URL
        return undefined;
    }
}
exports.extractURLFromManifest = extractURLFromManifest;
//# sourceMappingURL=extractURLFromManifest.js.map