"use strict";
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUniquePath = toUniquePath;
exports.countTokensForLines = countTokensForLines;
const network_1 = require("../../../util/vs/base/common/network");
function toUniquePath(documentId, workspaceRootPath) {
    const filePath = documentId.path;
    // remove prefix from path if defined
    const workspaceRootPathWithSlash = workspaceRootPath === undefined ? undefined : (workspaceRootPath.endsWith('/') ? workspaceRootPath : workspaceRootPath + '/');
    const updatedFilePath = workspaceRootPathWithSlash !== undefined && filePath.startsWith(workspaceRootPathWithSlash)
        ? filePath.substring(workspaceRootPathWithSlash.length)
        : filePath;
    return documentId.toUri().scheme === network_1.Schemas.vscodeNotebookCell ? `${updatedFilePath}#${documentId.fragment}` : updatedFilePath;
}
function countTokensForLines(page, computeTokens) {
    return page.reduce((sum, line) => sum + computeTokens(line) + 1 /* \n */, 0);
}
//# sourceMappingURL=promptCraftingUtils.js.map