(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "./parser/cssParser", "./services/cssCompletion", "./services/cssHover", "./services/cssNavigation", "./services/cssCodeActions", "./services/cssValidation", "./parser/scssParser", "./services/scssCompletion", "./parser/lessParser", "./services/lessCompletion", "./services/cssFolding", "./languageFacts/facts", "./services/cssSelectionRange", "./services/scssNavigation", "./cssLanguageTypes", "vscode-languageserver-textdocument", "vscode-languageserver-types"], factory);
    }
})(function (require, exports) {
    /*---------------------------------------------------------------------------------------------
     *  Copyright (c) Microsoft Corporation. All rights reserved.
     *  Licensed under the MIT License. See License.txt in the project root for license information.
     *--------------------------------------------------------------------------------------------*/
    'use strict';
    function __export(m) {
        for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
    }
    Object.defineProperty(exports, "__esModule", { value: true });
    var cssParser_1 = require("./parser/cssParser");
    var cssCompletion_1 = require("./services/cssCompletion");
    var cssHover_1 = require("./services/cssHover");
    var cssNavigation_1 = require("./services/cssNavigation");
    var cssCodeActions_1 = require("./services/cssCodeActions");
    var cssValidation_1 = require("./services/cssValidation");
    var scssParser_1 = require("./parser/scssParser");
    var scssCompletion_1 = require("./services/scssCompletion");
    var lessParser_1 = require("./parser/lessParser");
    var lessCompletion_1 = require("./services/lessCompletion");
    var cssFolding_1 = require("./services/cssFolding");
    var facts_1 = require("./languageFacts/facts");
    var cssSelectionRange_1 = require("./services/cssSelectionRange");
    var scssNavigation_1 = require("./services/scssNavigation");
    __export(require("./cssLanguageTypes"));
    var vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
    exports.TextDocument = vscode_languageserver_textdocument_1.TextDocument;
    __export(require("vscode-languageserver-types"));
    function createFacade(parser, completion, hover, navigation, codeActions, validation) {
        return {
            configure: function (settings) {
                validation.configure(settings);
                completion.configure(settings);
            },
            doValidation: validation.doValidation.bind(validation),
            parseStylesheet: parser.parseStylesheet.bind(parser),
            doComplete: completion.doComplete.bind(completion),
            setCompletionParticipants: completion.setCompletionParticipants.bind(completion),
            doHover: hover.doHover.bind(hover),
            findDefinition: navigation.findDefinition.bind(navigation),
            findReferences: navigation.findReferences.bind(navigation),
            findDocumentHighlights: navigation.findDocumentHighlights.bind(navigation),
            findDocumentLinks: navigation.findDocumentLinks.bind(navigation),
            findDocumentLinks2: navigation.findDocumentLinks2.bind(navigation),
            findDocumentSymbols: navigation.findDocumentSymbols.bind(navigation),
            doCodeActions: codeActions.doCodeActions.bind(codeActions),
            doCodeActions2: codeActions.doCodeActions2.bind(codeActions),
            findColorSymbols: function (d, s) { return navigation.findDocumentColors(d, s).map(function (s) { return s.range; }); },
            findDocumentColors: navigation.findDocumentColors.bind(navigation),
            getColorPresentations: navigation.getColorPresentations.bind(navigation),
            doRename: navigation.doRename.bind(navigation),
            getFoldingRanges: cssFolding_1.getFoldingRanges,
            getSelectionRanges: cssSelectionRange_1.getSelectionRanges
        };
    }
    function handleCustomData(options) {
        if (options && options.customDataProviders) {
            facts_1.cssDataManager.addDataProviders(options.customDataProviders);
        }
    }
    function getCSSLanguageService(options) {
        handleCustomData(options);
        return createFacade(new cssParser_1.Parser(), new cssCompletion_1.CSSCompletion(null, options && options.clientCapabilities), new cssHover_1.CSSHover(options && options.clientCapabilities), new cssNavigation_1.CSSNavigation(), new cssCodeActions_1.CSSCodeActions(), new cssValidation_1.CSSValidation());
    }
    exports.getCSSLanguageService = getCSSLanguageService;
    function getSCSSLanguageService(options) {
        handleCustomData(options);
        return createFacade(new scssParser_1.SCSSParser(), new scssCompletion_1.SCSSCompletion(options && options.clientCapabilities), new cssHover_1.CSSHover(options && options.clientCapabilities), new scssNavigation_1.SCSSNavigation(options && options.fileSystemProvider), new cssCodeActions_1.CSSCodeActions(), new cssValidation_1.CSSValidation());
    }
    exports.getSCSSLanguageService = getSCSSLanguageService;
    function getLESSLanguageService(options) {
        handleCustomData(options);
        return createFacade(new lessParser_1.LESSParser(), new lessCompletion_1.LESSCompletion(options && options.clientCapabilities), new cssHover_1.CSSHover(options && options.clientCapabilities), new cssNavigation_1.CSSNavigation(), new cssCodeActions_1.CSSCodeActions(), new cssValidation_1.CSSValidation());
    }
    exports.getLESSLanguageService = getLESSLanguageService;
});
