'use strict';

var index = require('../../../../../vscode-uri@3.0.8/node_modules/vscode-uri/lib/esm/index.js');

/******************************************************************************
 * Copyright 2022 TypeFox GmbH
 * This program and the accompanying materials are made available under the
 * terms of the MIT License, which is available in the project root.
 ******************************************************************************/
exports.UriUtils = void 0;
(function (UriUtils) {
    UriUtils.basename = index.Utils.basename;
    UriUtils.dirname = index.Utils.dirname;
    UriUtils.extname = index.Utils.extname;
    UriUtils.joinPath = index.Utils.joinPath;
    UriUtils.resolvePath = index.Utils.resolvePath;
    function equals(a, b) {
        return (a === null || a === void 0 ? void 0 : a.toString()) === (b === null || b === void 0 ? void 0 : b.toString());
    }
    UriUtils.equals = equals;
    function relative(from, to) {
        const fromPath = typeof from === 'string' ? from : from.path;
        const toPath = typeof to === 'string' ? to : to.path;
        const fromParts = fromPath.split('/').filter(e => e.length > 0);
        const toParts = toPath.split('/').filter(e => e.length > 0);
        let i = 0;
        for (; i < fromParts.length; i++) {
            if (fromParts[i] !== toParts[i]) {
                break;
            }
        }
        const backPart = '../'.repeat(fromParts.length - i);
        const toPart = toParts.slice(i).join('/');
        return backPart + toPart;
    }
    UriUtils.relative = relative;
    function normalize(uri) {
        return index.URI.parse(uri.toString()).toString();
    }
    UriUtils.normalize = normalize;
})(exports.UriUtils || (exports.UriUtils = {}));

exports.URI = index.URI;
