"use strict";
/*
The raw URL is the following, of course encoded as a URL:

.../raw/{share id}/{the full path in the project to file}
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.encodePath = void 0;
const path_1 = require("path");
const base_path_1 = __importDefault(require("lib/base-path"));
function rawURL({ id, path, relativePath }) {
    return (0, path_1.join)(base_path_1.default, `share/raw/${id}/${encodePath((0, path_1.join)(path, relativePath))}`);
}
exports.default = rawURL;
function encodePath(path) {
    const segments = path.split("/");
    const encoded = [];
    for (const segment of segments) {
        encoded.push(encodeURIComponent(segment));
    }
    return encoded.join("/");
}
exports.encodePath = encodePath;
//# sourceMappingURL=raw-url.js.map