"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUserLayerPromptPath = toUserLayerPromptPath;
exports.resolvePromptSourceAbsolutePath = resolvePromptSourceAbsolutePath;
const node_path_1 = __importDefault(require("node:path"));
const path_resolution_1 = require("../../../lib/prompts/path-resolution");
const default_assets_1 = require("../../../lib/workspace-init/default-assets");
function toUserLayerPromptPath(requestedPromptPath, config) {
    const promptSuffix = (0, path_resolution_1.resolvePromptSuffix)(requestedPromptPath, config);
    return node_path_1.default.posix.join(config.prompt_user_root, promptSuffix);
}
function resolvePromptSourceAbsolutePath(options) {
    if (options.source === "workspace") {
        return (0, path_resolution_1.resolveWorkspacePromptAbsolutePath)({
            repositoryRoot: options.repositoryRoot,
            promptPath: options.resolvedPromptPath,
            config: options.config
        });
    }
    const packageRoot = (0, default_assets_1.resolvePackageRootFromWorkspaceInitModuleDirectory)(node_path_1.default.resolve(__dirname, "../../../lib/workspace-init"));
    return (0, path_resolution_1.resolveWorkspacePromptAbsolutePath)({
        repositoryRoot: packageRoot,
        promptPath: options.resolvedPromptPath,
        config: options.config
    });
}
