"use strict";
// Get public path info for public path defined by url proxy which is assumed
// to already exist in the database.
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const get_public_path_info_github_1 = __importDefault(require("./get-public-path-info-github"));
const get_public_path_info_gist_1 = __importDefault(require("./get-public-path-info-gist"));
const path_1 = require("path");
// disabled -- see comment below
// import getPublicPathInfoUrl from "./get-public-path-info-url";
async function getProxiedPublicPathInfo(url, segments) {
    if (url.startsWith("github/")) {
        return await (0, get_public_path_info_github_1.default)(segments == null ? url : (0, path_1.join)(url, ...segments.slice(1)));
    }
    if (url.startsWith("gist/")) {
        return await (0, get_public_path_info_gist_1.default)(url);
    }
    // This is disabled now since it is easy for spammers to take advantage of this,
    // and also when people paste general URL's in they are almost never the actual
    // raw url of a notebook, but instead a general HTML page that has something like
    // a notebook in it, and they just get confused.
    //   if (url.startsWith("url/")) {
    //     return await getPublicPathInfoUrl(url);
    //   }
    throw Error(`unsupported proxy url schema -- "${url}" -- url must be hosted on GitHub`);
}
exports.default = getProxiedPublicPathInfo;
//# sourceMappingURL=get-proxied-public-path-info.js.map