import { Event } from '../../../../base/common/event.js';
import { toDisposable } from '../../../../base/common/lifecycle.js';
import { BugIndicatingError } from '../../../../base/common/errors.js';
class ConstResolvedMultiDiffSource {
    constructor(resources) {
        this.resources = resources;
        this.onDidChange = Event.None;
    }
}
class MultiDiffEditorItem {
    constructor(original, modified) {
        this.original = original;
        this.modified = modified;
        if (!original && !modified) {
            throw ( new BugIndicatingError('Invalid arguments'));
        }
    }
}
class MultiDiffSourceResolverService {
    constructor() {
        this._resolvers = ( new Set());
    }
    registerResolver(resolver) {
        if (( this._resolvers.has(resolver))) {
            throw ( new BugIndicatingError('Duplicate resolver'));
        }
        this._resolvers.add(resolver);
        return toDisposable(() => this._resolvers.delete(resolver));
    }
    resolve(uri) {
        for (const resolver of this._resolvers) {
            if (resolver.canHandleUri(uri)) {
                return resolver.resolveDiffSource(uri);
            }
        }
        return Promise.resolve(undefined);
    }
}
export { ConstResolvedMultiDiffSource, MultiDiffEditorItem, MultiDiffSourceResolverService };
