/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.52.0(f6dc0eb8fce67e57f6036f4769d92c1666cdf546) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt *-----------------------------------------------------------------------------*/ define("vs/language/css/cssWorker", ["require"],(require)=>{ "use strict"; var moduleExports = (() => { var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/language/css/cssWorker.ts var cssWorker_exports = {}; __export(cssWorker_exports, { CSSWorker: () => CSSWorker, create: () => create }); // node_modules/vscode-css-languageservice/lib/esm/parser/cssScanner.js var TokenType; (function(TokenType2) { TokenType2[TokenType2["Ident"] = 0] = "Ident"; TokenType2[TokenType2["AtKeyword"] = 1] = "AtKeyword"; TokenType2[TokenType2["String"] = 2] = "String"; TokenType2[TokenType2["BadString"] = 3] = "BadString"; TokenType2[TokenType2["UnquotedString"] = 4] = "UnquotedString"; TokenType2[TokenType2["Hash"] = 5] = "Hash"; TokenType2[TokenType2["Num"] = 6] = "Num"; TokenType2[TokenType2["Percentage"] = 7] = "Percentage"; TokenType2[TokenType2["Dimension"] = 8] = "Dimension"; TokenType2[TokenType2["UnicodeRange"] = 9] = "UnicodeRange"; TokenType2[TokenType2["CDO"] = 10] = "CDO"; TokenType2[TokenType2["CDC"] = 11] = "CDC"; TokenType2[TokenType2["Colon"] = 12] = "Colon"; TokenType2[TokenType2["SemiColon"] = 13] = "SemiColon"; TokenType2[TokenType2["CurlyL"] = 14] = "CurlyL"; TokenType2[TokenType2["CurlyR"] = 15] = "CurlyR"; TokenType2[TokenType2["ParenthesisL"] = 16] = "ParenthesisL"; TokenType2[TokenType2["ParenthesisR"] = 17] = "ParenthesisR"; TokenType2[TokenType2["BracketL"] = 18] = "BracketL"; TokenType2[TokenType2["BracketR"] = 19] = "BracketR"; TokenType2[TokenType2["Whitespace"] = 20] = "Whitespace"; TokenType2[TokenType2["Includes"] = 21] = "Includes"; TokenType2[TokenType2["Dashmatch"] = 22] = "Dashmatch"; TokenType2[TokenType2["SubstringOperator"] = 23] = "SubstringOperator"; TokenType2[TokenType2["PrefixOperator"] = 24] = "PrefixOperator"; TokenType2[TokenType2["SuffixOperator"] = 25] = "SuffixOperator"; TokenType2[TokenType2["Delim"] = 26] = "Delim"; TokenType2[TokenType2["EMS"] = 27] = "EMS"; TokenType2[TokenType2["EXS"] = 28] = "EXS"; TokenType2[TokenType2["Length"] = 29] = "Length"; TokenType2[TokenType2["Angle"] = 30] = "Angle"; TokenType2[TokenType2["Time"] = 31] = "Time"; TokenType2[TokenType2["Freq"] = 32] = "Freq"; TokenType2[TokenType2["Exclamation"] = 33] = "Exclamation"; TokenType2[TokenType2["Resolution"] = 34] = "Resolution"; TokenType2[TokenType2["Comma"] = 35] = "Comma"; TokenType2[TokenType2["Charset"] = 36] = "Charset"; TokenType2[TokenType2["EscapedJavaScript"] = 37] = "EscapedJavaScript"; TokenType2[TokenType2["BadEscapedJavaScript"] = 38] = "BadEscapedJavaScript"; TokenType2[TokenType2["Comment"] = 39] = "Comment"; TokenType2[TokenType2["SingleLineComment"] = 40] = "SingleLineComment"; TokenType2[TokenType2["EOF"] = 41] = "EOF"; TokenType2[TokenType2["ContainerQueryLength"] = 42] = "ContainerQueryLength"; TokenType2[TokenType2["CustomToken"] = 43] = "CustomToken"; })(TokenType || (TokenType = {})); var MultiLineStream = class { constructor(source) { this.source = source; this.len = source.length; this.position = 0; } substring(from, to = this.position) { return this.source.substring(from, to); } eos() { return this.len <= this.position; } pos() { return this.position; } goBackTo(pos) { this.position = pos; } goBack(n) { this.position -= n; } advance(n) { this.position += n; } nextChar() { return this.source.charCodeAt(this.position++) || 0; } peekChar(n = 0) { return this.source.charCodeAt(this.position + n) || 0; } lookbackChar(n = 0) { return this.source.charCodeAt(this.position - n) || 0; } advanceIfChar(ch) { if (ch === this.source.charCodeAt(this.position)) { this.position++; return true; } return false; } advanceIfChars(ch) { if (this.position + ch.length > this.source.length) { return false; } let i = 0; for (; i < ch.length; i++) { if (this.source.charCodeAt(this.position + i) !== ch[i]) { return false; } } this.advance(i); return true; } advanceWhileChar(condition) { const posNow = this.position; while (this.position < this.len && condition(this.source.charCodeAt(this.position))) { this.position++; } return this.position - posNow; } }; var _a = "a".charCodeAt(0); var _f = "f".charCodeAt(0); var _z = "z".charCodeAt(0); var _u = "u".charCodeAt(0); var _A = "A".charCodeAt(0); var _F = "F".charCodeAt(0); var _Z = "Z".charCodeAt(0); var _0 = "0".charCodeAt(0); var _9 = "9".charCodeAt(0); var _TLD = "~".charCodeAt(0); var _HAT = "^".charCodeAt(0); var _EQS = "=".charCodeAt(0); var _PIP = "|".charCodeAt(0); var _MIN = "-".charCodeAt(0); var _USC = "_".charCodeAt(0); var _PRC = "%".charCodeAt(0); var _MUL = "*".charCodeAt(0); var _LPA = "(".charCodeAt(0); var _RPA = ")".charCodeAt(0); var _LAN = "<".charCodeAt(0); var _RAN = ">".charCodeAt(0); var _ATS = "@".charCodeAt(0); var _HSH = "#".charCodeAt(0); var _DLR = "$".charCodeAt(0); var _BSL = "\\".charCodeAt(0); var _FSL = "/".charCodeAt(0); var _NWL = "\n".charCodeAt(0); var _CAR = "\r".charCodeAt(0); var _LFD = "\f".charCodeAt(0); var _DQO = '"'.charCodeAt(0); var _SQO = "'".charCodeAt(0); var _WSP = " ".charCodeAt(0); var _TAB = " ".charCodeAt(0); var _SEM = ";".charCodeAt(0); var _COL = ":".charCodeAt(0); var _CUL = "{".charCodeAt(0); var _CUR = "}".charCodeAt(0); var _BRL = "[".charCodeAt(0); var _BRR = "]".charCodeAt(0); var _CMA = ",".charCodeAt(0); var _DOT = ".".charCodeAt(0); var _BNG = "!".charCodeAt(0); var _QSM = "?".charCodeAt(0); var _PLS = "+".charCodeAt(0); var staticTokenTable = {}; staticTokenTable[_SEM] = TokenType.SemiColon; staticTokenTable[_COL] = TokenType.Colon; staticTokenTable[_CUL] = TokenType.CurlyL; staticTokenTable[_CUR] = TokenType.CurlyR; staticTokenTable[_BRR] = TokenType.BracketR; staticTokenTable[_BRL] = TokenType.BracketL; staticTokenTable[_LPA] = TokenType.ParenthesisL; staticTokenTable[_RPA] = TokenType.ParenthesisR; staticTokenTable[_CMA] = TokenType.Comma; var staticUnitTable = {}; staticUnitTable["em"] = TokenType.EMS; staticUnitTable["ex"] = TokenType.EXS; staticUnitTable["px"] = TokenType.Length; staticUnitTable["cm"] = TokenType.Length; staticUnitTable["mm"] = TokenType.Length; staticUnitTable["in"] = TokenType.Length; staticUnitTable["pt"] = TokenType.Length; staticUnitTable["pc"] = TokenType.Length; staticUnitTable["deg"] = TokenType.Angle; staticUnitTable["rad"] = TokenType.Angle; staticUnitTable["grad"] = TokenType.Angle; staticUnitTable["ms"] = TokenType.Time; staticUnitTable["s"] = TokenType.Time; staticUnitTable["hz"] = TokenType.Freq; staticUnitTable["khz"] = TokenType.Freq; staticUnitTable["%"] = TokenType.Percentage; staticUnitTable["fr"] = TokenType.Percentage; staticUnitTable["dpi"] = TokenType.Resolution; staticUnitTable["dpcm"] = TokenType.Resolution; staticUnitTable["cqw"] = TokenType.ContainerQueryLength; staticUnitTable["cqh"] = TokenType.ContainerQueryLength; staticUnitTable["cqi"] = TokenType.ContainerQueryLength; staticUnitTable["cqb"] = TokenType.ContainerQueryLength; staticUnitTable["cqmin"] = TokenType.ContainerQueryLength; staticUnitTable["cqmax"] = TokenType.ContainerQueryLength; var Scanner = class { constructor() { this.stream = new MultiLineStream(""); this.ignoreComment = true; this.ignoreWhitespace = true; this.inURL = false; } setSource(input) { this.stream = new MultiLineStream(input); } finishToken(offset, type, text) { return { offset, len: this.stream.pos() - offset, type, text: text || this.stream.substring(offset) }; } substring(offset, len) { return this.stream.substring(offset, offset + len); } pos() { return this.stream.pos(); } goBackTo(pos) { this.stream.goBackTo(pos); } scanUnquotedString() { const offset = this.stream.pos(); const content = []; if (this._unquotedString(content)) { return this.finishToken(offset, TokenType.UnquotedString, content.join("")); } return null; } scan() { const triviaToken = this.trivia(); if (triviaToken !== null) { return triviaToken; } const offset = this.stream.pos(); if (this.stream.eos()) { return this.finishToken(offset, TokenType.EOF); } return this.scanNext(offset); } /** * Read the range as described in https://www.w3.org/TR/CSS21/syndata.html#tokenization * Assume the `u` has aleady been consumed * @returns if reading the unicode was successful */ tryScanUnicode() { const offset = this.stream.pos(); if (!this.stream.eos() && this._unicodeRange()) { return this.finishToken(offset, TokenType.UnicodeRange); } this.stream.goBackTo(offset); return void 0; } scanNext(offset) { if (this.stream.advanceIfChars([_LAN, _BNG, _MIN, _MIN])) { return this.finishToken(offset, TokenType.CDO); } if (this.stream.advanceIfChars([_MIN, _MIN, _RAN])) { return this.finishToken(offset, TokenType.CDC); } let content = []; if (this.ident(content)) { return this.finishToken(offset, TokenType.Ident, content.join("")); } if (this.stream.advanceIfChar(_ATS)) { content = ["@"]; if (this._name(content)) { const keywordText = content.join(""); if (keywordText === "@charset") { return this.finishToken(offset, TokenType.Charset, keywordText); } return this.finishToken(offset, TokenType.AtKeyword, keywordText); } else { return this.finishToken(offset, TokenType.Delim); } } if (this.stream.advanceIfChar(_HSH)) { content = ["#"]; if (this._name(content)) { return this.finishToken(offset, TokenType.Hash, content.join("")); } else { return this.finishToken(offset, TokenType.Delim); } } if (this.stream.advanceIfChar(_BNG)) { return this.finishToken(offset, TokenType.Exclamation); } if (this._number()) { const pos = this.stream.pos(); content = [this.stream.substring(offset, pos)]; if (this.stream.advanceIfChar(_PRC)) { return this.finishToken(offset, TokenType.Percentage); } else if (this.ident(content)) { const dim = this.stream.substring(pos).toLowerCase(); const tokenType2 = staticUnitTable[dim]; if (typeof tokenType2 !== "undefined") { return this.finishToken(offset, tokenType2, content.join("")); } else { return this.finishToken(offset, TokenType.Dimension, content.join("")); } } return this.finishToken(offset, TokenType.Num); } content = []; let tokenType = this._string(content); if (tokenType !== null) { return this.finishToken(offset, tokenType, content.join("")); } tokenType = staticTokenTable[this.stream.peekChar()]; if (typeof tokenType !== "undefined") { this.stream.advance(1); return this.finishToken(offset, tokenType); } if (this.stream.peekChar(0) === _TLD && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.Includes); } if (this.stream.peekChar(0) === _PIP && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.Dashmatch); } if (this.stream.peekChar(0) === _MUL && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.SubstringOperator); } if (this.stream.peekChar(0) === _HAT && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.PrefixOperator); } if (this.stream.peekChar(0) === _DLR && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.SuffixOperator); } this.stream.nextChar(); return this.finishToken(offset, TokenType.Delim); } trivia() { while (true) { const offset = this.stream.pos(); if (this._whitespace()) { if (!this.ignoreWhitespace) { return this.finishToken(offset, TokenType.Whitespace); } } else if (this.comment()) { if (!this.ignoreComment) { return this.finishToken(offset, TokenType.Comment); } } else { return null; } } } comment() { if (this.stream.advanceIfChars([_FSL, _MUL])) { let success = false, hot = false; this.stream.advanceWhileChar((ch) => { if (hot && ch === _FSL) { success = true; return false; } hot = ch === _MUL; return true; }); if (success) { this.stream.advance(1); } return true; } return false; } _number() { let npeek = 0, ch; if (this.stream.peekChar() === _DOT) { npeek = 1; } ch = this.stream.peekChar(npeek); if (ch >= _0 && ch <= _9) { this.stream.advance(npeek + 1); this.stream.advanceWhileChar((ch2) => { return ch2 >= _0 && ch2 <= _9 || npeek === 0 && ch2 === _DOT; }); return true; } return false; } _newline(result) { const ch = this.stream.peekChar(); switch (ch) { case _CAR: case _LFD: case _NWL: this.stream.advance(1); result.push(String.fromCharCode(ch)); if (ch === _CAR && this.stream.advanceIfChar(_NWL)) { result.push("\n"); } return true; } return false; } _escape(result, includeNewLines) { let ch = this.stream.peekChar(); if (ch === _BSL) { this.stream.advance(1); ch = this.stream.peekChar(); let hexNumCount = 0; while (hexNumCount < 6 && (ch >= _0 && ch <= _9 || ch >= _a && ch <= _f || ch >= _A && ch <= _F)) { this.stream.advance(1); ch = this.stream.peekChar(); hexNumCount++; } if (hexNumCount > 0) { try { const hexVal = parseInt(this.stream.substring(this.stream.pos() - hexNumCount), 16); if (hexVal) { result.push(String.fromCharCode(hexVal)); } } catch (e) { } if (ch === _WSP || ch === _TAB) { this.stream.advance(1); } else { this._newline([]); } return true; } if (ch !== _CAR && ch !== _LFD && ch !== _NWL) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } else if (includeNewLines) { return this._newline(result); } } return false; } _stringChar(closeQuote, result) { const ch = this.stream.peekChar(); if (ch !== 0 && ch !== closeQuote && ch !== _BSL && ch !== _CAR && ch !== _LFD && ch !== _NWL) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; } _string(result) { if (this.stream.peekChar() === _SQO || this.stream.peekChar() === _DQO) { const closeQuote = this.stream.nextChar(); result.push(String.fromCharCode(closeQuote)); while (this._stringChar(closeQuote, result) || this._escape(result, true)) { } if (this.stream.peekChar() === closeQuote) { this.stream.nextChar(); result.push(String.fromCharCode(closeQuote)); return TokenType.String; } else { return TokenType.BadString; } } return null; } _unquotedChar(result) { const ch = this.stream.peekChar(); if (ch !== 0 && ch !== _BSL && ch !== _SQO && ch !== _DQO && ch !== _LPA && ch !== _RPA && ch !== _WSP && ch !== _TAB && ch !== _NWL && ch !== _LFD && ch !== _CAR) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; } _unquotedString(result) { let hasContent = false; while (this._unquotedChar(result) || this._escape(result)) { hasContent = true; } return hasContent; } _whitespace() { const n = this.stream.advanceWhileChar((ch) => { return ch === _WSP || ch === _TAB || ch === _NWL || ch === _LFD || ch === _CAR; }); return n > 0; } _name(result) { let matched = false; while (this._identChar(result) || this._escape(result)) { matched = true; } return matched; } ident(result) { const pos = this.stream.pos(); const hasMinus = this._minus(result); if (hasMinus) { if (this._minus(result) || this._identFirstChar(result) || this._escape(result)) { while (this._identChar(result) || this._escape(result)) { } return true; } } else if (this._identFirstChar(result) || this._escape(result)) { while (this._identChar(result) || this._escape(result)) { } return true; } this.stream.goBackTo(pos); return false; } _identFirstChar(result) { const ch = this.stream.peekChar(); if (ch === _USC || // _ ch >= _a && ch <= _z || // a-z ch >= _A && ch <= _Z || // A-Z ch >= 128 && ch <= 65535) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; } _minus(result) { const ch = this.stream.peekChar(); if (ch === _MIN) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; } _identChar(result) { const ch = this.stream.peekChar(); if (ch === _USC || // _ ch === _MIN || // - ch >= _a && ch <= _z || // a-z ch >= _A && ch <= _Z || // A-Z ch >= _0 && ch <= _9 || // 0/9 ch >= 128 && ch <= 65535) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; } _unicodeRange() { if (this.stream.advanceIfChar(_PLS)) { const isHexDigit = (ch) => ch >= _0 && ch <= _9 || ch >= _a && ch <= _f || ch >= _A && ch <= _F; const codePoints = this.stream.advanceWhileChar(isHexDigit) + this.stream.advanceWhileChar((ch) => ch === _QSM); if (codePoints >= 1 && codePoints <= 6) { if (this.stream.advanceIfChar(_MIN)) { const digits = this.stream.advanceWhileChar(isHexDigit); if (digits >= 1 && digits <= 6) { return true; } } else { return true; } } } return false; } }; // node_modules/vscode-css-languageservice/lib/esm/utils/strings.js function startsWith(haystack, needle) { if (haystack.length < needle.length) { return false; } for (let i = 0; i < needle.length; i++) { if (haystack[i] !== needle[i]) { return false; } } return true; } function endsWith(haystack, needle) { let diff = haystack.length - needle.length; if (diff > 0) { return haystack.lastIndexOf(needle) === diff; } else if (diff === 0) { return haystack === needle; } else { return false; } } function difference(first, second, maxLenDelta = 4) { let lengthDifference = Math.abs(first.length - second.length); if (lengthDifference > maxLenDelta) { return 0; } let LCS = []; let zeroArray = []; let i, j; for (i = 0; i < second.length + 1; ++i) { zeroArray.push(0); } for (i = 0; i < first.length + 1; ++i) { LCS.push(zeroArray); } for (i = 1; i < first.length + 1; ++i) { for (j = 1; j < second.length + 1; ++j) { if (first[i - 1] === second[j - 1]) { LCS[i][j] = LCS[i - 1][j - 1] + 1; } else { LCS[i][j] = Math.max(LCS[i - 1][j], LCS[i][j - 1]); } } } return LCS[first.length][second.length] - Math.sqrt(lengthDifference); } function getLimitedString(str, ellipsis = true) { if (!str) { return ""; } if (str.length < 140) { return str; } return str.slice(0, 140) + (ellipsis ? "\u2026" : ""); } function trim(str, regexp) { const m = regexp.exec(str); if (m && m[0].length) { return str.substr(0, str.length - m[0].length); } return str; } function repeat(value, count) { let s = ""; while (count > 0) { if ((count & 1) === 1) { s += value; } value += value; count = count >>> 1; } return s; } // node_modules/vscode-css-languageservice/lib/esm/parser/cssNodes.js var NodeType; (function(NodeType2) { NodeType2[NodeType2["Undefined"] = 0] = "Undefined"; NodeType2[NodeType2["Identifier"] = 1] = "Identifier"; NodeType2[NodeType2["Stylesheet"] = 2] = "Stylesheet"; NodeType2[NodeType2["Ruleset"] = 3] = "Ruleset"; NodeType2[NodeType2["Selector"] = 4] = "Selector"; NodeType2[NodeType2["SimpleSelector"] = 5] = "SimpleSelector"; NodeType2[NodeType2["SelectorInterpolation"] = 6] = "SelectorInterpolation"; NodeType2[NodeType2["SelectorCombinator"] = 7] = "SelectorCombinator"; NodeType2[NodeType2["SelectorCombinatorParent"] = 8] = "SelectorCombinatorParent"; NodeType2[NodeType2["SelectorCombinatorSibling"] = 9] = "SelectorCombinatorSibling"; NodeType2[NodeType2["SelectorCombinatorAllSiblings"] = 10] = "SelectorCombinatorAllSiblings"; NodeType2[NodeType2["SelectorCombinatorShadowPiercingDescendant"] = 11] = "SelectorCombinatorShadowPiercingDescendant"; NodeType2[NodeType2["Page"] = 12] = "Page"; NodeType2[NodeType2["PageBoxMarginBox"] = 13] = "PageBoxMarginBox"; NodeType2[NodeType2["ClassSelector"] = 14] = "ClassSelector"; NodeType2[NodeType2["IdentifierSelector"] = 15] = "IdentifierSelector"; NodeType2[NodeType2["ElementNameSelector"] = 16] = "ElementNameSelector"; NodeType2[NodeType2["PseudoSelector"] = 17] = "PseudoSelector"; NodeType2[NodeType2["AttributeSelector"] = 18] = "AttributeSelector"; NodeType2[NodeType2["Declaration"] = 19] = "Declaration"; NodeType2[NodeType2["Declarations"] = 20] = "Declarations"; NodeType2[NodeType2["Property"] = 21] = "Property"; NodeType2[NodeType2["Expression"] = 22] = "Expression"; NodeType2[NodeType2["BinaryExpression"] = 23] = "BinaryExpression"; NodeType2[NodeType2["Term"] = 24] = "Term"; NodeType2[NodeType2["Operator"] = 25] = "Operator"; NodeType2[NodeType2["Value"] = 26] = "Value"; NodeType2[NodeType2["StringLiteral"] = 27] = "StringLiteral"; NodeType2[NodeType2["URILiteral"] = 28] = "URILiteral"; NodeType2[NodeType2["EscapedValue"] = 29] = "EscapedValue"; NodeType2[NodeType2["Function"] = 30] = "Function"; NodeType2[NodeType2["NumericValue"] = 31] = "NumericValue"; NodeType2[NodeType2["HexColorValue"] = 32] = "HexColorValue"; NodeType2[NodeType2["RatioValue"] = 33] = "RatioValue"; NodeType2[NodeType2["MixinDeclaration"] = 34] = "MixinDeclaration"; NodeType2[NodeType2["MixinReference"] = 35] = "MixinReference"; NodeType2[NodeType2["VariableName"] = 36] = "VariableName"; NodeType2[NodeType2["VariableDeclaration"] = 37] = "VariableDeclaration"; NodeType2[NodeType2["Prio"] = 38] = "Prio"; NodeType2[NodeType2["Interpolation"] = 39] = "Interpolation"; NodeType2[NodeType2["NestedProperties"] = 40] = "NestedProperties"; NodeType2[NodeType2["ExtendsReference"] = 41] = "ExtendsReference"; NodeType2[NodeType2["SelectorPlaceholder"] = 42] = "SelectorPlaceholder"; NodeType2[NodeType2["Debug"] = 43] = "Debug"; NodeType2[NodeType2["If"] = 44] = "If"; NodeType2[NodeType2["Else"] = 45] = "Else"; NodeType2[NodeType2["For"] = 46] = "For"; NodeType2[NodeType2["Each"] = 47] = "Each"; NodeType2[NodeType2["While"] = 48] = "While"; NodeType2[NodeType2["MixinContentReference"] = 49] = "MixinContentReference"; NodeType2[NodeType2["MixinContentDeclaration"] = 50] = "MixinContentDeclaration"; NodeType2[NodeType2["Media"] = 51] = "Media"; NodeType2[NodeType2["Keyframe"] = 52] = "Keyframe"; NodeType2[NodeType2["FontFace"] = 53] = "FontFace"; NodeType2[NodeType2["Import"] = 54] = "Import"; NodeType2[NodeType2["Namespace"] = 55] = "Namespace"; NodeType2[NodeType2["Invocation"] = 56] = "Invocation"; NodeType2[NodeType2["FunctionDeclaration"] = 57] = "FunctionDeclaration"; NodeType2[NodeType2["ReturnStatement"] = 58] = "ReturnStatement"; NodeType2[NodeType2["MediaQuery"] = 59] = "MediaQuery"; NodeType2[NodeType2["MediaCondition"] = 60] = "MediaCondition"; NodeType2[NodeType2["MediaFeature"] = 61] = "MediaFeature"; NodeType2[NodeType2["FunctionParameter"] = 62] = "FunctionParameter"; NodeType2[NodeType2["FunctionArgument"] = 63] = "FunctionArgument"; NodeType2[NodeType2["KeyframeSelector"] = 64] = "KeyframeSelector"; NodeType2[NodeType2["ViewPort"] = 65] = "ViewPort"; NodeType2[NodeType2["Document"] = 66] = "Document"; NodeType2[NodeType2["AtApplyRule"] = 67] = "AtApplyRule"; NodeType2[NodeType2["CustomPropertyDeclaration"] = 68] = "CustomPropertyDeclaration"; NodeType2[NodeType2["CustomPropertySet"] = 69] = "CustomPropertySet"; NodeType2[NodeType2["ListEntry"] = 70] = "ListEntry"; NodeType2[NodeType2["Supports"] = 71] = "Supports"; NodeType2[NodeType2["SupportsCondition"] = 72] = "SupportsCondition"; NodeType2[NodeType2["NamespacePrefix"] = 73] = "NamespacePrefix"; NodeType2[NodeType2["GridLine"] = 74] = "GridLine"; NodeType2[NodeType2["Plugin"] = 75] = "Plugin"; NodeType2[NodeType2["UnknownAtRule"] = 76] = "UnknownAtRule"; NodeType2[NodeType2["Use"] = 77] = "Use"; NodeType2[NodeType2["ModuleConfiguration"] = 78] = "ModuleConfiguration"; NodeType2[NodeType2["Forward"] = 79] = "Forward"; NodeType2[NodeType2["ForwardVisibility"] = 80] = "ForwardVisibility"; NodeType2[NodeType2["Module"] = 81] = "Module"; NodeType2[NodeType2["UnicodeRange"] = 82] = "UnicodeRange"; NodeType2[NodeType2["Layer"] = 83] = "Layer"; NodeType2[NodeType2["LayerNameList"] = 84] = "LayerNameList"; NodeType2[NodeType2["LayerName"] = 85] = "LayerName"; NodeType2[NodeType2["PropertyAtRule"] = 86] = "PropertyAtRule"; NodeType2[NodeType2["Container"] = 87] = "Container"; })(NodeType || (NodeType = {})); var ReferenceType; (function(ReferenceType2) { ReferenceType2[ReferenceType2["Mixin"] = 0] = "Mixin"; ReferenceType2[ReferenceType2["Rule"] = 1] = "Rule"; ReferenceType2[ReferenceType2["Variable"] = 2] = "Variable"; ReferenceType2[ReferenceType2["Function"] = 3] = "Function"; ReferenceType2[ReferenceType2["Keyframe"] = 4] = "Keyframe"; ReferenceType2[ReferenceType2["Unknown"] = 5] = "Unknown"; ReferenceType2[ReferenceType2["Module"] = 6] = "Module"; ReferenceType2[ReferenceType2["Forward"] = 7] = "Forward"; ReferenceType2[ReferenceType2["ForwardVisibility"] = 8] = "ForwardVisibility"; ReferenceType2[ReferenceType2["Property"] = 9] = "Property"; })(ReferenceType || (ReferenceType = {})); function getNodeAtOffset(node, offset) { let candidate = null; if (!node || offset < node.offset || offset > node.end) { return null; } node.accept((node2) => { if (node2.offset === -1 && node2.length === -1) { return true; } if (node2.offset <= offset && node2.end >= offset) { if (!candidate) { candidate = node2; } else if (node2.length <= candidate.length) { candidate = node2; } return true; } return false; }); return candidate; } function getNodePath(node, offset) { let candidate = getNodeAtOffset(node, offset); const path = []; while (candidate) { path.unshift(candidate); candidate = candidate.parent; } return path; } function getParentDeclaration(node) { const decl = node.findParent(NodeType.Declaration); const value = decl && decl.getValue(); if (value && value.encloses(node)) { return decl; } return null; } var Node = class { get end() { return this.offset + this.length; } constructor(offset = -1, len = -1, nodeType) { this.parent = null; this.offset = offset; this.length = len; if (nodeType) { this.nodeType = nodeType; } } set type(type) { this.nodeType = type; } get type() { return this.nodeType || NodeType.Undefined; } getTextProvider() { let node = this; while (node && !node.textProvider) { node = node.parent; } if (node) { return node.textProvider; } return () => { return "unknown"; }; } getText() { return this.getTextProvider()(this.offset, this.length); } matches(str) { return this.length === str.length && this.getTextProvider()(this.offset, this.length) === str; } startsWith(str) { return this.length >= str.length && this.getTextProvider()(this.offset, str.length) === str; } endsWith(str) { return this.length >= str.length && this.getTextProvider()(this.end - str.length, str.length) === str; } accept(visitor) { if (visitor(this) && this.children) { for (const child of this.children) { child.accept(visitor); } } } acceptVisitor(visitor) { this.accept(visitor.visitNode.bind(visitor)); } adoptChild(node, index = -1) { if (node.parent && node.parent.children) { const idx = node.parent.children.indexOf(node); if (idx >= 0) { node.parent.children.splice(idx, 1); } } node.parent = this; let children = this.children; if (!children) { children = this.children = []; } if (index !== -1) { children.splice(index, 0, node); } else { children.push(node); } return node; } attachTo(parent, index = -1) { if (parent) { parent.adoptChild(this, index); } return this; } collectIssues(results) { if (this.issues) { results.push.apply(results, this.issues); } } addIssue(issue) { if (!this.issues) { this.issues = []; } this.issues.push(issue); } hasIssue(rule) { return Array.isArray(this.issues) && this.issues.some((i) => i.getRule() === rule); } isErroneous(recursive = false) { if (this.issues && this.issues.length > 0) { return true; } return recursive && Array.isArray(this.children) && this.children.some((c) => c.isErroneous(true)); } setNode(field, node, index = -1) { if (node) { node.attachTo(this, index); this[field] = node; return true; } return false; } addChild(node) { if (node) { if (!this.children) { this.children = []; } node.attachTo(this); this.updateOffsetAndLength(node); return true; } return false; } updateOffsetAndLength(node) { if (node.offset < this.offset || this.offset === -1) { this.offset = node.offset; } const nodeEnd = node.end; if (nodeEnd > this.end || this.length === -1) { this.length = nodeEnd - this.offset; } } hasChildren() { return !!this.children && this.children.length > 0; } getChildren() { return this.children ? this.children.slice(0) : []; } getChild(index) { if (this.children && index < this.children.length) { return this.children[index]; } return null; } addChildren(nodes) { for (const node of nodes) { this.addChild(node); } } findFirstChildBeforeOffset(offset) { if (this.children) { let current = null; for (let i = this.children.length - 1; i >= 0; i--) { current = this.children[i]; if (current.offset <= offset) { return current; } } } return null; } findChildAtOffset(offset, goDeep) { const current = this.findFirstChildBeforeOffset(offset); if (current && current.end >= offset) { if (goDeep) { return current.findChildAtOffset(offset, true) || current; } return current; } return null; } encloses(candidate) { return this.offset <= candidate.offset && this.offset + this.length >= candidate.offset + candidate.length; } getParent() { let result = this.parent; while (result instanceof Nodelist) { result = result.parent; } return result; } findParent(type) { let result = this; while (result && result.type !== type) { result = result.parent; } return result; } findAParent(...types) { let result = this; while (result && !types.some((t2) => result.type === t2)) { result = result.parent; } return result; } setData(key, value) { if (!this.options) { this.options = {}; } this.options[key] = value; } getData(key) { if (!this.options || !this.options.hasOwnProperty(key)) { return null; } return this.options[key]; } }; var Nodelist = class extends Node { constructor(parent, index = -1) { super(-1, -1); this.attachTo(parent, index); this.offset = -1; this.length = -1; } }; var UnicodeRange = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.UnicodeRange; } setRangeStart(rangeStart) { return this.setNode("rangeStart", rangeStart); } getRangeStart() { return this.rangeStart; } setRangeEnd(rangeEnd) { return this.setNode("rangeEnd", rangeEnd); } getRangeEnd() { return this.rangeEnd; } }; var Identifier = class extends Node { constructor(offset, length) { super(offset, length); this.isCustomProperty = false; } get type() { return NodeType.Identifier; } containsInterpolation() { return this.hasChildren(); } }; var Stylesheet = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Stylesheet; } }; var Declarations = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Declarations; } }; var BodyDeclaration = class extends Node { constructor(offset, length) { super(offset, length); } getDeclarations() { return this.declarations; } setDeclarations(decls) { return this.setNode("declarations", decls); } }; var RuleSet = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Ruleset; } getSelectors() { if (!this.selectors) { this.selectors = new Nodelist(this); } return this.selectors; } isNested() { return !!this.parent && this.parent.findParent(NodeType.Declarations) !== null; } }; var Selector = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Selector; } }; var SimpleSelector = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.SimpleSelector; } }; var AbstractDeclaration = class extends Node { constructor(offset, length) { super(offset, length); } }; var CustomPropertySet = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.CustomPropertySet; } }; var Declaration = class _Declaration extends AbstractDeclaration { constructor(offset, length) { super(offset, length); this.property = null; } get type() { return NodeType.Declaration; } setProperty(node) { return this.setNode("property", node); } getProperty() { return this.property; } getFullPropertyName() { const propertyName = this.property ? this.property.getName() : "unknown"; if (this.parent instanceof Declarations && this.parent.getParent() instanceof NestedProperties) { const parentDecl = this.parent.getParent().getParent(); if (parentDecl instanceof _Declaration) { return parentDecl.getFullPropertyName() + propertyName; } } return propertyName; } getNonPrefixedPropertyName() { const propertyName = this.getFullPropertyName(); if (propertyName && propertyName.charAt(0) === "-") { const vendorPrefixEnd = propertyName.indexOf("-", 1); if (vendorPrefixEnd !== -1) { return propertyName.substring(vendorPrefixEnd + 1); } } return propertyName; } setValue(value) { return this.setNode("value", value); } getValue() { return this.value; } setNestedProperties(value) { return this.setNode("nestedProperties", value); } getNestedProperties() { return this.nestedProperties; } }; var CustomPropertyDeclaration = class extends Declaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.CustomPropertyDeclaration; } setPropertySet(value) { return this.setNode("propertySet", value); } getPropertySet() { return this.propertySet; } }; var Property = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Property; } setIdentifier(value) { return this.setNode("identifier", value); } getIdentifier() { return this.identifier; } getName() { return trim(this.getText(), /[_\+]+$/); } isCustomProperty() { return !!this.identifier && this.identifier.isCustomProperty; } }; var Invocation = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Invocation; } getArguments() { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; } }; var Function = class extends Invocation { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Function; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getName() { return this.identifier ? this.identifier.getText() : ""; } }; var FunctionParameter = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.FunctionParameter; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getName() { return this.identifier ? this.identifier.getText() : ""; } setDefaultValue(node) { return this.setNode("defaultValue", node, 0); } getDefaultValue() { return this.defaultValue; } }; var FunctionArgument = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.FunctionArgument; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getName() { return this.identifier ? this.identifier.getText() : ""; } setValue(node) { return this.setNode("value", node, 0); } getValue() { return this.value; } }; var IfStatement = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.If; } setExpression(node) { return this.setNode("expression", node, 0); } setElseClause(elseClause) { return this.setNode("elseClause", elseClause); } }; var ForStatement = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.For; } setVariable(node) { return this.setNode("variable", node, 0); } }; var EachStatement = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Each; } getVariables() { if (!this.variables) { this.variables = new Nodelist(this); } return this.variables; } }; var WhileStatement = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.While; } }; var ElseStatement = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Else; } }; var FunctionDeclaration = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.FunctionDeclaration; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getName() { return this.identifier ? this.identifier.getText() : ""; } getParameters() { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; } }; var ViewPort = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.ViewPort; } }; var FontFace = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.FontFace; } }; var NestedProperties = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.NestedProperties; } }; var Keyframe = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Keyframe; } setKeyword(keyword) { return this.setNode("keyword", keyword, 0); } getKeyword() { return this.keyword; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getName() { return this.identifier ? this.identifier.getText() : ""; } }; var KeyframeSelector = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.KeyframeSelector; } }; var Import = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Import; } setMedialist(node) { if (node) { node.attachTo(this); return true; } return false; } }; var Use = class extends Node { get type() { return NodeType.Use; } getParameters() { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } }; var ModuleConfiguration = class extends Node { get type() { return NodeType.ModuleConfiguration; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getName() { return this.identifier ? this.identifier.getText() : ""; } setValue(node) { return this.setNode("value", node, 0); } getValue() { return this.value; } }; var Forward = class extends Node { get type() { return NodeType.Forward; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getMembers() { if (!this.members) { this.members = new Nodelist(this); } return this.members; } getParameters() { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; } }; var ForwardVisibility = class extends Node { get type() { return NodeType.ForwardVisibility; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } }; var Namespace = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Namespace; } }; var Media = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Media; } }; var Supports = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Supports; } }; var Layer = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Layer; } setNames(names) { return this.setNode("names", names); } getNames() { return this.names; } }; var PropertyAtRule = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.PropertyAtRule; } setName(node) { if (node) { node.attachTo(this); this.name = node; return true; } return false; } getName() { return this.name; } }; var Document = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Document; } }; var Container = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Container; } }; var Medialist = class extends Node { constructor(offset, length) { super(offset, length); } }; var MediaQuery = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.MediaQuery; } }; var MediaCondition = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.MediaCondition; } }; var MediaFeature = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.MediaFeature; } }; var SupportsCondition = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.SupportsCondition; } }; var Page = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Page; } }; var PageBoxMarginBox = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.PageBoxMarginBox; } }; var Expression = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Expression; } }; var BinaryExpression = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.BinaryExpression; } setLeft(left) { return this.setNode("left", left); } getLeft() { return this.left; } setRight(right) { return this.setNode("right", right); } getRight() { return this.right; } setOperator(value) { return this.setNode("operator", value); } getOperator() { return this.operator; } }; var Term = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.Term; } setOperator(value) { return this.setNode("operator", value); } getOperator() { return this.operator; } setExpression(value) { return this.setNode("expression", value); } getExpression() { return this.expression; } }; var AttributeSelector = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.AttributeSelector; } setNamespacePrefix(value) { return this.setNode("namespacePrefix", value); } getNamespacePrefix() { return this.namespacePrefix; } setIdentifier(value) { return this.setNode("identifier", value); } getIdentifier() { return this.identifier; } setOperator(operator) { return this.setNode("operator", operator); } getOperator() { return this.operator; } setValue(value) { return this.setNode("value", value); } getValue() { return this.value; } }; var HexColorValue = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.HexColorValue; } }; var RatioValue = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.RatioValue; } }; var _dot = ".".charCodeAt(0); var _02 = "0".charCodeAt(0); var _92 = "9".charCodeAt(0); var NumericValue = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.NumericValue; } getValue() { const raw = this.getText(); let unitIdx = 0; let code; for (let i = 0, len = raw.length; i < len; i++) { code = raw.charCodeAt(i); if (!(_02 <= code && code <= _92 || code === _dot)) { break; } unitIdx += 1; } return { value: raw.substring(0, unitIdx), unit: unitIdx < raw.length ? raw.substring(unitIdx) : void 0 }; } }; var VariableDeclaration = class extends AbstractDeclaration { constructor(offset, length) { super(offset, length); this.needsSemicolon = true; } get type() { return NodeType.VariableDeclaration; } setVariable(node) { if (node) { node.attachTo(this); this.variable = node; return true; } return false; } getVariable() { return this.variable; } getName() { return this.variable ? this.variable.getName() : ""; } setValue(node) { if (node) { node.attachTo(this); this.value = node; return true; } return false; } getValue() { return this.value; } }; var Interpolation = class extends Node { // private _interpolations: void; // workaround for https://github.com/Microsoft/TypeScript/issues/18276 constructor(offset, length) { super(offset, length); } get type() { return NodeType.Interpolation; } }; var Variable = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.VariableName; } getName() { return this.getText(); } }; var ExtendsReference = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.ExtendsReference; } getSelectors() { if (!this.selectors) { this.selectors = new Nodelist(this); } return this.selectors; } }; var MixinContentReference = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.MixinContentReference; } getArguments() { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; } }; var MixinContentDeclaration = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.MixinContentDeclaration; } getParameters() { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; } }; var MixinReference = class extends Node { constructor(offset, length) { super(offset, length); } get type() { return NodeType.MixinReference; } getNamespaces() { if (!this.namespaces) { this.namespaces = new Nodelist(this); } return this.namespaces; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getName() { return this.identifier ? this.identifier.getText() : ""; } getArguments() { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; } setContent(node) { return this.setNode("content", node); } getContent() { return this.content; } }; var MixinDeclaration = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.MixinDeclaration; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } getName() { return this.identifier ? this.identifier.getText() : ""; } getParameters() { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; } setGuard(node) { if (node) { node.attachTo(this); this.guard = node; } return false; } }; var UnknownAtRule = class extends BodyDeclaration { constructor(offset, length) { super(offset, length); } get type() { return NodeType.UnknownAtRule; } setAtRuleName(atRuleName) { this.atRuleName = atRuleName; } getAtRuleName() { return this.atRuleName; } }; var ListEntry = class extends Node { get type() { return NodeType.ListEntry; } setKey(node) { return this.setNode("key", node, 0); } setValue(node) { return this.setNode("value", node, 1); } }; var LessGuard = class extends Node { getConditions() { if (!this.conditions) { this.conditions = new Nodelist(this); } return this.conditions; } }; var GuardCondition = class extends Node { setVariable(node) { return this.setNode("variable", node); } }; var Module = class extends Node { get type() { return NodeType.Module; } setIdentifier(node) { return this.setNode("identifier", node, 0); } getIdentifier() { return this.identifier; } }; var Level; (function(Level2) { Level2[Level2["Ignore"] = 1] = "Ignore"; Level2[Level2["Warning"] = 2] = "Warning"; Level2[Level2["Error"] = 4] = "Error"; })(Level || (Level = {})); var Marker = class { constructor(node, rule, level, message, offset = node.offset, length = node.length) { this.node = node; this.rule = rule; this.level = level; this.message = message || rule.message; this.offset = offset; this.length = length; } getRule() { return this.rule; } getLevel() { return this.level; } getOffset() { return this.offset; } getLength() { return this.length; } getNode() { return this.node; } getMessage() { return this.message; } }; var ParseErrorCollector = class _ParseErrorCollector { static entries(node) { const visitor = new _ParseErrorCollector(); node.acceptVisitor(visitor); return visitor.entries; } constructor() { this.entries = []; } visitNode(node) { if (node.isErroneous()) { node.collectIssues(this.entries); } return true; } }; // node_modules/@vscode/l10n/dist/browser.js var bundle; function t(...args) { const firstArg = args[0]; let key; let message; let formatArgs; if (typeof firstArg === "string") { key = firstArg; message = firstArg; args.splice(0, 1); formatArgs = !args || typeof args[0] !== "object" ? args : args[0]; } else if (firstArg instanceof Array) { const replacements = args.slice(1); if (firstArg.length !== replacements.length + 1) { throw new Error("expected a string as the first argument to l10n.t"); } let str = firstArg[0]; for (let i = 1; i < firstArg.length; i++) { str += `{${i - 1}}` + firstArg[i]; } return t(str, ...replacements); } else { message = firstArg.message; key = message; if (firstArg.comment && firstArg.comment.length > 0) { key += `/${Array.isArray(firstArg.comment) ? firstArg.comment.join("") : firstArg.comment}`; } formatArgs = firstArg.args ?? {}; } const messageFromBundle = bundle?.[key]; if (!messageFromBundle) { return format(message, formatArgs); } if (typeof messageFromBundle === "string") { return format(messageFromBundle, formatArgs); } if (messageFromBundle.comment) { return format(messageFromBundle.message, formatArgs); } return format(message, formatArgs); } var _format2Regexp = /{([^}]+)}/g; function format(template, values2) { if (Object.keys(values2).length === 0) { return template; } return template.replace(_format2Regexp, (match, group) => values2[group] ?? match); } // node_modules/vscode-css-languageservice/lib/esm/parser/cssErrors.js var CSSIssueType = class { constructor(id, message) { this.id = id; this.message = message; } }; var ParseError = { NumberExpected: new CSSIssueType("css-numberexpected", t("number expected")), ConditionExpected: new CSSIssueType("css-conditionexpected", t("condition expected")), RuleOrSelectorExpected: new CSSIssueType("css-ruleorselectorexpected", t("at-rule or selector expected")), DotExpected: new CSSIssueType("css-dotexpected", t("dot expected")), ColonExpected: new CSSIssueType("css-colonexpected", t("colon expected")), SemiColonExpected: new CSSIssueType("css-semicolonexpected", t("semi-colon expected")), TermExpected: new CSSIssueType("css-termexpected", t("term expected")), ExpressionExpected: new CSSIssueType("css-expressionexpected", t("expression expected")), OperatorExpected: new CSSIssueType("css-operatorexpected", t("operator expected")), IdentifierExpected: new CSSIssueType("css-identifierexpected", t("identifier expected")), PercentageExpected: new CSSIssueType("css-percentageexpected", t("percentage expected")), URIOrStringExpected: new CSSIssueType("css-uriorstringexpected", t("uri or string expected")), URIExpected: new CSSIssueType("css-uriexpected", t("URI expected")), VariableNameExpected: new CSSIssueType("css-varnameexpected", t("variable name expected")), VariableValueExpected: new CSSIssueType("css-varvalueexpected", t("variable value expected")), PropertyValueExpected: new CSSIssueType("css-propertyvalueexpected", t("property value expected")), LeftCurlyExpected: new CSSIssueType("css-lcurlyexpected", t("{ expected")), RightCurlyExpected: new CSSIssueType("css-rcurlyexpected", t("} expected")), LeftSquareBracketExpected: new CSSIssueType("css-rbracketexpected", t("[ expected")), RightSquareBracketExpected: new CSSIssueType("css-lbracketexpected", t("] expected")), LeftParenthesisExpected: new CSSIssueType("css-lparentexpected", t("( expected")), RightParenthesisExpected: new CSSIssueType("css-rparentexpected", t(") expected")), CommaExpected: new CSSIssueType("css-commaexpected", t("comma expected")), PageDirectiveOrDeclarationExpected: new CSSIssueType("css-pagedirordeclexpected", t("page directive or declaraton expected")), UnknownAtRule: new CSSIssueType("css-unknownatrule", t("at-rule unknown")), UnknownKeyword: new CSSIssueType("css-unknownkeyword", t("unknown keyword")), SelectorExpected: new CSSIssueType("css-selectorexpected", t("selector expected")), StringLiteralExpected: new CSSIssueType("css-stringliteralexpected", t("string literal expected")), WhitespaceExpected: new CSSIssueType("css-whitespaceexpected", t("whitespace expected")), MediaQueryExpected: new CSSIssueType("css-mediaqueryexpected", t("media query expected")), IdentifierOrWildcardExpected: new CSSIssueType("css-idorwildcardexpected", t("identifier or wildcard expected")), WildcardExpected: new CSSIssueType("css-wildcardexpected", t("wildcard expected")), IdentifierOrVariableExpected: new CSSIssueType("css-idorvarexpected", t("identifier or variable expected")) }; // node_modules/vscode-languageserver-types/lib/esm/main.js var DocumentUri; (function(DocumentUri2) { function is(value) { return typeof value === "string"; } DocumentUri2.is = is; })(DocumentUri || (DocumentUri = {})); var URI; (function(URI3) { function is(value) { return typeof value === "string"; } URI3.is = is; })(URI || (URI = {})); var integer; (function(integer2) { integer2.MIN_VALUE = -2147483648; integer2.MAX_VALUE = 2147483647; function is(value) { return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE; } integer2.is = is; })(integer || (integer = {})); var uinteger; (function(uinteger2) { uinteger2.MIN_VALUE = 0; uinteger2.MAX_VALUE = 2147483647; function is(value) { return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE; } uinteger2.is = is; })(uinteger || (uinteger = {})); var Position; (function(Position2) { function create2(line, character) { if (line === Number.MAX_VALUE) { line = uinteger.MAX_VALUE; } if (character === Number.MAX_VALUE) { character = uinteger.MAX_VALUE; } return { line, character }; } Position2.create = create2; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); } Position2.is = is; })(Position || (Position = {})); var Range; (function(Range2) { function create2(one, two, three, four) { if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { return { start: Position.create(one, two), end: Position.create(three, four) }; } else if (Position.is(one) && Position.is(two)) { return { start: one, end: two }; } else { throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`); } } Range2.create = create2; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); } Range2.is = is; })(Range || (Range = {})); var Location; (function(Location2) { function create2(uri, range) { return { uri, range }; } Location2.create = create2; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); } Location2.is = is; })(Location || (Location = {})); var LocationLink; (function(LocationLink2) { function create2(targetUri, targetRange, targetSelectionRange, originSelectionRange) { return { targetUri, targetRange, targetSelectionRange, originSelectionRange }; } LocationLink2.create = create2; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); } LocationLink2.is = is; })(LocationLink || (LocationLink = {})); var Color; (function(Color2) { function create2(red, green, blue, alpha) { return { red, green, blue, alpha }; } Color2.create = create2; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); } Color2.is = is; })(Color || (Color = {})); var ColorInformation; (function(ColorInformation2) { function create2(range, color) { return { range, color }; } ColorInformation2.create = create2; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color); } ColorInformation2.is = is; })(ColorInformation || (ColorInformation = {})); var ColorPresentation; (function(ColorPresentation2) { function create2(label, textEdit, additionalTextEdits) { return { label, textEdit, additionalTextEdits }; } ColorPresentation2.create = create2; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); } ColorPresentation2.is = is; })(ColorPresentation || (ColorPresentation = {})); var FoldingRangeKind; (function(FoldingRangeKind2) { FoldingRangeKind2.Comment = "comment"; FoldingRangeKind2.Imports = "imports"; FoldingRangeKind2.Region = "region"; })(FoldingRangeKind || (FoldingRangeKind = {})); var FoldingRange; (function(FoldingRange2) { function create2(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) { const result = { startLine, endLine }; if (Is.defined(startCharacter)) { result.startCharacter = startCharacter; } if (Is.defined(endCharacter)) { result.endCharacter = endCharacter; } if (Is.defined(kind)) { result.kind = kind; } if (Is.defined(collapsedText)) { result.collapsedText = collapsedText; } return result; } FoldingRange2.create = create2; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); } FoldingRange2.is = is; })(FoldingRange || (FoldingRange = {})); var DiagnosticRelatedInformation; (function(DiagnosticRelatedInformation2) { function create2(location, message) { return { location, message }; } DiagnosticRelatedInformation2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); } DiagnosticRelatedInformation2.is = is; })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); var DiagnosticSeverity; (function(DiagnosticSeverity2) { DiagnosticSeverity2.Error = 1; DiagnosticSeverity2.Warning = 2; DiagnosticSeverity2.Information = 3; DiagnosticSeverity2.Hint = 4; })(DiagnosticSeverity || (DiagnosticSeverity = {})); var DiagnosticTag; (function(DiagnosticTag2) { DiagnosticTag2.Unnecessary = 1; DiagnosticTag2.Deprecated = 2; })(DiagnosticTag || (DiagnosticTag = {})); var CodeDescription; (function(CodeDescription2) { function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.href); } CodeDescription2.is = is; })(CodeDescription || (CodeDescription = {})); var Diagnostic; (function(Diagnostic2) { function create2(range, message, severity, code, source, relatedInformation) { let result = { range, message }; if (Is.defined(severity)) { result.severity = severity; } if (Is.defined(code)) { result.code = code; } if (Is.defined(source)) { result.source = source; } if (Is.defined(relatedInformation)) { result.relatedInformation = relatedInformation; } return result; } Diagnostic2.create = create2; function is(value) { var _a2; let candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a2 = candidate.codeDescription) === null || _a2 === void 0 ? void 0 : _a2.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); } Diagnostic2.is = is; })(Diagnostic || (Diagnostic = {})); var Command; (function(Command2) { function create2(title, command, ...args) { let result = { title, command }; if (Is.defined(args) && args.length > 0) { result.arguments = args; } return result; } Command2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); } Command2.is = is; })(Command || (Command = {})); var TextEdit; (function(TextEdit2) { function replace(range, newText) { return { range, newText }; } TextEdit2.replace = replace; function insert(position, newText) { return { range: { start: position, end: position }, newText }; } TextEdit2.insert = insert; function del(range) { return { range, newText: "" }; } TextEdit2.del = del; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range); } TextEdit2.is = is; })(TextEdit || (TextEdit = {})); var ChangeAnnotation; (function(ChangeAnnotation2) { function create2(label, needsConfirmation, description) { const result = { label }; if (needsConfirmation !== void 0) { result.needsConfirmation = needsConfirmation; } if (description !== void 0) { result.description = description; } return result; } ChangeAnnotation2.create = create2; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); } ChangeAnnotation2.is = is; })(ChangeAnnotation || (ChangeAnnotation = {})); var ChangeAnnotationIdentifier; (function(ChangeAnnotationIdentifier2) { function is(value) { const candidate = value; return Is.string(candidate); } ChangeAnnotationIdentifier2.is = is; })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); var AnnotatedTextEdit; (function(AnnotatedTextEdit2) { function replace(range, newText, annotation) { return { range, newText, annotationId: annotation }; } AnnotatedTextEdit2.replace = replace; function insert(position, newText, annotation) { return { range: { start: position, end: position }, newText, annotationId: annotation }; } AnnotatedTextEdit2.insert = insert; function del(range, annotation) { return { range, newText: "", annotationId: annotation }; } AnnotatedTextEdit2.del = del; function is(value) { const candidate = value; return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); } AnnotatedTextEdit2.is = is; })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); var TextDocumentEdit; (function(TextDocumentEdit2) { function create2(textDocument, edits) { return { textDocument, edits }; } TextDocumentEdit2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); } TextDocumentEdit2.is = is; })(TextDocumentEdit || (TextDocumentEdit = {})); var CreateFile; (function(CreateFile2) { function create2(uri, options, annotation) { let result = { kind: "create", uri }; if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } CreateFile2.create = create2; function is(value) { let candidate = value; return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } CreateFile2.is = is; })(CreateFile || (CreateFile = {})); var RenameFile; (function(RenameFile2) { function create2(oldUri, newUri, options, annotation) { let result = { kind: "rename", oldUri, newUri }; if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } RenameFile2.create = create2; function is(value) { let candidate = value; return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } RenameFile2.is = is; })(RenameFile || (RenameFile = {})); var DeleteFile; (function(DeleteFile2) { function create2(uri, options, annotation) { let result = { kind: "delete", uri }; if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { result.options = options; } if (annotation !== void 0) { result.annotationId = annotation; } return result; } DeleteFile2.create = create2; function is(value) { let candidate = value; return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); } DeleteFile2.is = is; })(DeleteFile || (DeleteFile = {})); var WorkspaceEdit; (function(WorkspaceEdit2) { function is(value) { let candidate = value; return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every((change) => { if (Is.string(change.kind)) { return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); } else { return TextDocumentEdit.is(change); } })); } WorkspaceEdit2.is = is; })(WorkspaceEdit || (WorkspaceEdit = {})); var TextDocumentIdentifier; (function(TextDocumentIdentifier2) { function create2(uri) { return { uri }; } TextDocumentIdentifier2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri); } TextDocumentIdentifier2.is = is; })(TextDocumentIdentifier || (TextDocumentIdentifier = {})); var VersionedTextDocumentIdentifier; (function(VersionedTextDocumentIdentifier2) { function create2(uri, version) { return { uri, version }; } VersionedTextDocumentIdentifier2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); } VersionedTextDocumentIdentifier2.is = is; })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); var OptionalVersionedTextDocumentIdentifier; (function(OptionalVersionedTextDocumentIdentifier2) { function create2(uri, version) { return { uri, version }; } OptionalVersionedTextDocumentIdentifier2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); } OptionalVersionedTextDocumentIdentifier2.is = is; })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); var TextDocumentItem; (function(TextDocumentItem2) { function create2(uri, languageId, version, text) { return { uri, languageId, version, text }; } TextDocumentItem2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); } TextDocumentItem2.is = is; })(TextDocumentItem || (TextDocumentItem = {})); var MarkupKind; (function(MarkupKind2) { MarkupKind2.PlainText = "plaintext"; MarkupKind2.Markdown = "markdown"; function is(value) { const candidate = value; return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown; } MarkupKind2.is = is; })(MarkupKind || (MarkupKind = {})); var MarkupContent; (function(MarkupContent2) { function is(value) { const candidate = value; return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); } MarkupContent2.is = is; })(MarkupContent || (MarkupContent = {})); var CompletionItemKind; (function(CompletionItemKind2) { CompletionItemKind2.Text = 1; CompletionItemKind2.Method = 2; CompletionItemKind2.Function = 3; CompletionItemKind2.Constructor = 4; CompletionItemKind2.Field = 5; CompletionItemKind2.Variable = 6; CompletionItemKind2.Class = 7; CompletionItemKind2.Interface = 8; CompletionItemKind2.Module = 9; CompletionItemKind2.Property = 10; CompletionItemKind2.Unit = 11; CompletionItemKind2.Value = 12; CompletionItemKind2.Enum = 13; CompletionItemKind2.Keyword = 14; CompletionItemKind2.Snippet = 15; CompletionItemKind2.Color = 16; CompletionItemKind2.File = 17; CompletionItemKind2.Reference = 18; CompletionItemKind2.Folder = 19; CompletionItemKind2.EnumMember = 20; CompletionItemKind2.Constant = 21; CompletionItemKind2.Struct = 22; CompletionItemKind2.Event = 23; CompletionItemKind2.Operator = 24; CompletionItemKind2.TypeParameter = 25; })(CompletionItemKind || (CompletionItemKind = {})); var InsertTextFormat; (function(InsertTextFormat2) { InsertTextFormat2.PlainText = 1; InsertTextFormat2.Snippet = 2; })(InsertTextFormat || (InsertTextFormat = {})); var CompletionItemTag; (function(CompletionItemTag2) { CompletionItemTag2.Deprecated = 1; })(CompletionItemTag || (CompletionItemTag = {})); var InsertReplaceEdit; (function(InsertReplaceEdit2) { function create2(newText, insert, replace) { return { newText, insert, replace }; } InsertReplaceEdit2.create = create2; function is(value) { const candidate = value; return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); } InsertReplaceEdit2.is = is; })(InsertReplaceEdit || (InsertReplaceEdit = {})); var InsertTextMode; (function(InsertTextMode2) { InsertTextMode2.asIs = 1; InsertTextMode2.adjustIndentation = 2; })(InsertTextMode || (InsertTextMode = {})); var CompletionItemLabelDetails; (function(CompletionItemLabelDetails2) { function is(value) { const candidate = value; return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0); } CompletionItemLabelDetails2.is = is; })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {})); var CompletionItem; (function(CompletionItem2) { function create2(label) { return { label }; } CompletionItem2.create = create2; })(CompletionItem || (CompletionItem = {})); var CompletionList; (function(CompletionList2) { function create2(items, isIncomplete) { return { items: items ? items : [], isIncomplete: !!isIncomplete }; } CompletionList2.create = create2; })(CompletionList || (CompletionList = {})); var MarkedString; (function(MarkedString2) { function fromPlainText(plainText) { return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); } MarkedString2.fromPlainText = fromPlainText; function is(value) { const candidate = value; return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); } MarkedString2.is = is; })(MarkedString || (MarkedString = {})); var Hover; (function(Hover2) { function is(value) { let candidate = value; return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range)); } Hover2.is = is; })(Hover || (Hover = {})); var ParameterInformation; (function(ParameterInformation2) { function create2(label, documentation) { return documentation ? { label, documentation } : { label }; } ParameterInformation2.create = create2; })(ParameterInformation || (ParameterInformation = {})); var SignatureInformation; (function(SignatureInformation2) { function create2(label, documentation, ...parameters) { let result = { label }; if (Is.defined(documentation)) { result.documentation = documentation; } if (Is.defined(parameters)) { result.parameters = parameters; } else { result.parameters = []; } return result; } SignatureInformation2.create = create2; })(SignatureInformation || (SignatureInformation = {})); var DocumentHighlightKind; (function(DocumentHighlightKind2) { DocumentHighlightKind2.Text = 1; DocumentHighlightKind2.Read = 2; DocumentHighlightKind2.Write = 3; })(DocumentHighlightKind || (DocumentHighlightKind = {})); var DocumentHighlight; (function(DocumentHighlight2) { function create2(range, kind) { let result = { range }; if (Is.number(kind)) { result.kind = kind; } return result; } DocumentHighlight2.create = create2; })(DocumentHighlight || (DocumentHighlight = {})); var SymbolKind; (function(SymbolKind2) { SymbolKind2.File = 1; SymbolKind2.Module = 2; SymbolKind2.Namespace = 3; SymbolKind2.Package = 4; SymbolKind2.Class = 5; SymbolKind2.Method = 6; SymbolKind2.Property = 7; SymbolKind2.Field = 8; SymbolKind2.Constructor = 9; SymbolKind2.Enum = 10; SymbolKind2.Interface = 11; SymbolKind2.Function = 12; SymbolKind2.Variable = 13; SymbolKind2.Constant = 14; SymbolKind2.String = 15; SymbolKind2.Number = 16; SymbolKind2.Boolean = 17; SymbolKind2.Array = 18; SymbolKind2.Object = 19; SymbolKind2.Key = 20; SymbolKind2.Null = 21; SymbolKind2.EnumMember = 22; SymbolKind2.Struct = 23; SymbolKind2.Event = 24; SymbolKind2.Operator = 25; SymbolKind2.TypeParameter = 26; })(SymbolKind || (SymbolKind = {})); var SymbolTag; (function(SymbolTag2) { SymbolTag2.Deprecated = 1; })(SymbolTag || (SymbolTag = {})); var SymbolInformation; (function(SymbolInformation2) { function create2(name, kind, range, uri, containerName) { let result = { name, kind, location: { uri, range } }; if (containerName) { result.containerName = containerName; } return result; } SymbolInformation2.create = create2; })(SymbolInformation || (SymbolInformation = {})); var WorkspaceSymbol; (function(WorkspaceSymbol2) { function create2(name, kind, uri, range) { return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } }; } WorkspaceSymbol2.create = create2; })(WorkspaceSymbol || (WorkspaceSymbol = {})); var DocumentSymbol; (function(DocumentSymbol2) { function create2(name, detail, kind, range, selectionRange, children) { let result = { name, detail, kind, range, selectionRange }; if (children !== void 0) { result.children = children; } return result; } DocumentSymbol2.create = create2; function is(value) { let candidate = value; return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags)); } DocumentSymbol2.is = is; })(DocumentSymbol || (DocumentSymbol = {})); var CodeActionKind; (function(CodeActionKind2) { CodeActionKind2.Empty = ""; CodeActionKind2.QuickFix = "quickfix"; CodeActionKind2.Refactor = "refactor"; CodeActionKind2.RefactorExtract = "refactor.extract"; CodeActionKind2.RefactorInline = "refactor.inline"; CodeActionKind2.RefactorRewrite = "refactor.rewrite"; CodeActionKind2.Source = "source"; CodeActionKind2.SourceOrganizeImports = "source.organizeImports"; CodeActionKind2.SourceFixAll = "source.fixAll"; })(CodeActionKind || (CodeActionKind = {})); var CodeActionTriggerKind; (function(CodeActionTriggerKind2) { CodeActionTriggerKind2.Invoked = 1; CodeActionTriggerKind2.Automatic = 2; })(CodeActionTriggerKind || (CodeActionTriggerKind = {})); var CodeActionContext; (function(CodeActionContext2) { function create2(diagnostics, only, triggerKind) { let result = { diagnostics }; if (only !== void 0 && only !== null) { result.only = only; } if (triggerKind !== void 0 && triggerKind !== null) { result.triggerKind = triggerKind; } return result; } CodeActionContext2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic); } CodeActionContext2.is = is; })(CodeActionContext || (CodeActionContext = {})); var CodeAction; (function(CodeAction2) { function create2(title, kindOrCommandOrEdit, kind) { let result = { title }; let checkKind = true; if (typeof kindOrCommandOrEdit === "string") { checkKind = false; result.kind = kindOrCommandOrEdit; } else if (Command.is(kindOrCommandOrEdit)) { result.command = kindOrCommandOrEdit; } else { result.edit = kindOrCommandOrEdit; } if (checkKind && kind !== void 0) { result.kind = kind; } return result; } CodeAction2.create = create2; function is(value) { let candidate = value; return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); } CodeAction2.is = is; })(CodeAction || (CodeAction = {})); var CodeLens; (function(CodeLens2) { function create2(range, data) { let result = { range }; if (Is.defined(data)) { result.data = data; } return result; } CodeLens2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); } CodeLens2.is = is; })(CodeLens || (CodeLens = {})); var FormattingOptions; (function(FormattingOptions2) { function create2(tabSize, insertSpaces) { return { tabSize, insertSpaces }; } FormattingOptions2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); } FormattingOptions2.is = is; })(FormattingOptions || (FormattingOptions = {})); var DocumentLink; (function(DocumentLink2) { function create2(range, target, data) { return { range, target, data }; } DocumentLink2.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); } DocumentLink2.is = is; })(DocumentLink || (DocumentLink = {})); var SelectionRange; (function(SelectionRange2) { function create2(range, parent) { return { range, parent }; } SelectionRange2.create = create2; function is(value) { let candidate = value; return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent)); } SelectionRange2.is = is; })(SelectionRange || (SelectionRange = {})); var SemanticTokenTypes; (function(SemanticTokenTypes2) { SemanticTokenTypes2["namespace"] = "namespace"; SemanticTokenTypes2["type"] = "type"; SemanticTokenTypes2["class"] = "class"; SemanticTokenTypes2["enum"] = "enum"; SemanticTokenTypes2["interface"] = "interface"; SemanticTokenTypes2["struct"] = "struct"; SemanticTokenTypes2["typeParameter"] = "typeParameter"; SemanticTokenTypes2["parameter"] = "parameter"; SemanticTokenTypes2["variable"] = "variable"; SemanticTokenTypes2["property"] = "property"; SemanticTokenTypes2["enumMember"] = "enumMember"; SemanticTokenTypes2["event"] = "event"; SemanticTokenTypes2["function"] = "function"; SemanticTokenTypes2["method"] = "method"; SemanticTokenTypes2["macro"] = "macro"; SemanticTokenTypes2["keyword"] = "keyword"; SemanticTokenTypes2["modifier"] = "modifier"; SemanticTokenTypes2["comment"] = "comment"; SemanticTokenTypes2["string"] = "string"; SemanticTokenTypes2["number"] = "number"; SemanticTokenTypes2["regexp"] = "regexp"; SemanticTokenTypes2["operator"] = "operator"; SemanticTokenTypes2["decorator"] = "decorator"; })(SemanticTokenTypes || (SemanticTokenTypes = {})); var SemanticTokenModifiers; (function(SemanticTokenModifiers2) { SemanticTokenModifiers2["declaration"] = "declaration"; SemanticTokenModifiers2["definition"] = "definition"; SemanticTokenModifiers2["readonly"] = "readonly"; SemanticTokenModifiers2["static"] = "static"; SemanticTokenModifiers2["deprecated"] = "deprecated"; SemanticTokenModifiers2["abstract"] = "abstract"; SemanticTokenModifiers2["async"] = "async"; SemanticTokenModifiers2["modification"] = "modification"; SemanticTokenModifiers2["documentation"] = "documentation"; SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary"; })(SemanticTokenModifiers || (SemanticTokenModifiers = {})); var SemanticTokens; (function(SemanticTokens2) { function is(value) { const candidate = value; return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number"); } SemanticTokens2.is = is; })(SemanticTokens || (SemanticTokens = {})); var InlineValueText; (function(InlineValueText2) { function create2(range, text) { return { range, text }; } InlineValueText2.create = create2; function is(value) { const candidate = value; return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text); } InlineValueText2.is = is; })(InlineValueText || (InlineValueText = {})); var InlineValueVariableLookup; (function(InlineValueVariableLookup2) { function create2(range, variableName, caseSensitiveLookup) { return { range, variableName, caseSensitiveLookup }; } InlineValueVariableLookup2.create = create2; function is(value) { const candidate = value; return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0); } InlineValueVariableLookup2.is = is; })(InlineValueVariableLookup || (InlineValueVariableLookup = {})); var InlineValueEvaluatableExpression; (function(InlineValueEvaluatableExpression2) { function create2(range, expression) { return { range, expression }; } InlineValueEvaluatableExpression2.create = create2; function is(value) { const candidate = value; return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0); } InlineValueEvaluatableExpression2.is = is; })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {})); var InlineValueContext; (function(InlineValueContext2) { function create2(frameId, stoppedLocation) { return { frameId, stoppedLocation }; } InlineValueContext2.create = create2; function is(value) { const candidate = value; return Is.defined(candidate) && Range.is(value.stoppedLocation); } InlineValueContext2.is = is; })(InlineValueContext || (InlineValueContext = {})); var InlayHintKind; (function(InlayHintKind2) { InlayHintKind2.Type = 1; InlayHintKind2.Parameter = 2; function is(value) { return value === 1 || value === 2; } InlayHintKind2.is = is; })(InlayHintKind || (InlayHintKind = {})); var InlayHintLabelPart; (function(InlayHintLabelPart2) { function create2(value) { return { value }; } InlayHintLabelPart2.create = create2; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command)); } InlayHintLabelPart2.is = is; })(InlayHintLabelPart || (InlayHintLabelPart = {})); var InlayHint; (function(InlayHint2) { function create2(position, label, kind) { const result = { position, label }; if (kind !== void 0) { result.kind = kind; } return result; } InlayHint2.create = create2; function is(value) { const candidate = value; return Is.objectLiteral(candidate) && Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight)); } InlayHint2.is = is; })(InlayHint || (InlayHint = {})); var StringValue; (function(StringValue2) { function createSnippet(value) { return { kind: "snippet", value }; } StringValue2.createSnippet = createSnippet; })(StringValue || (StringValue = {})); var InlineCompletionItem; (function(InlineCompletionItem2) { function create2(insertText, filterText, range, command) { return { insertText, filterText, range, command }; } InlineCompletionItem2.create = create2; })(InlineCompletionItem || (InlineCompletionItem = {})); var InlineCompletionList; (function(InlineCompletionList2) { function create2(items) { return { items }; } InlineCompletionList2.create = create2; })(InlineCompletionList || (InlineCompletionList = {})); var InlineCompletionTriggerKind; (function(InlineCompletionTriggerKind2) { InlineCompletionTriggerKind2.Invoked = 0; InlineCompletionTriggerKind2.Automatic = 1; })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {})); var SelectedCompletionInfo; (function(SelectedCompletionInfo2) { function create2(range, text) { return { range, text }; } SelectedCompletionInfo2.create = create2; })(SelectedCompletionInfo || (SelectedCompletionInfo = {})); var InlineCompletionContext; (function(InlineCompletionContext2) { function create2(triggerKind, selectedCompletionInfo) { return { triggerKind, selectedCompletionInfo }; } InlineCompletionContext2.create = create2; })(InlineCompletionContext || (InlineCompletionContext = {})); var WorkspaceFolder; (function(WorkspaceFolder2) { function is(value) { const candidate = value; return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name); } WorkspaceFolder2.is = is; })(WorkspaceFolder || (WorkspaceFolder = {})); var TextDocument; (function(TextDocument3) { function create2(uri, languageId, version, content) { return new FullTextDocument(uri, languageId, version, content); } TextDocument3.create = create2; function is(value) { let candidate = value; return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; } TextDocument3.is = is; function applyEdits(document, edits) { let text = document.getText(); let sortedEdits = mergeSort2(edits, (a2, b) => { let diff = a2.range.start.line - b.range.start.line; if (diff === 0) { return a2.range.start.character - b.range.start.character; } return diff; }); let lastModifiedOffset = text.length; for (let i = sortedEdits.length - 1; i >= 0; i--) { let e = sortedEdits[i]; let startOffset = document.offsetAt(e.range.start); let endOffset = document.offsetAt(e.range.end); if (endOffset <= lastModifiedOffset) { text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); } else { throw new Error("Overlapping edit"); } lastModifiedOffset = startOffset; } return text; } TextDocument3.applyEdits = applyEdits; function mergeSort2(data, compare) { if (data.length <= 1) { return data; } const p = data.length / 2 | 0; const left = data.slice(0, p); const right = data.slice(p); mergeSort2(left, compare); mergeSort2(right, compare); let leftIdx = 0; let rightIdx = 0; let i = 0; while (leftIdx < left.length && rightIdx < right.length) { let ret = compare(left[leftIdx], right[rightIdx]); if (ret <= 0) { data[i++] = left[leftIdx++]; } else { data[i++] = right[rightIdx++]; } } while (leftIdx < left.length) { data[i++] = left[leftIdx++]; } while (rightIdx < right.length) { data[i++] = right[rightIdx++]; } return data; } })(TextDocument || (TextDocument = {})); var FullTextDocument = class { constructor(uri, languageId, version, content) { this._uri = uri; this._languageId = languageId; this._version = version; this._content = content; this._lineOffsets = void 0; } get uri() { return this._uri; } get languageId() { return this._languageId; } get version() { return this._version; } getText(range) { if (range) { let start = this.offsetAt(range.start); let end = this.offsetAt(range.end); return this._content.substring(start, end); } return this._content; } update(event, version) { this._content = event.text; this._version = version; this._lineOffsets = void 0; } getLineOffsets() { if (this._lineOffsets === void 0) { let lineOffsets = []; let text = this._content; let isLineStart = true; for (let i = 0; i < text.length; i++) { if (isLineStart) { lineOffsets.push(i); isLineStart = false; } let ch = text.charAt(i); isLineStart = ch === "\r" || ch === "\n"; if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") { i++; } } if (isLineStart && text.length > 0) { lineOffsets.push(text.length); } this._lineOffsets = lineOffsets; } return this._lineOffsets; } positionAt(offset) { offset = Math.max(Math.min(offset, this._content.length), 0); let lineOffsets = this.getLineOffsets(); let low = 0, high = lineOffsets.length; if (high === 0) { return Position.create(0, offset); } while (low < high) { let mid = Math.floor((low + high) / 2); if (lineOffsets[mid] > offset) { high = mid; } else { low = mid + 1; } } let line = low - 1; return Position.create(line, offset - lineOffsets[line]); } offsetAt(position) { let lineOffsets = this.getLineOffsets(); if (position.line >= lineOffsets.length) { return this._content.length; } else if (position.line < 0) { return 0; } let lineOffset = lineOffsets[position.line]; let nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); } get lineCount() { return this.getLineOffsets().length; } }; var Is; (function(Is2) { const toString = Object.prototype.toString; function defined(value) { return typeof value !== "undefined"; } Is2.defined = defined; function undefined2(value) { return typeof value === "undefined"; } Is2.undefined = undefined2; function boolean(value) { return value === true || value === false; } Is2.boolean = boolean; function string(value) { return toString.call(value) === "[object String]"; } Is2.string = string; function number(value) { return toString.call(value) === "[object Number]"; } Is2.number = number; function numberRange(value, min, max) { return toString.call(value) === "[object Number]" && min <= value && value <= max; } Is2.numberRange = numberRange; function integer2(value) { return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647; } Is2.integer = integer2; function uinteger2(value) { return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647; } Is2.uinteger = uinteger2; function func(value) { return toString.call(value) === "[object Function]"; } Is2.func = func; function objectLiteral(value) { return value !== null && typeof value === "object"; } Is2.objectLiteral = objectLiteral; function typedArray(value, check) { return Array.isArray(value) && value.every(check); } Is2.typedArray = typedArray; })(Is || (Is = {})); // node_modules/vscode-languageserver-textdocument/lib/esm/main.js var FullTextDocument2 = class _FullTextDocument { constructor(uri, languageId, version, content) { this._uri = uri; this._languageId = languageId; this._version = version; this._content = content; this._lineOffsets = void 0; } get uri() { return this._uri; } get languageId() { return this._languageId; } get version() { return this._version; } getText(range) { if (range) { const start = this.offsetAt(range.start); const end = this.offsetAt(range.end); return this._content.substring(start, end); } return this._content; } update(changes, version) { for (let change of changes) { if (_FullTextDocument.isIncremental(change)) { const range = getWellformedRange(change.range); const startOffset = this.offsetAt(range.start); const endOffset = this.offsetAt(range.end); this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length); const startLine = Math.max(range.start.line, 0); const endLine = Math.max(range.end.line, 0); let lineOffsets = this._lineOffsets; const addedLineOffsets = computeLineOffsets(change.text, false, startOffset); if (endLine - startLine === addedLineOffsets.length) { for (let i = 0, len = addedLineOffsets.length; i < len; i++) { lineOffsets[i + startLine + 1] = addedLineOffsets[i]; } } else { if (addedLineOffsets.length < 1e4) { lineOffsets.splice(startLine + 1, endLine - startLine, ...addedLineOffsets); } else { this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1)); } } const diff = change.text.length - (endOffset - startOffset); if (diff !== 0) { for (let i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) { lineOffsets[i] = lineOffsets[i] + diff; } } } else if (_FullTextDocument.isFull(change)) { this._content = change.text; this._lineOffsets = void 0; } else { throw new Error("Unknown change event received"); } } this._version = version; } getLineOffsets() { if (this._lineOffsets === void 0) { this._lineOffsets = computeLineOffsets(this._content, true); } return this._lineOffsets; } positionAt(offset) { offset = Math.max(Math.min(offset, this._content.length), 0); let lineOffsets = this.getLineOffsets(); let low = 0, high = lineOffsets.length; if (high === 0) { return { line: 0, character: offset }; } while (low < high) { let mid = Math.floor((low + high) / 2); if (lineOffsets[mid] > offset) { high = mid; } else { low = mid + 1; } } let line = low - 1; return { line, character: offset - lineOffsets[line] }; } offsetAt(position) { let lineOffsets = this.getLineOffsets(); if (position.line >= lineOffsets.length) { return this._content.length; } else if (position.line < 0) { return 0; } let lineOffset = lineOffsets[position.line]; let nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); } get lineCount() { return this.getLineOffsets().length; } static isIncremental(event) { let candidate = event; return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); } static isFull(event) { let candidate = event; return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; } }; var TextDocument2; (function(TextDocument3) { function create2(uri, languageId, version, content) { return new FullTextDocument2(uri, languageId, version, content); } TextDocument3.create = create2; function update(document, changes, version) { if (document instanceof FullTextDocument2) { document.update(changes, version); return document; } else { throw new Error("TextDocument.update: document must be created by TextDocument.create"); } } TextDocument3.update = update; function applyEdits(document, edits) { let text = document.getText(); let sortedEdits = mergeSort(edits.map(getWellformedEdit), (a2, b) => { let diff = a2.range.start.line - b.range.start.line; if (diff === 0) { return a2.range.start.character - b.range.start.character; } return diff; }); let lastModifiedOffset = 0; const spans = []; for (const e of sortedEdits) { let startOffset = document.offsetAt(e.range.start); if (startOffset < lastModifiedOffset) { throw new Error("Overlapping edit"); } else if (startOffset > lastModifiedOffset) { spans.push(text.substring(lastModifiedOffset, startOffset)); } if (e.newText.length) { spans.push(e.newText); } lastModifiedOffset = document.offsetAt(e.range.end); } spans.push(text.substr(lastModifiedOffset)); return spans.join(""); } TextDocument3.applyEdits = applyEdits; })(TextDocument2 || (TextDocument2 = {})); function mergeSort(data, compare) { if (data.length <= 1) { return data; } const p = data.length / 2 | 0; const left = data.slice(0, p); const right = data.slice(p); mergeSort(left, compare); mergeSort(right, compare); let leftIdx = 0; let rightIdx = 0; let i = 0; while (leftIdx < left.length && rightIdx < right.length) { let ret = compare(left[leftIdx], right[rightIdx]); if (ret <= 0) { data[i++] = left[leftIdx++]; } else { data[i++] = right[rightIdx++]; } } while (leftIdx < left.length) { data[i++] = left[leftIdx++]; } while (rightIdx < right.length) { data[i++] = right[rightIdx++]; } return data; } function computeLineOffsets(text, isAtLineStart, textOffset = 0) { const result = isAtLineStart ? [textOffset] : []; for (let i = 0; i < text.length; i++) { let ch = text.charCodeAt(i); if (ch === 13 || ch === 10) { if (ch === 13 && i + 1 < text.length && text.charCodeAt(i + 1) === 10) { i++; } result.push(textOffset + i + 1); } } return result; } function getWellformedRange(range) { const start = range.start; const end = range.end; if (start.line > end.line || start.line === end.line && start.character > end.character) { return { start: end, end: start }; } return range; } function getWellformedEdit(textEdit) { const range = getWellformedRange(textEdit.range); if (range !== textEdit.range) { return { newText: textEdit.newText, range }; } return textEdit; } // node_modules/vscode-css-languageservice/lib/esm/cssLanguageTypes.js var ClientCapabilities; (function(ClientCapabilities2) { ClientCapabilities2.LATEST = { textDocument: { completion: { completionItem: { documentationFormat: [MarkupKind.Markdown, MarkupKind.PlainText] } }, hover: { contentFormat: [MarkupKind.Markdown, MarkupKind.PlainText] } } }; })(ClientCapabilities || (ClientCapabilities = {})); var FileType; (function(FileType2) { FileType2[FileType2["Unknown"] = 0] = "Unknown"; FileType2[FileType2["File"] = 1] = "File"; FileType2[FileType2["Directory"] = 2] = "Directory"; FileType2[FileType2["SymbolicLink"] = 64] = "SymbolicLink"; })(FileType || (FileType = {})); // node_modules/vscode-css-languageservice/lib/esm/languageFacts/entry.js var browserNames = { E: "Edge", FF: "Firefox", S: "Safari", C: "Chrome", IE: "IE", O: "Opera" }; function getEntryStatus(status) { switch (status) { case "experimental": return "\u26A0\uFE0F Property is experimental. Be cautious when using it.\uFE0F\n\n"; case "nonstandard": return "\u{1F6A8}\uFE0F Property is nonstandard. Avoid using it.\n\n"; case "obsolete": return "\u{1F6A8}\uFE0F\uFE0F\uFE0F Property is obsolete. Avoid using it.\n\n"; default: return ""; } } function getEntryDescription(entry, doesSupportMarkdown, settings) { let result; if (doesSupportMarkdown) { result = { kind: "markdown", value: getEntryMarkdownDescription(entry, settings) }; } else { result = { kind: "plaintext", value: getEntryStringDescription(entry, settings) }; } if (result.value === "") { return void 0; } return result; } function textToMarkedString(text) { text = text.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); return text.replace(//g, ">"); } function getEntryStringDescription(entry, settings) { if (!entry.description || entry.description === "") { return ""; } if (typeof entry.description !== "string") { return entry.description.value; } let result = ""; if (settings?.documentation !== false) { if (entry.status) { result += getEntryStatus(entry.status); } result += entry.description; const browserLabel = getBrowserLabel(entry.browsers); if (browserLabel) { result += "\n(" + browserLabel + ")"; } if ("syntax" in entry) { result += ` Syntax: ${entry.syntax}`; } } if (entry.references && entry.references.length > 0 && settings?.references !== false) { if (result.length > 0) { result += "\n\n"; } result += entry.references.map((r) => { return `${r.name}: ${r.url}`; }).join(" | "); } return result; } function getEntryMarkdownDescription(entry, settings) { if (!entry.description || entry.description === "") { return ""; } let result = ""; if (settings?.documentation !== false) { if (entry.status) { result += getEntryStatus(entry.status); } if (typeof entry.description === "string") { result += textToMarkedString(entry.description); } else { result += entry.description.kind === MarkupKind.Markdown ? entry.description.value : textToMarkedString(entry.description.value); } const browserLabel = getBrowserLabel(entry.browsers); if (browserLabel) { result += "\n\n(" + textToMarkedString(browserLabel) + ")"; } if ("syntax" in entry && entry.syntax) { result += ` Syntax: ${textToMarkedString(entry.syntax)}`; } } if (entry.references && entry.references.length > 0 && settings?.references !== false) { if (result.length > 0) { result += "\n\n"; } result += entry.references.map((r) => { return `[${r.name}](${r.url})`; }).join(" | "); } return result; } function getBrowserLabel(browsers = []) { if (browsers.length === 0) { return null; } return browsers.map((b) => { let result = ""; const matches2 = b.match(/([A-Z]+)(\d+)?/); const name = matches2[1]; const version = matches2[2]; if (name in browserNames) { result += browserNames[name]; } if (version) { result += " " + version; } return result; }).join(", "); } // node_modules/vscode-css-languageservice/lib/esm/languageFacts/colors.js var hexColorRegExp = /(^#([0-9A-F]{3}){1,2}$)|(^#([0-9A-F]{4}){1,2}$)/i; var colorFunctions = [ { label: "rgb", func: "rgb($red, $green, $blue)", insertText: "rgb(${1:red}, ${2:green}, ${3:blue})", desc: t("Creates a Color from red, green, and blue values.") }, { label: "rgba", func: "rgba($red, $green, $blue, $alpha)", insertText: "rgba(${1:red}, ${2:green}, ${3:blue}, ${4:alpha})", desc: t("Creates a Color from red, green, blue, and alpha values.") }, { label: "rgb relative", func: "rgb(from $color $red $green $blue)", insertText: "rgb(from ${1:color} ${2:r} ${3:g} ${4:b})", desc: t("Creates a Color from the red, green, and blue values of another Color.") }, { label: "hsl", func: "hsl($hue, $saturation, $lightness)", insertText: "hsl(${1:hue}, ${2:saturation}, ${3:lightness})", desc: t("Creates a Color from hue, saturation, and lightness values.") }, { label: "hsla", func: "hsla($hue, $saturation, $lightness, $alpha)", insertText: "hsla(${1:hue}, ${2:saturation}, ${3:lightness}, ${4:alpha})", desc: t("Creates a Color from hue, saturation, lightness, and alpha values.") }, { label: "hsl relative", func: "hsl(from $color $hue $saturation $lightness)", insertText: "hsl(from ${1:color} ${2:h} ${3:s} ${4:l})", desc: t("Creates a Color from the hue, saturation, and lightness values of another Color.") }, { label: "hwb", func: "hwb($hue $white $black)", insertText: "hwb(${1:hue} ${2:white} ${3:black})", desc: t("Creates a Color from hue, white, and black values.") }, { label: "hwb relative", func: "hwb(from $color $hue $white $black)", insertText: "hwb(from ${1:color} ${2:h} ${3:w} ${4:b})", desc: t("Creates a Color from the hue, white, and black values of another Color.") }, { label: "lab", func: "lab($lightness $a $b)", insertText: "lab(${1:lightness} ${2:a} ${3:b})", desc: t("Creates a Color from lightness, a, and b values.") }, { label: "lab relative", func: "lab(from $color $lightness $a $b)", insertText: "lab(from ${1:color} ${2:l} ${3:a} ${4:b})", desc: t("Creates a Color from the lightness, a, and b values of another Color.") }, { label: "oklab", func: "oklab($lightness $a $b)", insertText: "oklab(${1:lightness} ${2:a} ${3:b})", desc: t("Creates a Color from lightness, a, and b values.") }, { label: "oklab relative", func: "oklab(from $color $lightness $a $b)", insertText: "oklab(from ${1:color} ${2:l} ${3:a} ${4:b})", desc: t("Creates a Color from the lightness, a, and b values of another Color.") }, { label: "lch", func: "lch($lightness $chroma $hue)", insertText: "lch(${1:lightness} ${2:chroma} ${3:hue})", desc: t("Creates a Color from lightness, chroma, and hue values.") }, { label: "lch relative", func: "lch(from $color $lightness $chroma $hue)", insertText: "lch(from ${1:color} ${2:l} ${3:c} ${4:h})", desc: t("Creates a Color from the lightness, chroma, and hue values of another Color.") }, { label: "oklch", func: "oklch($lightness $chroma $hue)", insertText: "oklch(${1:lightness} ${2:chroma} ${3:hue})", desc: t("Creates a Color from lightness, chroma, and hue values.") }, { label: "oklch relative", func: "oklch(from $color $lightness $chroma $hue)", insertText: "oklch(from ${1:color} ${2:l} ${3:c} ${4:h})", desc: t("Creates a Color from the lightness, chroma, and hue values of another Color.") }, { label: "color", func: "color($color-space $red $green $blue)", insertText: "color(${1|srgb,srgb-linear,display-p3,a98-rgb,prophoto-rgb,rec2020,xyx,xyz-d50,xyz-d65|} ${2:red} ${3:green} ${4:blue})", desc: t("Creates a Color in a specific color space from red, green, and blue values.") }, { label: "color relative", func: "color(from $color $color-space $red $green $blue)", insertText: "color(from ${1:color} ${2|srgb,srgb-linear,display-p3,a98-rgb,prophoto-rgb,rec2020,xyx,xyz-d50,xyz-d65|} ${3:r} ${4:g} ${5:b})", desc: t("Creates a Color in a specific color space from the red, green, and blue values of another Color.") }, { label: "color-mix", func: "color-mix(in $color-space, $color $percentage, $color $percentage)", insertText: "color-mix(in ${1|srgb,srgb-linear,lab,oklab,xyz,xyz-d50,xyz-d65|}, ${3:color} ${4:percentage}, ${5:color} ${6:percentage})", desc: t("Mix two colors together in a rectangular color space.") }, { label: "color-mix hue", func: "color-mix(in $color-space $interpolation-method hue, $color $percentage, $color $percentage)", insertText: "color-mix(in ${1|hsl,hwb,lch,oklch|} ${2|shorter hue,longer hue,increasing hue,decreasing hue|}, ${3:color} ${4:percentage}, ${5:color} ${6:percentage})", desc: t("Mix two colors together in a polar color space.") } ]; var colorFunctionNameRegExp = /^(rgb|rgba|hsl|hsla|hwb)$/i; var colors = { aliceblue: "#f0f8ff", antiquewhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedalmond: "#ffebcd", blue: "#0000ff", blueviolet: "#8a2be2", brown: "#a52a2a", burlywood: "#deb887", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerblue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkgray: "#a9a9a9", darkgrey: "#a9a9a9", darkgreen: "#006400", darkkhaki: "#bdb76b", darkmagenta: "#8b008b", darkolivegreen: "#556b2f", darkorange: "#ff8c00", darkorchid: "#9932cc", darkred: "#8b0000", darksalmon: "#e9967a", darkseagreen: "#8fbc8f", darkslateblue: "#483d8b", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", darkturquoise: "#00ced1", darkviolet: "#9400d3", deeppink: "#ff1493", deepskyblue: "#00bfff", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1e90ff", firebrick: "#b22222", floralwhite: "#fffaf0", forestgreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#dcdcdc", ghostwhite: "#f8f8ff", gold: "#ffd700", goldenrod: "#daa520", gray: "#808080", grey: "#808080", green: "#008000", greenyellow: "#adff2f", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavender: "#e6e6fa", lavenderblush: "#fff0f5", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgrey: "#d3d3d3", lightgreen: "#90ee90", lightpink: "#ffb6c1", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", lightskyblue: "#87cefa", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#b0c4de", lightyellow: "#ffffe0", lime: "#00ff00", limegreen: "#32cd32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", mediumaquamarine: "#66cdaa", mediumblue: "#0000cd", mediumorchid: "#ba55d3", mediumpurple: "#9370d8", mediumseagreen: "#3cb371", mediumslateblue: "#7b68ee", mediumspringgreen: "#00fa9a", mediumturquoise: "#48d1cc", mediumvioletred: "#c71585", midnightblue: "#191970", mintcream: "#f5fffa", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", navajowhite: "#ffdead", navy: "#000080", oldlace: "#fdf5e6", olive: "#808000", olivedrab: "#6b8e23", orange: "#ffa500", orangered: "#ff4500", orchid: "#da70d6", palegoldenrod: "#eee8aa", palegreen: "#98fb98", paleturquoise: "#afeeee", palevioletred: "#d87093", papayawhip: "#ffefd5", peachpuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderblue: "#b0e0e6", purple: "#800080", red: "#ff0000", rebeccapurple: "#663399", rosybrown: "#bc8f8f", royalblue: "#4169e1", saddlebrown: "#8b4513", salmon: "#fa8072", sandybrown: "#f4a460", seagreen: "#2e8b57", seashell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", skyblue: "#87ceeb", slateblue: "#6a5acd", slategray: "#708090", slategrey: "#708090", snow: "#fffafa", springgreen: "#00ff7f", steelblue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whitesmoke: "#f5f5f5", yellow: "#ffff00", yellowgreen: "#9acd32" }; var colorsRegExp = new RegExp(`^(${Object.keys(colors).join("|")})$`, "i"); var colorKeywords = { "currentColor": "The value of the 'color' property. The computed value of the 'currentColor' keyword is the computed value of the 'color' property. If the 'currentColor' keyword is set on the 'color' property itself, it is treated as 'color:inherit' at parse time.", "transparent": "Fully transparent. This keyword can be considered a shorthand for rgba(0,0,0,0) which is its computed value." }; var colorKeywordsRegExp = new RegExp(`^(${Object.keys(colorKeywords).join("|")})$`, "i"); function getNumericValue(node, factor) { const val = node.getText(); const m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(%?)$/); if (m) { if (m[2]) { factor = 100; } const result = parseFloat(m[1]) / factor; if (result >= 0 && result <= 1) { return result; } } throw new Error(); } function getAngle(node) { const val = node.getText(); const m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg|rad|grad|turn)?$/); if (m) { switch (m[2]) { case "deg": return parseFloat(val) % 360; case "rad": return parseFloat(val) * 180 / Math.PI % 360; case "grad": return parseFloat(val) * 0.9 % 360; case "turn": return parseFloat(val) * 360 % 360; default: if ("undefined" === typeof m[2]) { return parseFloat(val) % 360; } } } throw new Error(); } function isColorConstructor(node) { const name = node.getName(); if (!name) { return false; } return colorFunctionNameRegExp.test(name); } function isColorString(s) { return hexColorRegExp.test(s) || colorsRegExp.test(s) || colorKeywordsRegExp.test(s); } var Digit0 = 48; var Digit9 = 57; var A = 65; var a = 97; var f = 102; function hexDigit(charCode) { if (charCode < Digit0) { return 0; } if (charCode <= Digit9) { return charCode - Digit0; } if (charCode < a) { charCode += a - A; } if (charCode >= a && charCode <= f) { return charCode - a + 10; } return 0; } function colorFromHex(text) { if (text[0] !== "#") { return null; } switch (text.length) { case 4: return { red: hexDigit(text.charCodeAt(1)) * 17 / 255, green: hexDigit(text.charCodeAt(2)) * 17 / 255, blue: hexDigit(text.charCodeAt(3)) * 17 / 255, alpha: 1 }; case 5: return { red: hexDigit(text.charCodeAt(1)) * 17 / 255, green: hexDigit(text.charCodeAt(2)) * 17 / 255, blue: hexDigit(text.charCodeAt(3)) * 17 / 255, alpha: hexDigit(text.charCodeAt(4)) * 17 / 255 }; case 7: return { red: (hexDigit(text.charCodeAt(1)) * 16 + hexDigit(text.charCodeAt(2))) / 255, green: (hexDigit(text.charCodeAt(3)) * 16 + hexDigit(text.charCodeAt(4))) / 255, blue: (hexDigit(text.charCodeAt(5)) * 16 + hexDigit(text.charCodeAt(6))) / 255, alpha: 1 }; case 9: return { red: (hexDigit(text.charCodeAt(1)) * 16 + hexDigit(text.charCodeAt(2))) / 255, green: (hexDigit(text.charCodeAt(3)) * 16 + hexDigit(text.charCodeAt(4))) / 255, blue: (hexDigit(text.charCodeAt(5)) * 16 + hexDigit(text.charCodeAt(6))) / 255, alpha: (hexDigit(text.charCodeAt(7)) * 16 + hexDigit(text.charCodeAt(8))) / 255 }; } return null; } function colorFromHSL(hue, sat, light, alpha = 1) { hue = hue / 60; if (sat === 0) { return { red: light, green: light, blue: light, alpha }; } else { const hueToRgb = (t12, t22, hue2) => { while (hue2 < 0) { hue2 += 6; } while (hue2 >= 6) { hue2 -= 6; } if (hue2 < 1) { return (t22 - t12) * hue2 + t12; } if (hue2 < 3) { return t22; } if (hue2 < 4) { return (t22 - t12) * (4 - hue2) + t12; } return t12; }; const t2 = light <= 0.5 ? light * (sat + 1) : light + sat - light * sat; const t1 = light * 2 - t2; return { red: hueToRgb(t1, t2, hue + 2), green: hueToRgb(t1, t2, hue), blue: hueToRgb(t1, t2, hue - 2), alpha }; } } function hslFromColor(rgba) { const r = rgba.red; const g = rgba.green; const b = rgba.blue; const a2 = rgba.alpha; const max = Math.max(r, g, b); const min = Math.min(r, g, b); let h = 0; let s = 0; const l = (min + max) / 2; const chroma = max - min; if (chroma > 0) { s = Math.min(l <= 0.5 ? chroma / (2 * l) : chroma / (2 - 2 * l), 1); switch (max) { case r: h = (g - b) / chroma + (g < b ? 6 : 0); break; case g: h = (b - r) / chroma + 2; break; case b: h = (r - g) / chroma + 4; break; } h *= 60; h = Math.round(h); } return { h, s, l, a: a2 }; } function colorFromHWB(hue, white, black, alpha = 1) { if (white + black >= 1) { const gray = white / (white + black); return { red: gray, green: gray, blue: gray, alpha }; } const rgb = colorFromHSL(hue, 1, 0.5, alpha); let red = rgb.red; red *= 1 - white - black; red += white; let green = rgb.green; green *= 1 - white - black; green += white; let blue = rgb.blue; blue *= 1 - white - black; blue += white; return { red, green, blue, alpha }; } function hwbFromColor(rgba) { const hsl = hslFromColor(rgba); const white = Math.min(rgba.red, rgba.green, rgba.blue); const black = 1 - Math.max(rgba.red, rgba.green, rgba.blue); return { h: hsl.h, w: white, b: black, a: hsl.a }; } function getColorValue(node) { if (node.type === NodeType.HexColorValue) { const text = node.getText(); return colorFromHex(text); } else if (node.type === NodeType.Function) { const functionNode = node; const name = functionNode.getName(); let colorValues = functionNode.getArguments().getChildren(); if (colorValues.length === 1) { const functionArg = colorValues[0].getChildren(); if (functionArg.length === 1 && functionArg[0].type === NodeType.Expression) { colorValues = functionArg[0].getChildren(); if (colorValues.length === 3) { const lastValue = colorValues[2]; if (lastValue instanceof BinaryExpression) { const left = lastValue.getLeft(), right = lastValue.getRight(), operator = lastValue.getOperator(); if (left && right && operator && operator.matches("/")) { colorValues = [colorValues[0], colorValues[1], left, right]; } } } } } if (!name || colorValues.length < 3 || colorValues.length > 4) { return null; } try { const alpha = colorValues.length === 4 ? getNumericValue(colorValues[3], 1) : 1; if (name === "rgb" || name === "rgba") { return { red: getNumericValue(colorValues[0], 255), green: getNumericValue(colorValues[1], 255), blue: getNumericValue(colorValues[2], 255), alpha }; } else if (name === "hsl" || name === "hsla") { const h = getAngle(colorValues[0]); const s = getNumericValue(colorValues[1], 100); const l = getNumericValue(colorValues[2], 100); return colorFromHSL(h, s, l, alpha); } else if (name === "hwb") { const h = getAngle(colorValues[0]); const w = getNumericValue(colorValues[1], 100); const b = getNumericValue(colorValues[2], 100); return colorFromHWB(h, w, b, alpha); } } catch (e) { return null; } } else if (node.type === NodeType.Identifier) { if (node.parent && node.parent.type !== NodeType.Term) { return null; } const term = node.parent; if (term && term.parent && term.parent.type === NodeType.BinaryExpression) { const expression = term.parent; if (expression.parent && expression.parent.type === NodeType.ListEntry && expression.parent.key === expression) { return null; } } const candidateColor = node.getText().toLowerCase(); if (candidateColor === "none") { return null; } const colorHex = colors[candidateColor]; if (colorHex) { return colorFromHex(colorHex); } } return null; } // node_modules/vscode-css-languageservice/lib/esm/languageFacts/builtinData.js var positionKeywords = { "bottom": "Computes to \u2018100%\u2019 for the vertical position if one or two values are given, otherwise specifies the bottom edge as the origin for the next offset.", "center": "Computes to \u201850%\u2019 (\u2018left 50%\u2019) for the horizontal position if the horizontal position is not otherwise specified, or \u201850%\u2019 (\u2018top 50%\u2019) for the vertical position if it is.", "left": "Computes to \u20180%\u2019 for the horizontal position if one or two values are given, otherwise specifies the left edge as the origin for the next offset.", "right": "Computes to \u2018100%\u2019 for the horizontal position if one or two values are given, otherwise specifies the right edge as the origin for the next offset.", "top": "Computes to \u20180%\u2019 for the vertical position if one or two values are given, otherwise specifies the top edge as the origin for the next offset." }; var repeatStyleKeywords = { "no-repeat": "Placed once and not repeated in this direction.", "repeat": "Repeated in this direction as often as needed to cover the background painting area.", "repeat-x": "Computes to \u2018repeat no-repeat\u2019.", "repeat-y": "Computes to \u2018no-repeat repeat\u2019.", "round": "Repeated as often as will fit within the background positioning area. If it doesn\u2019t fit a whole number of times, it is rescaled so that it does.", "space": "Repeated as often as will fit within the background positioning area without being clipped and then the images are spaced out to fill the area." }; var lineStyleKeywords = { "dashed": "A series of square-ended dashes.", "dotted": "A series of round dots.", "double": "Two parallel solid lines with some space between them.", "groove": "Looks as if it were carved in the canvas.", "hidden": "Same as \u2018none\u2019, but has different behavior in the border conflict resolution rules for border-collapsed tables.", "inset": "Looks as if the content on the inside of the border is sunken into the canvas.", "none": "No border. Color and width are ignored.", "outset": "Looks as if the content on the inside of the border is coming out of the canvas.", "ridge": "Looks as if it were coming out of the canvas.", "solid": "A single line segment." }; var lineWidthKeywords = ["medium", "thick", "thin"]; var boxKeywords = { "border-box": "The background is painted within (clipped to) the border box.", "content-box": "The background is painted within (clipped to) the content box.", "padding-box": "The background is painted within (clipped to) the padding box." }; var geometryBoxKeywords = { "margin-box": "Uses the margin box as reference box.", "fill-box": "Uses the object bounding box as reference box.", "stroke-box": "Uses the stroke bounding box as reference box.", "view-box": "Uses the nearest SVG viewport as reference box." }; var cssWideKeywords = { "initial": "Represents the value specified as the property\u2019s initial value.", "inherit": "Represents the computed value of the property on the element\u2019s parent.", "unset": "Acts as either `inherit` or `initial`, depending on whether the property is inherited or not." }; var cssWideFunctions = { "var()": "Evaluates the value of a custom variable.", "calc()": "Evaluates an mathematical expression. The following operators can be used: + - * /." }; var imageFunctions = { "url()": "Reference an image file by URL", "image()": "Provide image fallbacks and annotations.", "-webkit-image-set()": "Provide multiple resolutions. Remember to use unprefixed image-set() in addition.", "image-set()": "Provide multiple resolutions of an image and const the UA decide which is most appropriate in a given situation.", "-moz-element()": "Use an element in the document as an image. Remember to use unprefixed element() in addition.", "element()": "Use an element in the document as an image.", "cross-fade()": "Indicates the two images to be combined and how far along in the transition the combination is.", "-webkit-gradient()": "Deprecated. Use modern linear-gradient() or radial-gradient() instead.", "-webkit-linear-gradient()": "Linear gradient. Remember to use unprefixed version in addition.", "-moz-linear-gradient()": "Linear gradient. Remember to use unprefixed version in addition.", "-o-linear-gradient()": "Linear gradient. Remember to use unprefixed version in addition.", "linear-gradient()": "A linear gradient is created by specifying a straight gradient line, and then several colors placed along that line.", "-webkit-repeating-linear-gradient()": "Repeating Linear gradient. Remember to use unprefixed version in addition.", "-moz-repeating-linear-gradient()": "Repeating Linear gradient. Remember to use unprefixed version in addition.", "-o-repeating-linear-gradient()": "Repeating Linear gradient. Remember to use unprefixed version in addition.", "repeating-linear-gradient()": "Same as linear-gradient, except the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last specified color-stop\u2019s position and the first specified color-stop\u2019s position.", "-webkit-radial-gradient()": "Radial gradient. Remember to use unprefixed version in addition.", "-moz-radial-gradient()": "Radial gradient. Remember to use unprefixed version in addition.", "radial-gradient()": "Colors emerge from a single point and smoothly spread outward in a circular or elliptical shape.", "-webkit-repeating-radial-gradient()": "Repeating radial gradient. Remember to use unprefixed version in addition.", "-moz-repeating-radial-gradient()": "Repeating radial gradient. Remember to use unprefixed version in addition.", "repeating-radial-gradient()": "Same as radial-gradient, except the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last specified color-stop\u2019s position and the first specified color-stop\u2019s position." }; var transitionTimingFunctions = { "ease": "Equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0).", "ease-in": "Equivalent to cubic-bezier(0.42, 0, 1.0, 1.0).", "ease-in-out": "Equivalent to cubic-bezier(0.42, 0, 0.58, 1.0).", "ease-out": "Equivalent to cubic-bezier(0, 0, 0.58, 1.0).", "linear": "Equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0).", "step-end": "Equivalent to steps(1, end).", "step-start": "Equivalent to steps(1, start).", "steps()": "The first parameter specifies the number of intervals in the function. The second parameter, which is optional, is either the value \u201Cstart\u201D or \u201Cend\u201D.", "cubic-bezier()": "Specifies a cubic-bezier curve. The four values specify points P1 and P2 of the curve as (x1, y1, x2, y2).", "cubic-bezier(0.6, -0.28, 0.735, 0.045)": "Ease-in Back. Overshoots.", "cubic-bezier(0.68, -0.55, 0.265, 1.55)": "Ease-in-out Back. Overshoots.", "cubic-bezier(0.175, 0.885, 0.32, 1.275)": "Ease-out Back. Overshoots.", "cubic-bezier(0.6, 0.04, 0.98, 0.335)": "Ease-in Circular. Based on half circle.", "cubic-bezier(0.785, 0.135, 0.15, 0.86)": "Ease-in-out Circular. Based on half circle.", "cubic-bezier(0.075, 0.82, 0.165, 1)": "Ease-out Circular. Based on half circle.", "cubic-bezier(0.55, 0.055, 0.675, 0.19)": "Ease-in Cubic. Based on power of three.", "cubic-bezier(0.645, 0.045, 0.355, 1)": "Ease-in-out Cubic. Based on power of three.", "cubic-bezier(0.215, 0.610, 0.355, 1)": "Ease-out Cubic. Based on power of three.", "cubic-bezier(0.95, 0.05, 0.795, 0.035)": "Ease-in Exponential. Based on two to the power ten.", "cubic-bezier(1, 0, 0, 1)": "Ease-in-out Exponential. Based on two to the power ten.", "cubic-bezier(0.19, 1, 0.22, 1)": "Ease-out Exponential. Based on two to the power ten.", "cubic-bezier(0.47, 0, 0.745, 0.715)": "Ease-in Sine.", "cubic-bezier(0.445, 0.05, 0.55, 0.95)": "Ease-in-out Sine.", "cubic-bezier(0.39, 0.575, 0.565, 1)": "Ease-out Sine.", "cubic-bezier(0.55, 0.085, 0.68, 0.53)": "Ease-in Quadratic. Based on power of two.", "cubic-bezier(0.455, 0.03, 0.515, 0.955)": "Ease-in-out Quadratic. Based on power of two.", "cubic-bezier(0.25, 0.46, 0.45, 0.94)": "Ease-out Quadratic. Based on power of two.", "cubic-bezier(0.895, 0.03, 0.685, 0.22)": "Ease-in Quartic. Based on power of four.", "cubic-bezier(0.77, 0, 0.175, 1)": "Ease-in-out Quartic. Based on power of four.", "cubic-bezier(0.165, 0.84, 0.44, 1)": "Ease-out Quartic. Based on power of four.", "cubic-bezier(0.755, 0.05, 0.855, 0.06)": "Ease-in Quintic. Based on power of five.", "cubic-bezier(0.86, 0, 0.07, 1)": "Ease-in-out Quintic. Based on power of five.", "cubic-bezier(0.23, 1, 0.320, 1)": "Ease-out Quintic. Based on power of five." }; var basicShapeFunctions = { "circle()": "Defines a circle.", "ellipse()": "Defines an ellipse.", "inset()": "Defines an inset rectangle.", "polygon()": "Defines a polygon." }; var units = { "length": ["cap", "ch", "cm", "cqb", "cqh", "cqi", "cqmax", "cqmin", "cqw", "dvb", "dvh", "dvi", "dvw", "em", "ex", "ic", "in", "lh", "lvb", "lvh", "lvi", "lvw", "mm", "pc", "pt", "px", "q", "rcap", "rch", "rem", "rex", "ric", "rlh", "svb", "svh", "svi", "svw", "vb", "vh", "vi", "vmax", "vmin", "vw"], "angle": ["deg", "rad", "grad", "turn"], "time": ["ms", "s"], "frequency": ["Hz", "kHz"], "resolution": ["dpi", "dpcm", "dppx"], "percentage": ["%", "fr"] }; var html5Tags = [ "a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "const", "video", "wbr" ]; var svgElements = [ "circle", "clipPath", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "foreignObject", "g", "hatch", "hatchpath", "image", "line", "linearGradient", "marker", "mask", "mesh", "meshpatch", "meshrow", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "set", "solidcolor", "stop", "svg", "switch", "symbol", "text", "textPath", "tspan", "use", "view" ]; var pageBoxDirectives = [ "@bottom-center", "@bottom-left", "@bottom-left-corner", "@bottom-right", "@bottom-right-corner", "@left-bottom", "@left-middle", "@left-top", "@right-bottom", "@right-middle", "@right-top", "@top-center", "@top-left", "@top-left-corner", "@top-right", "@top-right-corner" ]; // node_modules/vscode-css-languageservice/lib/esm/utils/objects.js function values(obj) { return Object.keys(obj).map((key) => obj[key]); } function isDefined(obj) { return typeof obj !== "undefined"; } // node_modules/vscode-css-languageservice/lib/esm/parser/cssParser.js var Parser = class { constructor(scnr = new Scanner()) { this.keyframeRegex = /^@(\-(webkit|ms|moz|o)\-)?keyframes$/i; this.scanner = scnr; this.token = { type: TokenType.EOF, offset: -1, len: 0, text: "" }; this.prevToken = void 0; } peekIdent(text) { return TokenType.Ident === this.token.type && text.length === this.token.text.length && text === this.token.text.toLowerCase(); } peekKeyword(text) { return TokenType.AtKeyword === this.token.type && text.length === this.token.text.length && text === this.token.text.toLowerCase(); } peekDelim(text) { return TokenType.Delim === this.token.type && text === this.token.text; } peek(type) { return type === this.token.type; } peekOne(...types) { return types.indexOf(this.token.type) !== -1; } peekRegExp(type, regEx) { if (type !== this.token.type) { return false; } return regEx.test(this.token.text); } hasWhitespace() { return !!this.prevToken && this.prevToken.offset + this.prevToken.len !== this.token.offset; } consumeToken() { this.prevToken = this.token; this.token = this.scanner.scan(); } acceptUnicodeRange() { const token = this.scanner.tryScanUnicode(); if (token) { this.prevToken = token; this.token = this.scanner.scan(); return true; } return false; } mark() { return { prev: this.prevToken, curr: this.token, pos: this.scanner.pos() }; } restoreAtMark(mark) { this.prevToken = mark.prev; this.token = mark.curr; this.scanner.goBackTo(mark.pos); } try(func) { const pos = this.mark(); const node = func(); if (!node) { this.restoreAtMark(pos); return null; } return node; } acceptOneKeyword(keywords) { if (TokenType.AtKeyword === this.token.type) { for (const keyword of keywords) { if (keyword.length === this.token.text.length && keyword === this.token.text.toLowerCase()) { this.consumeToken(); return true; } } } return false; } accept(type) { if (type === this.token.type) { this.consumeToken(); return true; } return false; } acceptIdent(text) { if (this.peekIdent(text)) { this.consumeToken(); return true; } return false; } acceptKeyword(text) { if (this.peekKeyword(text)) { this.consumeToken(); return true; } return false; } acceptDelim(text) { if (this.peekDelim(text)) { this.consumeToken(); return true; } return false; } acceptRegexp(regEx) { if (regEx.test(this.token.text)) { this.consumeToken(); return true; } return false; } _parseRegexp(regEx) { let node = this.createNode(NodeType.Identifier); do { } while (this.acceptRegexp(regEx)); return this.finish(node); } acceptUnquotedString() { const pos = this.scanner.pos(); this.scanner.goBackTo(this.token.offset); const unquoted = this.scanner.scanUnquotedString(); if (unquoted) { this.token = unquoted; this.consumeToken(); return true; } this.scanner.goBackTo(pos); return false; } resync(resyncTokens, resyncStopTokens) { while (true) { if (resyncTokens && resyncTokens.indexOf(this.token.type) !== -1) { this.consumeToken(); return true; } else if (resyncStopTokens && resyncStopTokens.indexOf(this.token.type) !== -1) { return true; } else { if (this.token.type === TokenType.EOF) { return false; } this.token = this.scanner.scan(); } } } createNode(nodeType) { return new Node(this.token.offset, this.token.len, nodeType); } create(ctor) { return new ctor(this.token.offset, this.token.len); } finish(node, error, resyncTokens, resyncStopTokens) { if (!(node instanceof Nodelist)) { if (error) { this.markError(node, error, resyncTokens, resyncStopTokens); } if (this.prevToken) { const prevEnd = this.prevToken.offset + this.prevToken.len; node.length = prevEnd > node.offset ? prevEnd - node.offset : 0; } } return node; } markError(node, error, resyncTokens, resyncStopTokens) { if (this.token !== this.lastErrorToken) { node.addIssue(new Marker(node, error, Level.Error, void 0, this.token.offset, this.token.len)); this.lastErrorToken = this.token; } if (resyncTokens || resyncStopTokens) { this.resync(resyncTokens, resyncStopTokens); } } parseStylesheet(textDocument) { const versionId = textDocument.version; const text = textDocument.getText(); const textProvider = (offset, length) => { if (textDocument.version !== versionId) { throw new Error("Underlying model has changed, AST is no longer valid"); } return text.substr(offset, length); }; return this.internalParse(text, this._parseStylesheet, textProvider); } internalParse(input, parseFunc, textProvider) { this.scanner.setSource(input); this.token = this.scanner.scan(); const node = parseFunc.bind(this)(); if (node) { if (textProvider) { node.textProvider = textProvider; } else { node.textProvider = (offset, length) => { return input.substr(offset, length); }; } } return node; } _parseStylesheet() { const node = this.create(Stylesheet); while (node.addChild(this._parseStylesheetStart())) { } let inRecovery = false; do { let hasMatch = false; do { hasMatch = false; const statement = this._parseStylesheetStatement(); if (statement) { node.addChild(statement); hasMatch = true; inRecovery = false; if (!this.peek(TokenType.EOF) && this._needsSemicolonAfter(statement) && !this.accept(TokenType.SemiColon)) { this.markError(node, ParseError.SemiColonExpected); } } while (this.accept(TokenType.SemiColon) || this.accept(TokenType.CDO) || this.accept(TokenType.CDC)) { hasMatch = true; inRecovery = false; } } while (hasMatch); if (this.peek(TokenType.EOF)) { break; } if (!inRecovery) { if (this.peek(TokenType.AtKeyword)) { this.markError(node, ParseError.UnknownAtRule); } else { this.markError(node, ParseError.RuleOrSelectorExpected); } inRecovery = true; } this.consumeToken(); } while (!this.peek(TokenType.EOF)); return this.finish(node); } _parseStylesheetStart() { return this._parseCharset(); } _parseStylesheetStatement(isNested = false) { if (this.peek(TokenType.AtKeyword)) { return this._parseStylesheetAtStatement(isNested); } return this._parseRuleset(isNested); } _parseStylesheetAtStatement(isNested = false) { return this._parseImport() || this._parseMedia(isNested) || this._parsePage() || this._parseFontFace() || this._parseKeyframe() || this._parseSupports(isNested) || this._parseLayer(isNested) || this._parsePropertyAtRule() || this._parseViewPort() || this._parseNamespace() || this._parseDocument() || this._parseContainer(isNested) || this._parseUnknownAtRule(); } _tryParseRuleset(isNested) { const mark = this.mark(); if (this._parseSelector(isNested)) { while (this.accept(TokenType.Comma) && this._parseSelector(isNested)) { } if (this.accept(TokenType.CurlyL)) { this.restoreAtMark(mark); return this._parseRuleset(isNested); } } this.restoreAtMark(mark); return null; } _parseRuleset(isNested = false) { const node = this.create(RuleSet); const selectors = node.getSelectors(); if (!selectors.addChild(this._parseSelector(isNested))) { return null; } while (this.accept(TokenType.Comma)) { if (!selectors.addChild(this._parseSelector(isNested))) { return this.finish(node, ParseError.SelectorExpected); } } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); } _parseRuleSetDeclarationAtStatement() { return this._parseMedia(true) || this._parseSupports(true) || this._parseLayer(true) || this._parseContainer(true) || this._parseUnknownAtRule(); } _parseRuleSetDeclaration() { if (this.peek(TokenType.AtKeyword)) { return this._parseRuleSetDeclarationAtStatement(); } if (!this.peek(TokenType.Ident)) { return this._parseRuleset(true); } return this._tryParseRuleset(true) || this._parseDeclaration(); } _needsSemicolonAfter(node) { switch (node.type) { case NodeType.Keyframe: case NodeType.ViewPort: case NodeType.Media: case NodeType.Ruleset: case NodeType.Namespace: case NodeType.If: case NodeType.For: case NodeType.Each: case NodeType.While: case NodeType.MixinDeclaration: case NodeType.FunctionDeclaration: case NodeType.MixinContentDeclaration: return false; case NodeType.ExtendsReference: case NodeType.MixinContentReference: case NodeType.ReturnStatement: case NodeType.MediaQuery: case NodeType.Debug: case NodeType.Import: case NodeType.AtApplyRule: case NodeType.CustomPropertyDeclaration: return true; case NodeType.VariableDeclaration: return node.needsSemicolon; case NodeType.MixinReference: return !node.getContent(); case NodeType.Declaration: return !node.getNestedProperties(); } return false; } _parseDeclarations(parseDeclaration) { const node = this.create(Declarations); if (!this.accept(TokenType.CurlyL)) { return null; } let decl = parseDeclaration(); while (node.addChild(decl)) { if (this.peek(TokenType.CurlyR)) { break; } if (this._needsSemicolonAfter(decl) && !this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected, [TokenType.SemiColon, TokenType.CurlyR]); } if (decl && this.prevToken && this.prevToken.type === TokenType.SemiColon) { decl.semicolonPosition = this.prevToken.offset; } while (this.accept(TokenType.SemiColon)) { } decl = parseDeclaration(); } if (!this.accept(TokenType.CurlyR)) { return this.finish(node, ParseError.RightCurlyExpected, [TokenType.CurlyR, TokenType.SemiColon]); } return this.finish(node); } _parseBody(node, parseDeclaration) { if (!node.setDeclarations(this._parseDeclarations(parseDeclaration))) { return this.finish(node, ParseError.LeftCurlyExpected, [TokenType.CurlyR, TokenType.SemiColon]); } return this.finish(node); } _parseSelector(isNested) { const node = this.create(Selector); let hasContent = false; if (isNested) { hasContent = node.addChild(this._parseCombinator()); } while (node.addChild(this._parseSimpleSelector())) { hasContent = true; node.addChild(this._parseCombinator()); } return hasContent ? this.finish(node) : null; } _parseDeclaration(stopTokens) { const customProperty = this._tryParseCustomPropertyDeclaration(stopTokens); if (customProperty) { return customProperty; } const node = this.create(Declaration); if (!node.setProperty(this._parseProperty())) { return null; } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected, [TokenType.Colon], stopTokens || [TokenType.SemiColon]); } if (this.prevToken) { node.colonPosition = this.prevToken.offset; } if (!node.setValue(this._parseExpr())) { return this.finish(node, ParseError.PropertyValueExpected); } node.addChild(this._parsePrio()); if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); } _tryParseCustomPropertyDeclaration(stopTokens) { if (!this.peekRegExp(TokenType.Ident, /^--/)) { return null; } const node = this.create(CustomPropertyDeclaration); if (!node.setProperty(this._parseProperty())) { return null; } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected, [TokenType.Colon]); } if (this.prevToken) { node.colonPosition = this.prevToken.offset; } const mark = this.mark(); if (this.peek(TokenType.CurlyL)) { const propertySet = this.create(CustomPropertySet); const declarations = this._parseDeclarations(this._parseRuleSetDeclaration.bind(this)); if (propertySet.setDeclarations(declarations) && !declarations.isErroneous(true)) { propertySet.addChild(this._parsePrio()); if (this.peek(TokenType.SemiColon)) { this.finish(propertySet); node.setPropertySet(propertySet); node.semicolonPosition = this.token.offset; return this.finish(node); } } this.restoreAtMark(mark); } const expression = this._parseExpr(); if (expression && !expression.isErroneous(true)) { this._parsePrio(); if (this.peekOne(...stopTokens || [], TokenType.SemiColon, TokenType.EOF)) { node.setValue(expression); if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); } } this.restoreAtMark(mark); node.addChild(this._parseCustomPropertyValue(stopTokens)); node.addChild(this._parsePrio()); if (isDefined(node.colonPosition) && this.token.offset === node.colonPosition + 1) { return this.finish(node, ParseError.PropertyValueExpected); } return this.finish(node); } /** * Parse custom property values. * * Based on https://www.w3.org/TR/css-variables/#syntax * * This code is somewhat unusual, as the allowed syntax is incredibly broad, * parsing almost any sequence of tokens, save for a small set of exceptions. * Unbalanced delimitors, invalid tokens, and declaration * terminators like semicolons and !important directives (when not inside * of delimitors). */ _parseCustomPropertyValue(stopTokens = [TokenType.CurlyR]) { const node = this.create(Node); const isTopLevel = () => curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; const onStopToken = () => stopTokens.indexOf(this.token.type) !== -1; let curlyDepth = 0; let parensDepth = 0; let bracketsDepth = 0; done: while (true) { switch (this.token.type) { case TokenType.SemiColon: if (isTopLevel()) { break done; } break; case TokenType.Exclamation: if (isTopLevel()) { break done; } break; case TokenType.CurlyL: curlyDepth++; break; case TokenType.CurlyR: curlyDepth--; if (curlyDepth < 0) { if (onStopToken() && parensDepth === 0 && bracketsDepth === 0) { break done; } return this.finish(node, ParseError.LeftCurlyExpected); } break; case TokenType.ParenthesisL: parensDepth++; break; case TokenType.ParenthesisR: parensDepth--; if (parensDepth < 0) { if (onStopToken() && bracketsDepth === 0 && curlyDepth === 0) { break done; } return this.finish(node, ParseError.LeftParenthesisExpected); } break; case TokenType.BracketL: bracketsDepth++; break; case TokenType.BracketR: bracketsDepth--; if (bracketsDepth < 0) { return this.finish(node, ParseError.LeftSquareBracketExpected); } break; case TokenType.BadString: break done; case TokenType.EOF: let error = ParseError.RightCurlyExpected; if (bracketsDepth > 0) { error = ParseError.RightSquareBracketExpected; } else if (parensDepth > 0) { error = ParseError.RightParenthesisExpected; } return this.finish(node, error); } this.consumeToken(); } return this.finish(node); } _tryToParseDeclaration(stopTokens) { const mark = this.mark(); if (this._parseProperty() && this.accept(TokenType.Colon)) { this.restoreAtMark(mark); return this._parseDeclaration(stopTokens); } this.restoreAtMark(mark); return null; } _parseProperty() { const node = this.create(Property); const mark = this.mark(); if (this.acceptDelim("*") || this.acceptDelim("_")) { if (this.hasWhitespace()) { this.restoreAtMark(mark); return null; } } if (node.setIdentifier(this._parsePropertyIdentifier())) { return this.finish(node); } return null; } _parsePropertyIdentifier() { return this._parseIdent(); } _parseCharset() { if (!this.peek(TokenType.Charset)) { return null; } const node = this.create(Node); this.consumeToken(); if (!this.accept(TokenType.String)) { return this.finish(node, ParseError.IdentifierExpected); } if (!this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); } _parseImport() { if (!this.peekKeyword("@import")) { return null; } const node = this.create(Import); this.consumeToken(); if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIOrStringExpected); } return this._completeParseImport(node); } _completeParseImport(node) { if (this.acceptIdent("layer")) { if (this.accept(TokenType.ParenthesisL)) { if (!node.addChild(this._parseLayerName())) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.SemiColon]); } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.ParenthesisR], []); } } } if (this.acceptIdent("supports")) { if (this.accept(TokenType.ParenthesisL)) { node.addChild(this._tryToParseDeclaration() || this._parseSupportsCondition()); if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.ParenthesisR], []); } } } if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { node.setMedialist(this._parseMediaQueryList()); } return this.finish(node); } _parseNamespace() { if (!this.peekKeyword("@namespace")) { return null; } const node = this.create(Namespace); this.consumeToken(); if (!node.addChild(this._parseURILiteral())) { node.addChild(this._parseIdent()); if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIExpected, [TokenType.SemiColon]); } } if (!this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); } _parseFontFace() { if (!this.peekKeyword("@font-face")) { return null; } const node = this.create(FontFace); this.consumeToken(); return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); } _parseViewPort() { if (!this.peekKeyword("@-ms-viewport") && !this.peekKeyword("@-o-viewport") && !this.peekKeyword("@viewport")) { return null; } const node = this.create(ViewPort); this.consumeToken(); return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); } _parseKeyframe() { if (!this.peekRegExp(TokenType.AtKeyword, this.keyframeRegex)) { return null; } const node = this.create(Keyframe); const atNode = this.create(Node); this.consumeToken(); node.setKeyword(this.finish(atNode)); if (atNode.matches("@-ms-keyframes")) { this.markError(atNode, ParseError.UnknownKeyword); } if (!node.setIdentifier(this._parseKeyframeIdent())) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } return this._parseBody(node, this._parseKeyframeSelector.bind(this)); } _parseKeyframeIdent() { return this._parseIdent([ReferenceType.Keyframe]); } _parseKeyframeSelector() { const node = this.create(KeyframeSelector); let hasContent = false; if (node.addChild(this._parseIdent())) { hasContent = true; } if (this.accept(TokenType.Percentage)) { hasContent = true; } if (!hasContent) { return null; } while (this.accept(TokenType.Comma)) { hasContent = false; if (node.addChild(this._parseIdent())) { hasContent = true; } if (this.accept(TokenType.Percentage)) { hasContent = true; } if (!hasContent) { return this.finish(node, ParseError.PercentageExpected); } } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); } _tryParseKeyframeSelector() { const node = this.create(KeyframeSelector); const pos = this.mark(); let hasContent = false; if (node.addChild(this._parseIdent())) { hasContent = true; } if (this.accept(TokenType.Percentage)) { hasContent = true; } if (!hasContent) { return null; } while (this.accept(TokenType.Comma)) { hasContent = false; if (node.addChild(this._parseIdent())) { hasContent = true; } if (this.accept(TokenType.Percentage)) { hasContent = true; } if (!hasContent) { this.restoreAtMark(pos); return null; } } if (!this.peek(TokenType.CurlyL)) { this.restoreAtMark(pos); return null; } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); } _parsePropertyAtRule() { if (!this.peekKeyword("@property")) { return null; } const node = this.create(PropertyAtRule); this.consumeToken(); if (!this.peekRegExp(TokenType.Ident, /^--/) || !node.setName(this._parseIdent([ReferenceType.Property]))) { return this.finish(node, ParseError.IdentifierExpected); } return this._parseBody(node, this._parseDeclaration.bind(this)); } _parseLayer(isNested = false) { if (!this.peekKeyword("@layer")) { return null; } const node = this.create(Layer); this.consumeToken(); const names = this._parseLayerNameList(); if (names) { node.setNames(names); } if ((!names || names.getChildren().length === 1) && this.peek(TokenType.CurlyL)) { return this._parseBody(node, this._parseLayerDeclaration.bind(this, isNested)); } if (!this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); } _parseLayerDeclaration(isNested = false) { if (isNested) { return this._tryParseRuleset(true) || this._tryToParseDeclaration() || this._parseStylesheetStatement(true); } return this._parseStylesheetStatement(false); } _parseLayerNameList() { const node = this.createNode(NodeType.LayerNameList); if (!node.addChild(this._parseLayerName())) { return null; } while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parseLayerName())) { return this.finish(node, ParseError.IdentifierExpected); } } return this.finish(node); } _parseLayerName() { const node = this.createNode(NodeType.LayerName); if (!node.addChild(this._parseIdent())) { return null; } while (!this.hasWhitespace() && this.acceptDelim(".")) { if (this.hasWhitespace() || !node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } } return this.finish(node); } _parseSupports(isNested = false) { if (!this.peekKeyword("@supports")) { return null; } const node = this.create(Supports); this.consumeToken(); node.addChild(this._parseSupportsCondition()); return this._parseBody(node, this._parseSupportsDeclaration.bind(this, isNested)); } _parseSupportsDeclaration(isNested = false) { if (isNested) { return this._tryParseRuleset(true) || this._tryToParseDeclaration() || this._parseStylesheetStatement(true); } return this._parseStylesheetStatement(false); } _parseSupportsCondition() { const node = this.create(SupportsCondition); if (this.acceptIdent("not")) { node.addChild(this._parseSupportsConditionInParens()); } else { node.addChild(this._parseSupportsConditionInParens()); if (this.peekRegExp(TokenType.Ident, /^(and|or)$/i)) { const text = this.token.text.toLowerCase(); while (this.acceptIdent(text)) { node.addChild(this._parseSupportsConditionInParens()); } } } return this.finish(node); } _parseSupportsConditionInParens() { const node = this.create(SupportsCondition); if (this.accept(TokenType.ParenthesisL)) { if (this.prevToken) { node.lParent = this.prevToken.offset; } if (!node.addChild(this._tryToParseDeclaration([TokenType.ParenthesisR]))) { if (!this._parseSupportsCondition()) { return this.finish(node, ParseError.ConditionExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.ParenthesisR], []); } if (this.prevToken) { node.rParent = this.prevToken.offset; } return this.finish(node); } else if (this.peek(TokenType.Ident)) { const pos = this.mark(); this.consumeToken(); if (!this.hasWhitespace() && this.accept(TokenType.ParenthesisL)) { let openParentCount = 1; while (this.token.type !== TokenType.EOF && openParentCount !== 0) { if (this.token.type === TokenType.ParenthesisL) { openParentCount++; } else if (this.token.type === TokenType.ParenthesisR) { openParentCount--; } this.consumeToken(); } return this.finish(node); } else { this.restoreAtMark(pos); } } return this.finish(node, ParseError.LeftParenthesisExpected, [], [TokenType.ParenthesisL]); } _parseMediaDeclaration(isNested = false) { if (isNested) { return this._tryParseRuleset(true) || this._tryToParseDeclaration() || this._parseStylesheetStatement(true); } return this._parseStylesheetStatement(false); } _parseMedia(isNested = false) { if (!this.peekKeyword("@media")) { return null; } const node = this.create(Media); this.consumeToken(); if (!node.addChild(this._parseMediaQueryList())) { return this.finish(node, ParseError.MediaQueryExpected); } return this._parseBody(node, this._parseMediaDeclaration.bind(this, isNested)); } _parseMediaQueryList() { const node = this.create(Medialist); if (!node.addChild(this._parseMediaQuery())) { return this.finish(node, ParseError.MediaQueryExpected); } while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parseMediaQuery())) { return this.finish(node, ParseError.MediaQueryExpected); } } return this.finish(node); } _parseMediaQuery() { const node = this.create(MediaQuery); const pos = this.mark(); this.acceptIdent("not"); if (!this.peek(TokenType.ParenthesisL)) { if (this.acceptIdent("only")) { } if (!node.addChild(this._parseIdent())) { return null; } if (this.acceptIdent("and")) { node.addChild(this._parseMediaCondition()); } } else { this.restoreAtMark(pos); node.addChild(this._parseMediaCondition()); } return this.finish(node); } _parseRatio() { const pos = this.mark(); const node = this.create(RatioValue); if (!this._parseNumeric()) { return null; } if (!this.acceptDelim("/")) { this.restoreAtMark(pos); return null; } if (!this._parseNumeric()) { return this.finish(node, ParseError.NumberExpected); } return this.finish(node); } _parseMediaCondition() { const node = this.create(MediaCondition); this.acceptIdent("not"); let parseExpression = true; while (parseExpression) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [], [TokenType.CurlyL]); } if (this.peek(TokenType.ParenthesisL) || this.peekIdent("not")) { node.addChild(this._parseMediaCondition()); } else { node.addChild(this._parseMediaFeature()); } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [], [TokenType.CurlyL]); } parseExpression = this.acceptIdent("and") || this.acceptIdent("or"); } return this.finish(node); } _parseMediaFeature() { const resyncStopToken = [TokenType.ParenthesisR]; const node = this.create(MediaFeature); if (node.addChild(this._parseMediaFeatureName())) { if (this.accept(TokenType.Colon)) { if (!node.addChild(this._parseMediaFeatureValue())) { return this.finish(node, ParseError.TermExpected, [], resyncStopToken); } } else if (this._parseMediaFeatureRangeOperator()) { if (!node.addChild(this._parseMediaFeatureValue())) { return this.finish(node, ParseError.TermExpected, [], resyncStopToken); } if (this._parseMediaFeatureRangeOperator()) { if (!node.addChild(this._parseMediaFeatureValue())) { return this.finish(node, ParseError.TermExpected, [], resyncStopToken); } } } else { } } else if (node.addChild(this._parseMediaFeatureValue())) { if (!this._parseMediaFeatureRangeOperator()) { return this.finish(node, ParseError.OperatorExpected, [], resyncStopToken); } if (!node.addChild(this._parseMediaFeatureName())) { return this.finish(node, ParseError.IdentifierExpected, [], resyncStopToken); } if (this._parseMediaFeatureRangeOperator()) { if (!node.addChild(this._parseMediaFeatureValue())) { return this.finish(node, ParseError.TermExpected, [], resyncStopToken); } } } else { return this.finish(node, ParseError.IdentifierExpected, [], resyncStopToken); } return this.finish(node); } _parseMediaFeatureRangeOperator() { if (this.acceptDelim("<") || this.acceptDelim(">")) { if (!this.hasWhitespace()) { this.acceptDelim("="); } return true; } else if (this.acceptDelim("=")) { return true; } return false; } _parseMediaFeatureName() { return this._parseIdent(); } _parseMediaFeatureValue() { return this._parseRatio() || this._parseTermExpression(); } _parseMedium() { const node = this.create(Node); if (node.addChild(this._parseIdent())) { return this.finish(node); } else { return null; } } _parsePageDeclaration() { return this._parsePageMarginBox() || this._parseRuleSetDeclaration(); } _parsePage() { if (!this.peekKeyword("@page")) { return null; } const node = this.create(Page); this.consumeToken(); if (node.addChild(this._parsePageSelector())) { while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parsePageSelector())) { return this.finish(node, ParseError.IdentifierExpected); } } } return this._parseBody(node, this._parsePageDeclaration.bind(this)); } _parsePageMarginBox() { if (!this.peek(TokenType.AtKeyword)) { return null; } const node = this.create(PageBoxMarginBox); if (!this.acceptOneKeyword(pageBoxDirectives)) { this.markError(node, ParseError.UnknownAtRule, [], [TokenType.CurlyL]); } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); } _parsePageSelector() { if (!this.peek(TokenType.Ident) && !this.peek(TokenType.Colon)) { return null; } const node = this.create(Node); node.addChild(this._parseIdent()); if (this.accept(TokenType.Colon)) { if (!node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } } return this.finish(node); } _parseDocument() { if (!this.peekKeyword("@-moz-document")) { return null; } const node = this.create(Document); this.consumeToken(); this.resync([], [TokenType.CurlyL]); return this._parseBody(node, this._parseStylesheetStatement.bind(this)); } _parseContainerDeclaration(isNested = false) { if (isNested) { return this._tryParseRuleset(true) || this._tryToParseDeclaration() || this._parseStylesheetStatement(true); } return this._parseStylesheetStatement(false); } _parseContainer(isNested = false) { if (!this.peekKeyword("@container")) { return null; } const node = this.create(Container); this.consumeToken(); node.addChild(this._parseIdent()); node.addChild(this._parseContainerQuery()); return this._parseBody(node, this._parseContainerDeclaration.bind(this, isNested)); } _parseContainerQuery() { const node = this.create(Node); if (this.acceptIdent("not")) { node.addChild(this._parseContainerQueryInParens()); } else { node.addChild(this._parseContainerQueryInParens()); if (this.peekIdent("and")) { while (this.acceptIdent("and")) { node.addChild(this._parseContainerQueryInParens()); } } else if (this.peekIdent("or")) { while (this.acceptIdent("or")) { node.addChild(this._parseContainerQueryInParens()); } } } return this.finish(node); } _parseContainerQueryInParens() { const node = this.create(Node); if (this.accept(TokenType.ParenthesisL)) { if (this.peekIdent("not") || this.peek(TokenType.ParenthesisL)) { node.addChild(this._parseContainerQuery()); } else { node.addChild(this._parseMediaFeature()); } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [], [TokenType.CurlyL]); } } else if (this.acceptIdent("style")) { if (this.hasWhitespace() || !this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [], [TokenType.CurlyL]); } node.addChild(this._parseStyleQuery()); if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [], [TokenType.CurlyL]); } } else { return this.finish(node, ParseError.LeftParenthesisExpected, [], [TokenType.CurlyL]); } return this.finish(node); } _parseStyleQuery() { const node = this.create(Node); if (this.acceptIdent("not")) { node.addChild(this._parseStyleInParens()); } else if (this.peek(TokenType.ParenthesisL)) { node.addChild(this._parseStyleInParens()); if (this.peekIdent("and")) { while (this.acceptIdent("and")) { node.addChild(this._parseStyleInParens()); } } else if (this.peekIdent("or")) { while (this.acceptIdent("or")) { node.addChild(this._parseStyleInParens()); } } } else { node.addChild(this._parseDeclaration([TokenType.ParenthesisR])); } return this.finish(node); } _parseStyleInParens() { const node = this.create(Node); if (this.accept(TokenType.ParenthesisL)) { node.addChild(this._parseStyleQuery()); if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [], [TokenType.CurlyL]); } } else { return this.finish(node, ParseError.LeftParenthesisExpected, [], [TokenType.CurlyL]); } return this.finish(node); } // https://www.w3.org/TR/css-syntax-3/#consume-an-at-rule _parseUnknownAtRule() { if (!this.peek(TokenType.AtKeyword)) { return null; } const node = this.create(UnknownAtRule); node.addChild(this._parseUnknownAtRuleName()); const isTopLevel = () => curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; let curlyLCount = 0; let curlyDepth = 0; let parensDepth = 0; let bracketsDepth = 0; done: while (true) { switch (this.token.type) { case TokenType.SemiColon: if (isTopLevel()) { break done; } break; case TokenType.EOF: if (curlyDepth > 0) { return this.finish(node, ParseError.RightCurlyExpected); } else if (bracketsDepth > 0) { return this.finish(node, ParseError.RightSquareBracketExpected); } else if (parensDepth > 0) { return this.finish(node, ParseError.RightParenthesisExpected); } else { return this.finish(node); } case TokenType.CurlyL: curlyLCount++; curlyDepth++; break; case TokenType.CurlyR: curlyDepth--; if (curlyLCount > 0 && curlyDepth === 0) { this.consumeToken(); if (bracketsDepth > 0) { return this.finish(node, ParseError.RightSquareBracketExpected); } else if (parensDepth > 0) { return this.finish(node, ParseError.RightParenthesisExpected); } break done; } if (curlyDepth < 0) { if (parensDepth === 0 && bracketsDepth === 0) { break done; } return this.finish(node, ParseError.LeftCurlyExpected); } break; case TokenType.ParenthesisL: parensDepth++; break; case TokenType.ParenthesisR: parensDepth--; if (parensDepth < 0) { return this.finish(node, ParseError.LeftParenthesisExpected); } break; case TokenType.BracketL: bracketsDepth++; break; case TokenType.BracketR: bracketsDepth--; if (bracketsDepth < 0) { return this.finish(node, ParseError.LeftSquareBracketExpected); } break; } this.consumeToken(); } return node; } _parseUnknownAtRuleName() { const node = this.create(Node); if (this.accept(TokenType.AtKeyword)) { return this.finish(node); } return node; } _parseOperator() { if (this.peekDelim("/") || this.peekDelim("*") || this.peekDelim("+") || this.peekDelim("-") || this.peek(TokenType.Dashmatch) || this.peek(TokenType.Includes) || this.peek(TokenType.SubstringOperator) || this.peek(TokenType.PrefixOperator) || this.peek(TokenType.SuffixOperator) || this.peekDelim("=")) { const node = this.createNode(NodeType.Operator); this.consumeToken(); return this.finish(node); } else { return null; } } _parseUnaryOperator() { if (!this.peekDelim("+") && !this.peekDelim("-")) { return null; } const node = this.create(Node); this.consumeToken(); return this.finish(node); } _parseCombinator() { if (this.peekDelim(">")) { const node = this.create(Node); this.consumeToken(); const mark = this.mark(); if (!this.hasWhitespace() && this.acceptDelim(">")) { if (!this.hasWhitespace() && this.acceptDelim(">")) { node.type = NodeType.SelectorCombinatorShadowPiercingDescendant; return this.finish(node); } this.restoreAtMark(mark); } node.type = NodeType.SelectorCombinatorParent; return this.finish(node); } else if (this.peekDelim("+")) { const node = this.create(Node); this.consumeToken(); node.type = NodeType.SelectorCombinatorSibling; return this.finish(node); } else if (this.peekDelim("~")) { const node = this.create(Node); this.consumeToken(); node.type = NodeType.SelectorCombinatorAllSiblings; return this.finish(node); } else if (this.peekDelim("/")) { const node = this.create(Node); this.consumeToken(); const mark = this.mark(); if (!this.hasWhitespace() && this.acceptIdent("deep") && !this.hasWhitespace() && this.acceptDelim("/")) { node.type = NodeType.SelectorCombinatorShadowPiercingDescendant; return this.finish(node); } this.restoreAtMark(mark); } return null; } _parseSimpleSelector() { const node = this.create(SimpleSelector); let c = 0; if (node.addChild(this._parseElementName() || this._parseNestingSelector())) { c++; } while ((c === 0 || !this.hasWhitespace()) && node.addChild(this._parseSimpleSelectorBody())) { c++; } return c > 0 ? this.finish(node) : null; } _parseNestingSelector() { if (this.peekDelim("&")) { const node = this.createNode(NodeType.SelectorCombinator); this.consumeToken(); return this.finish(node); } return null; } _parseSimpleSelectorBody() { return this._parsePseudo() || this._parseHash() || this._parseClass() || this._parseAttrib(); } _parseSelectorIdent() { return this._parseIdent(); } _parseHash() { if (!this.peek(TokenType.Hash) && !this.peekDelim("#")) { return null; } const node = this.createNode(NodeType.IdentifierSelector); if (this.acceptDelim("#")) { if (this.hasWhitespace() || !node.addChild(this._parseSelectorIdent())) { return this.finish(node, ParseError.IdentifierExpected); } } else { this.consumeToken(); } return this.finish(node); } _parseClass() { if (!this.peekDelim(".")) { return null; } const node = this.createNode(NodeType.ClassSelector); this.consumeToken(); if (this.hasWhitespace() || !node.addChild(this._parseSelectorIdent())) { return this.finish(node, ParseError.IdentifierExpected); } return this.finish(node); } _parseElementName() { const pos = this.mark(); const node = this.createNode(NodeType.ElementNameSelector); node.addChild(this._parseNamespacePrefix()); if (!node.addChild(this._parseSelectorIdent()) && !this.acceptDelim("*")) { this.restoreAtMark(pos); return null; } return this.finish(node); } _parseNamespacePrefix() { const pos = this.mark(); const node = this.createNode(NodeType.NamespacePrefix); if (!node.addChild(this._parseIdent()) && !this.acceptDelim("*")) { } if (!this.acceptDelim("|")) { this.restoreAtMark(pos); return null; } return this.finish(node); } _parseAttrib() { if (!this.peek(TokenType.BracketL)) { return null; } const node = this.create(AttributeSelector); this.consumeToken(); node.setNamespacePrefix(this._parseNamespacePrefix()); if (!node.setIdentifier(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } if (node.setOperator(this._parseOperator())) { node.setValue(this._parseBinaryExpr()); this.acceptIdent("i"); this.acceptIdent("s"); } if (!this.accept(TokenType.BracketR)) { return this.finish(node, ParseError.RightSquareBracketExpected); } return this.finish(node); } _parsePseudo() { const node = this._tryParsePseudoIdentifier(); if (node) { if (!this.hasWhitespace() && this.accept(TokenType.ParenthesisL)) { const tryAsSelector = () => { const selectors = this.create(Node); if (!selectors.addChild(this._parseSelector(true))) { return null; } while (this.accept(TokenType.Comma) && selectors.addChild(this._parseSelector(true))) { } if (this.peek(TokenType.ParenthesisR)) { return this.finish(selectors); } return null; }; let hasSelector = node.addChild(this.try(tryAsSelector)); if (!hasSelector) { if (node.addChild(this._parseBinaryExpr()) && this.acceptIdent("of") && !node.addChild(this.try(tryAsSelector))) { return this.finish(node, ParseError.SelectorExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } return this.finish(node); } return null; } _tryParsePseudoIdentifier() { if (!this.peek(TokenType.Colon)) { return null; } const pos = this.mark(); const node = this.createNode(NodeType.PseudoSelector); this.consumeToken(); if (this.hasWhitespace()) { this.restoreAtMark(pos); return null; } this.accept(TokenType.Colon); if (this.hasWhitespace() || !node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } return this.finish(node); } _tryParsePrio() { const mark = this.mark(); const prio = this._parsePrio(); if (prio) { return prio; } this.restoreAtMark(mark); return null; } _parsePrio() { if (!this.peek(TokenType.Exclamation)) { return null; } const node = this.createNode(NodeType.Prio); if (this.accept(TokenType.Exclamation) && this.acceptIdent("important")) { return this.finish(node); } return null; } _parseExpr(stopOnComma = false) { const node = this.create(Expression); if (!node.addChild(this._parseBinaryExpr())) { return null; } while (true) { if (this.peek(TokenType.Comma)) { if (stopOnComma) { return this.finish(node); } this.consumeToken(); } if (!node.addChild(this._parseBinaryExpr())) { break; } } return this.finish(node); } _parseUnicodeRange() { if (!this.peekIdent("u")) { return null; } const node = this.create(UnicodeRange); if (!this.acceptUnicodeRange()) { return null; } return this.finish(node); } _parseNamedLine() { if (!this.peek(TokenType.BracketL)) { return null; } const node = this.createNode(NodeType.GridLine); this.consumeToken(); while (node.addChild(this._parseIdent())) { } if (!this.accept(TokenType.BracketR)) { return this.finish(node, ParseError.RightSquareBracketExpected); } return this.finish(node); } _parseBinaryExpr(preparsedLeft, preparsedOper) { let node = this.create(BinaryExpression); if (!node.setLeft(preparsedLeft || this._parseTerm())) { return null; } if (!node.setOperator(preparsedOper || this._parseOperator())) { return this.finish(node); } if (!node.setRight(this._parseTerm())) { return this.finish(node, ParseError.TermExpected); } node = this.finish(node); const operator = this._parseOperator(); if (operator) { node = this._parseBinaryExpr(node, operator); } return this.finish(node); } _parseTerm() { let node = this.create(Term); node.setOperator(this._parseUnaryOperator()); if (node.setExpression(this._parseTermExpression())) { return this.finish(node); } return null; } _parseTermExpression() { return this._parseURILiteral() || // url before function this._parseUnicodeRange() || this._parseFunction() || // function before ident this._parseIdent() || this._parseStringLiteral() || this._parseNumeric() || this._parseHexColor() || this._parseOperation() || this._parseNamedLine(); } _parseOperation() { if (!this.peek(TokenType.ParenthesisL)) { return null; } const node = this.create(Node); this.consumeToken(); node.addChild(this._parseExpr()); if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); } _parseNumeric() { if (this.peek(TokenType.Num) || this.peek(TokenType.Percentage) || this.peek(TokenType.Resolution) || this.peek(TokenType.Length) || this.peek(TokenType.EMS) || this.peek(TokenType.EXS) || this.peek(TokenType.Angle) || this.peek(TokenType.Time) || this.peek(TokenType.Dimension) || this.peek(TokenType.ContainerQueryLength) || this.peek(TokenType.Freq)) { const node = this.create(NumericValue); this.consumeToken(); return this.finish(node); } return null; } _parseStringLiteral() { if (!this.peek(TokenType.String) && !this.peek(TokenType.BadString)) { return null; } const node = this.createNode(NodeType.StringLiteral); this.consumeToken(); return this.finish(node); } _parseURILiteral() { if (!this.peekRegExp(TokenType.Ident, /^url(-prefix)?$/i)) { return null; } const pos = this.mark(); const node = this.createNode(NodeType.URILiteral); this.accept(TokenType.Ident); if (this.hasWhitespace() || !this.peek(TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } this.scanner.inURL = true; this.consumeToken(); node.addChild(this._parseURLArgument()); this.scanner.inURL = false; if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); } _parseURLArgument() { const node = this.create(Node); if (!this.accept(TokenType.String) && !this.accept(TokenType.BadString) && !this.acceptUnquotedString()) { return null; } return this.finish(node); } _parseIdent(referenceTypes) { if (!this.peek(TokenType.Ident)) { return null; } const node = this.create(Identifier); if (referenceTypes) { node.referenceTypes = referenceTypes; } node.isCustomProperty = this.peekRegExp(TokenType.Ident, /^--/); this.consumeToken(); return this.finish(node); } _parseFunction() { const pos = this.mark(); const node = this.create(Function); if (!node.setIdentifier(this._parseFunctionIdentifier())) { return null; } if (this.hasWhitespace() || !this.accept(TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } if (node.getArguments().addChild(this._parseFunctionArgument())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseFunctionArgument())) { this.markError(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); } _parseFunctionIdentifier() { if (!this.peek(TokenType.Ident)) { return null; } const node = this.create(Identifier); node.referenceTypes = [ReferenceType.Function]; if (this.acceptIdent("progid")) { if (this.accept(TokenType.Colon)) { while (this.accept(TokenType.Ident) && this.acceptDelim(".")) { } } return this.finish(node); } this.consumeToken(); return this.finish(node); } _parseFunctionArgument() { const node = this.create(FunctionArgument); if (node.setValue(this._parseExpr(true))) { return this.finish(node); } return null; } _parseHexColor() { if (this.peekRegExp(TokenType.Hash, /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/g)) { const node = this.create(HexColorValue); this.consumeToken(); return this.finish(node); } else { return null; } } }; // node_modules/vscode-css-languageservice/lib/esm/utils/arrays.js function findFirst(array, p) { let low = 0, high = array.length; if (high === 0) { return 0; } while (low < high) { let mid = Math.floor((low + high) / 2); if (p(array[mid])) { high = mid; } else { low = mid + 1; } } return low; } function includes(array, item) { return array.indexOf(item) !== -1; } function union(...arrays) { const result = []; for (const array of arrays) { for (const item of array) { if (!includes(result, item)) { result.push(item); } } } return result; } // node_modules/vscode-css-languageservice/lib/esm/parser/cssSymbolScope.js var Scope = class { constructor(offset, length) { this.offset = offset; this.length = length; this.symbols = []; this.parent = null; this.children = []; } addChild(scope) { this.children.push(scope); scope.setParent(this); } setParent(scope) { this.parent = scope; } findScope(offset, length = 0) { if (this.offset <= offset && this.offset + this.length > offset + length || this.offset === offset && this.length === length) { return this.findInScope(offset, length); } return null; } findInScope(offset, length = 0) { const end = offset + length; const idx = findFirst(this.children, (s) => s.offset > end); if (idx === 0) { return this; } const res = this.children[idx - 1]; if (res.offset <= offset && res.offset + res.length >= offset + length) { return res.findInScope(offset, length); } return this; } addSymbol(symbol) { this.symbols.push(symbol); } getSymbol(name, type) { for (let index = 0; index < this.symbols.length; index++) { const symbol = this.symbols[index]; if (symbol.name === name && symbol.type === type) { return symbol; } } return null; } getSymbols() { return this.symbols; } }; var GlobalScope = class extends Scope { constructor() { super(0, Number.MAX_VALUE); } }; var Symbol2 = class { constructor(name, value, node, type) { this.name = name; this.value = value; this.node = node; this.type = type; } }; var ScopeBuilder = class { constructor(scope) { this.scope = scope; } addSymbol(node, name, value, type) { if (node.offset !== -1) { const current = this.scope.findScope(node.offset, node.length); if (current) { current.addSymbol(new Symbol2(name, value, node, type)); } } } addScope(node) { if (node.offset !== -1) { const current = this.scope.findScope(node.offset, node.length); if (current && (current.offset !== node.offset || current.length !== node.length)) { const newScope = new Scope(node.offset, node.length); current.addChild(newScope); return newScope; } return current; } return null; } addSymbolToChildScope(scopeNode, node, name, value, type) { if (scopeNode && scopeNode.offset !== -1) { const current = this.addScope(scopeNode); if (current) { current.addSymbol(new Symbol2(name, value, node, type)); } } } visitNode(node) { switch (node.type) { case NodeType.Keyframe: this.addSymbol(node, node.getName(), void 0, ReferenceType.Keyframe); return true; case NodeType.CustomPropertyDeclaration: return this.visitCustomPropertyDeclarationNode(node); case NodeType.VariableDeclaration: return this.visitVariableDeclarationNode(node); case NodeType.Ruleset: return this.visitRuleSet(node); case NodeType.MixinDeclaration: this.addSymbol(node, node.getName(), void 0, ReferenceType.Mixin); return true; case NodeType.FunctionDeclaration: this.addSymbol(node, node.getName(), void 0, ReferenceType.Function); return true; case NodeType.FunctionParameter: { return this.visitFunctionParameterNode(node); } case NodeType.Declarations: this.addScope(node); return true; case NodeType.For: const forNode = node; const scopeNode = forNode.getDeclarations(); if (scopeNode && forNode.variable) { this.addSymbolToChildScope(scopeNode, forNode.variable, forNode.variable.getName(), void 0, ReferenceType.Variable); } return true; case NodeType.Each: { const eachNode = node; const scopeNode2 = eachNode.getDeclarations(); if (scopeNode2) { const variables = eachNode.getVariables().getChildren(); for (const variable of variables) { this.addSymbolToChildScope(scopeNode2, variable, variable.getName(), void 0, ReferenceType.Variable); } } return true; } } return true; } visitRuleSet(node) { const current = this.scope.findScope(node.offset, node.length); if (current) { for (const child of node.getSelectors().getChildren()) { if (child instanceof Selector) { if (child.getChildren().length === 1) { current.addSymbol(new Symbol2(child.getChild(0).getText(), void 0, child, ReferenceType.Rule)); } } } } return true; } visitVariableDeclarationNode(node) { const value = node.getValue() ? node.getValue().getText() : void 0; this.addSymbol(node, node.getName(), value, ReferenceType.Variable); return true; } visitFunctionParameterNode(node) { const scopeNode = node.getParent().getDeclarations(); if (scopeNode) { const valueNode = node.getDefaultValue(); const value = valueNode ? valueNode.getText() : void 0; this.addSymbolToChildScope(scopeNode, node, node.getName(), value, ReferenceType.Variable); } return true; } visitCustomPropertyDeclarationNode(node) { const value = node.getValue() ? node.getValue().getText() : ""; this.addCSSVariable(node.getProperty(), node.getProperty().getName(), value, ReferenceType.Variable); return true; } addCSSVariable(node, name, value, type) { if (node.offset !== -1) { this.scope.addSymbol(new Symbol2(name, value, node, type)); } } }; var Symbols = class { constructor(node) { this.global = new GlobalScope(); node.acceptVisitor(new ScopeBuilder(this.global)); } findSymbolsAtOffset(offset, referenceType) { let scope = this.global.findScope(offset, 0); const result = []; const names = {}; while (scope) { const symbols = scope.getSymbols(); for (let i = 0; i < symbols.length; i++) { const symbol = symbols[i]; if (symbol.type === referenceType && !names[symbol.name]) { result.push(symbol); names[symbol.name] = true; } } scope = scope.parent; } return result; } internalFindSymbol(node, referenceTypes) { let scopeNode = node; if (node.parent instanceof FunctionParameter && node.parent.getParent() instanceof BodyDeclaration) { scopeNode = node.parent.getParent().getDeclarations(); } if (node.parent instanceof FunctionArgument && node.parent.getParent() instanceof Function) { const funcId = node.parent.getParent().getIdentifier(); if (funcId) { const functionSymbol = this.internalFindSymbol(funcId, [ReferenceType.Function]); if (functionSymbol) { scopeNode = functionSymbol.node.getDeclarations(); } } } if (!scopeNode) { return null; } const name = node.getText(); let scope = this.global.findScope(scopeNode.offset, scopeNode.length); while (scope) { for (let index = 0; index < referenceTypes.length; index++) { const type = referenceTypes[index]; const symbol = scope.getSymbol(name, type); if (symbol) { return symbol; } } scope = scope.parent; } return null; } evaluateReferenceTypes(node) { if (node instanceof Identifier) { const referenceTypes = node.referenceTypes; if (referenceTypes) { return referenceTypes; } else { if (node.isCustomProperty) { return [ReferenceType.Variable]; } const decl = getParentDeclaration(node); if (decl) { const propertyName = decl.getNonPrefixedPropertyName(); if ((propertyName === "animation" || propertyName === "animation-name") && decl.getValue() && decl.getValue().offset === node.offset) { return [ReferenceType.Keyframe]; } } } } else if (node instanceof Variable) { return [ReferenceType.Variable]; } const selector = node.findAParent(NodeType.Selector, NodeType.ExtendsReference); if (selector) { return [ReferenceType.Rule]; } return null; } findSymbolFromNode(node) { if (!node) { return null; } while (node.type === NodeType.Interpolation) { node = node.getParent(); } const referenceTypes = this.evaluateReferenceTypes(node); if (referenceTypes) { return this.internalFindSymbol(node, referenceTypes); } return null; } matchesSymbol(node, symbol) { if (!node) { return false; } while (node.type === NodeType.Interpolation) { node = node.getParent(); } if (!node.matches(symbol.name)) { return false; } const referenceTypes = this.evaluateReferenceTypes(node); if (!referenceTypes || referenceTypes.indexOf(symbol.type) === -1) { return false; } const nodeSymbol = this.internalFindSymbol(node, referenceTypes); return nodeSymbol === symbol; } findSymbol(name, type, offset) { let scope = this.global.findScope(offset); while (scope) { const symbol = scope.getSymbol(name, type); if (symbol) { return symbol; } scope = scope.parent; } return null; } }; // node_modules/vscode-uri/lib/esm/index.mjs var LIB; (() => { "use strict"; var t2 = { 470: (t3) => { function e2(t4) { if ("string" != typeof t4) throw new TypeError("Path must be a string. Received " + JSON.stringify(t4)); } function r2(t4, e3) { for (var r3, n3 = "", i = 0, o = -1, s = 0, h = 0; h <= t4.length; ++h) { if (h < t4.length) r3 = t4.charCodeAt(h); else { if (47 === r3) break; r3 = 47; } if (47 === r3) { if (o === h - 1 || 1 === s) ; else if (o !== h - 1 && 2 === s) { if (n3.length < 2 || 2 !== i || 46 !== n3.charCodeAt(n3.length - 1) || 46 !== n3.charCodeAt(n3.length - 2)) { if (n3.length > 2) { var a2 = n3.lastIndexOf("/"); if (a2 !== n3.length - 1) { -1 === a2 ? (n3 = "", i = 0) : i = (n3 = n3.slice(0, a2)).length - 1 - n3.lastIndexOf("/"), o = h, s = 0; continue; } } else if (2 === n3.length || 1 === n3.length) { n3 = "", i = 0, o = h, s = 0; continue; } } e3 && (n3.length > 0 ? n3 += "/.." : n3 = "..", i = 2); } else n3.length > 0 ? n3 += "/" + t4.slice(o + 1, h) : n3 = t4.slice(o + 1, h), i = h - o - 1; o = h, s = 0; } else 46 === r3 && -1 !== s ? ++s : s = -1; } return n3; } var n2 = { resolve: function() { for (var t4, n3 = "", i = false, o = arguments.length - 1; o >= -1 && !i; o--) { var s; o >= 0 ? s = arguments[o] : (void 0 === t4 && (t4 = process.cwd()), s = t4), e2(s), 0 !== s.length && (n3 = s + "/" + n3, i = 47 === s.charCodeAt(0)); } return n3 = r2(n3, !i), i ? n3.length > 0 ? "/" + n3 : "/" : n3.length > 0 ? n3 : "."; }, normalize: function(t4) { if (e2(t4), 0 === t4.length) return "."; var n3 = 47 === t4.charCodeAt(0), i = 47 === t4.charCodeAt(t4.length - 1); return 0 !== (t4 = r2(t4, !n3)).length || n3 || (t4 = "."), t4.length > 0 && i && (t4 += "/"), n3 ? "/" + t4 : t4; }, isAbsolute: function(t4) { return e2(t4), t4.length > 0 && 47 === t4.charCodeAt(0); }, join: function() { if (0 === arguments.length) return "."; for (var t4, r3 = 0; r3 < arguments.length; ++r3) { var i = arguments[r3]; e2(i), i.length > 0 && (void 0 === t4 ? t4 = i : t4 += "/" + i); } return void 0 === t4 ? "." : n2.normalize(t4); }, relative: function(t4, r3) { if (e2(t4), e2(r3), t4 === r3) return ""; if ((t4 = n2.resolve(t4)) === (r3 = n2.resolve(r3))) return ""; for (var i = 1; i < t4.length && 47 === t4.charCodeAt(i); ++i) ; for (var o = t4.length, s = o - i, h = 1; h < r3.length && 47 === r3.charCodeAt(h); ++h) ; for (var a2 = r3.length - h, c = s < a2 ? s : a2, f2 = -1, u = 0; u <= c; ++u) { if (u === c) { if (a2 > c) { if (47 === r3.charCodeAt(h + u)) return r3.slice(h + u + 1); if (0 === u) return r3.slice(h + u); } else s > c && (47 === t4.charCodeAt(i + u) ? f2 = u : 0 === u && (f2 = 0)); break; } var l = t4.charCodeAt(i + u); if (l !== r3.charCodeAt(h + u)) break; 47 === l && (f2 = u); } var g = ""; for (u = i + f2 + 1; u <= o; ++u) u !== o && 47 !== t4.charCodeAt(u) || (0 === g.length ? g += ".." : g += "/.."); return g.length > 0 ? g + r3.slice(h + f2) : (h += f2, 47 === r3.charCodeAt(h) && ++h, r3.slice(h)); }, _makeLong: function(t4) { return t4; }, dirname: function(t4) { if (e2(t4), 0 === t4.length) return "."; for (var r3 = t4.charCodeAt(0), n3 = 47 === r3, i = -1, o = true, s = t4.length - 1; s >= 1; --s) if (47 === (r3 = t4.charCodeAt(s))) { if (!o) { i = s; break; } } else o = false; return -1 === i ? n3 ? "/" : "." : n3 && 1 === i ? "//" : t4.slice(0, i); }, basename: function(t4, r3) { if (void 0 !== r3 && "string" != typeof r3) throw new TypeError('"ext" argument must be a string'); e2(t4); var n3, i = 0, o = -1, s = true; if (void 0 !== r3 && r3.length > 0 && r3.length <= t4.length) { if (r3.length === t4.length && r3 === t4) return ""; var h = r3.length - 1, a2 = -1; for (n3 = t4.length - 1; n3 >= 0; --n3) { var c = t4.charCodeAt(n3); if (47 === c) { if (!s) { i = n3 + 1; break; } } else -1 === a2 && (s = false, a2 = n3 + 1), h >= 0 && (c === r3.charCodeAt(h) ? -1 == --h && (o = n3) : (h = -1, o = a2)); } return i === o ? o = a2 : -1 === o && (o = t4.length), t4.slice(i, o); } for (n3 = t4.length - 1; n3 >= 0; --n3) if (47 === t4.charCodeAt(n3)) { if (!s) { i = n3 + 1; break; } } else -1 === o && (s = false, o = n3 + 1); return -1 === o ? "" : t4.slice(i, o); }, extname: function(t4) { e2(t4); for (var r3 = -1, n3 = 0, i = -1, o = true, s = 0, h = t4.length - 1; h >= 0; --h) { var a2 = t4.charCodeAt(h); if (47 !== a2) -1 === i && (o = false, i = h + 1), 46 === a2 ? -1 === r3 ? r3 = h : 1 !== s && (s = 1) : -1 !== r3 && (s = -1); else if (!o) { n3 = h + 1; break; } } return -1 === r3 || -1 === i || 0 === s || 1 === s && r3 === i - 1 && r3 === n3 + 1 ? "" : t4.slice(r3, i); }, format: function(t4) { if (null === t4 || "object" != typeof t4) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t4); return function(t5, e3) { var r3 = e3.dir || e3.root, n3 = e3.base || (e3.name || "") + (e3.ext || ""); return r3 ? r3 === e3.root ? r3 + n3 : r3 + "/" + n3 : n3; }(0, t4); }, parse: function(t4) { e2(t4); var r3 = { root: "", dir: "", base: "", ext: "", name: "" }; if (0 === t4.length) return r3; var n3, i = t4.charCodeAt(0), o = 47 === i; o ? (r3.root = "/", n3 = 1) : n3 = 0; for (var s = -1, h = 0, a2 = -1, c = true, f2 = t4.length - 1, u = 0; f2 >= n3; --f2) if (47 !== (i = t4.charCodeAt(f2))) -1 === a2 && (c = false, a2 = f2 + 1), 46 === i ? -1 === s ? s = f2 : 1 !== u && (u = 1) : -1 !== s && (u = -1); else if (!c) { h = f2 + 1; break; } return -1 === s || -1 === a2 || 0 === u || 1 === u && s === a2 - 1 && s === h + 1 ? -1 !== a2 && (r3.base = r3.name = 0 === h && o ? t4.slice(1, a2) : t4.slice(h, a2)) : (0 === h && o ? (r3.name = t4.slice(1, s), r3.base = t4.slice(1, a2)) : (r3.name = t4.slice(h, s), r3.base = t4.slice(h, a2)), r3.ext = t4.slice(s, a2)), h > 0 ? r3.dir = t4.slice(0, h - 1) : o && (r3.dir = "/"), r3; }, sep: "/", delimiter: ":", win32: null, posix: null }; n2.posix = n2, t3.exports = n2; } }, e = {}; function r(n2) { var i = e[n2]; if (void 0 !== i) return i.exports; var o = e[n2] = { exports: {} }; return t2[n2](o, o.exports, r), o.exports; } r.d = (t3, e2) => { for (var n2 in e2) r.o(e2, n2) && !r.o(t3, n2) && Object.defineProperty(t3, n2, { enumerable: true, get: e2[n2] }); }, r.o = (t3, e2) => Object.prototype.hasOwnProperty.call(t3, e2), r.r = (t3) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t3, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t3, "__esModule", { value: true }); }; var n = {}; (() => { let t3; if (r.r(n), r.d(n, { URI: () => f2, Utils: () => P }), "object" == typeof process) t3 = "win32" === process.platform; else if ("object" == typeof navigator) { let e3 = navigator.userAgent; t3 = e3.indexOf("Windows") >= 0; } const e2 = /^\w[\w\d+.-]*$/, i = /^\//, o = /^\/\//; function s(t4, r2) { if (!t4.scheme && r2) throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t4.authority}", path: "${t4.path}", query: "${t4.query}", fragment: "${t4.fragment}"}`); if (t4.scheme && !e2.test(t4.scheme)) throw new Error("[UriError]: Scheme contains illegal characters."); if (t4.path) { if (t4.authority) { if (!i.test(t4.path)) throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character'); } else if (o.test(t4.path)) throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")'); } } const h = "", a2 = "/", c = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; class f2 { static isUri(t4) { return t4 instanceof f2 || !!t4 && "string" == typeof t4.authority && "string" == typeof t4.fragment && "string" == typeof t4.path && "string" == typeof t4.query && "string" == typeof t4.scheme && "string" == typeof t4.fsPath && "function" == typeof t4.with && "function" == typeof t4.toString; } scheme; authority; path; query; fragment; constructor(t4, e3, r2, n2, i2, o2 = false) { "object" == typeof t4 ? (this.scheme = t4.scheme || h, this.authority = t4.authority || h, this.path = t4.path || h, this.query = t4.query || h, this.fragment = t4.fragment || h) : (this.scheme = /* @__PURE__ */ function(t5, e4) { return t5 || e4 ? t5 : "file"; }(t4, o2), this.authority = e3 || h, this.path = function(t5, e4) { switch (t5) { case "https": case "http": case "file": e4 ? e4[0] !== a2 && (e4 = a2 + e4) : e4 = a2; } return e4; }(this.scheme, r2 || h), this.query = n2 || h, this.fragment = i2 || h, s(this, o2)); } get fsPath() { return m(this, false); } with(t4) { if (!t4) return this; let { scheme: e3, authority: r2, path: n2, query: i2, fragment: o2 } = t4; return void 0 === e3 ? e3 = this.scheme : null === e3 && (e3 = h), void 0 === r2 ? r2 = this.authority : null === r2 && (r2 = h), void 0 === n2 ? n2 = this.path : null === n2 && (n2 = h), void 0 === i2 ? i2 = this.query : null === i2 && (i2 = h), void 0 === o2 ? o2 = this.fragment : null === o2 && (o2 = h), e3 === this.scheme && r2 === this.authority && n2 === this.path && i2 === this.query && o2 === this.fragment ? this : new l(e3, r2, n2, i2, o2); } static parse(t4, e3 = false) { const r2 = c.exec(t4); return r2 ? new l(r2[2] || h, C(r2[4] || h), C(r2[5] || h), C(r2[7] || h), C(r2[9] || h), e3) : new l(h, h, h, h, h); } static file(e3) { let r2 = h; if (t3 && (e3 = e3.replace(/\\/g, a2)), e3[0] === a2 && e3[1] === a2) { const t4 = e3.indexOf(a2, 2); -1 === t4 ? (r2 = e3.substring(2), e3 = a2) : (r2 = e3.substring(2, t4), e3 = e3.substring(t4) || a2); } return new l("file", r2, e3, h, h); } static from(t4) { const e3 = new l(t4.scheme, t4.authority, t4.path, t4.query, t4.fragment); return s(e3, true), e3; } toString(t4 = false) { return y(this, t4); } toJSON() { return this; } static revive(t4) { if (t4) { if (t4 instanceof f2) return t4; { const e3 = new l(t4); return e3._formatted = t4.external, e3._fsPath = t4._sep === u ? t4.fsPath : null, e3; } } return t4; } } const u = t3 ? 1 : void 0; class l extends f2 { _formatted = null; _fsPath = null; get fsPath() { return this._fsPath || (this._fsPath = m(this, false)), this._fsPath; } toString(t4 = false) { return t4 ? y(this, true) : (this._formatted || (this._formatted = y(this, false)), this._formatted); } toJSON() { const t4 = { $mid: 1 }; return this._fsPath && (t4.fsPath = this._fsPath, t4._sep = u), this._formatted && (t4.external = this._formatted), this.path && (t4.path = this.path), this.scheme && (t4.scheme = this.scheme), this.authority && (t4.authority = this.authority), this.query && (t4.query = this.query), this.fragment && (t4.fragment = this.fragment), t4; } } const g = { 58: "%3A", 47: "%2F", 63: "%3F", 35: "%23", 91: "%5B", 93: "%5D", 64: "%40", 33: "%21", 36: "%24", 38: "%26", 39: "%27", 40: "%28", 41: "%29", 42: "%2A", 43: "%2B", 44: "%2C", 59: "%3B", 61: "%3D", 32: "%20" }; function d(t4, e3, r2) { let n2, i2 = -1; for (let o2 = 0; o2 < t4.length; o2++) { const s2 = t4.charCodeAt(o2); if (s2 >= 97 && s2 <= 122 || s2 >= 65 && s2 <= 90 || s2 >= 48 && s2 <= 57 || 45 === s2 || 46 === s2 || 95 === s2 || 126 === s2 || e3 && 47 === s2 || r2 && 91 === s2 || r2 && 93 === s2 || r2 && 58 === s2) -1 !== i2 && (n2 += encodeURIComponent(t4.substring(i2, o2)), i2 = -1), void 0 !== n2 && (n2 += t4.charAt(o2)); else { void 0 === n2 && (n2 = t4.substr(0, o2)); const e4 = g[s2]; void 0 !== e4 ? (-1 !== i2 && (n2 += encodeURIComponent(t4.substring(i2, o2)), i2 = -1), n2 += e4) : -1 === i2 && (i2 = o2); } } return -1 !== i2 && (n2 += encodeURIComponent(t4.substring(i2))), void 0 !== n2 ? n2 : t4; } function p(t4) { let e3; for (let r2 = 0; r2 < t4.length; r2++) { const n2 = t4.charCodeAt(r2); 35 === n2 || 63 === n2 ? (void 0 === e3 && (e3 = t4.substr(0, r2)), e3 += g[n2]) : void 0 !== e3 && (e3 += t4[r2]); } return void 0 !== e3 ? e3 : t4; } function m(e3, r2) { let n2; return n2 = e3.authority && e3.path.length > 1 && "file" === e3.scheme ? `//${e3.authority}${e3.path}` : 47 === e3.path.charCodeAt(0) && (e3.path.charCodeAt(1) >= 65 && e3.path.charCodeAt(1) <= 90 || e3.path.charCodeAt(1) >= 97 && e3.path.charCodeAt(1) <= 122) && 58 === e3.path.charCodeAt(2) ? r2 ? e3.path.substr(1) : e3.path[1].toLowerCase() + e3.path.substr(2) : e3.path, t3 && (n2 = n2.replace(/\//g, "\\")), n2; } function y(t4, e3) { const r2 = e3 ? p : d; let n2 = "", { scheme: i2, authority: o2, path: s2, query: h2, fragment: c2 } = t4; if (i2 && (n2 += i2, n2 += ":"), (o2 || "file" === i2) && (n2 += a2, n2 += a2), o2) { let t5 = o2.indexOf("@"); if (-1 !== t5) { const e4 = o2.substr(0, t5); o2 = o2.substr(t5 + 1), t5 = e4.lastIndexOf(":"), -1 === t5 ? n2 += r2(e4, false, false) : (n2 += r2(e4.substr(0, t5), false, false), n2 += ":", n2 += r2(e4.substr(t5 + 1), false, true)), n2 += "@"; } o2 = o2.toLowerCase(), t5 = o2.lastIndexOf(":"), -1 === t5 ? n2 += r2(o2, false, true) : (n2 += r2(o2.substr(0, t5), false, true), n2 += o2.substr(t5)); } if (s2) { if (s2.length >= 3 && 47 === s2.charCodeAt(0) && 58 === s2.charCodeAt(2)) { const t5 = s2.charCodeAt(1); t5 >= 65 && t5 <= 90 && (s2 = `/${String.fromCharCode(t5 + 32)}:${s2.substr(3)}`); } else if (s2.length >= 2 && 58 === s2.charCodeAt(1)) { const t5 = s2.charCodeAt(0); t5 >= 65 && t5 <= 90 && (s2 = `${String.fromCharCode(t5 + 32)}:${s2.substr(2)}`); } n2 += r2(s2, true, false); } return h2 && (n2 += "?", n2 += r2(h2, false, false)), c2 && (n2 += "#", n2 += e3 ? c2 : d(c2, false, false)), n2; } function v(t4) { try { return decodeURIComponent(t4); } catch { return t4.length > 3 ? t4.substr(0, 3) + v(t4.substr(3)) : t4; } } const b = /(%[0-9A-Za-z][0-9A-Za-z])+/g; function C(t4) { return t4.match(b) ? t4.replace(b, (t5) => v(t5)) : t4; } var A2 = r(470); const w = A2.posix || A2, x = "/"; var P; !function(t4) { t4.joinPath = function(t5, ...e3) { return t5.with({ path: w.join(t5.path, ...e3) }); }, t4.resolvePath = function(t5, ...e3) { let r2 = t5.path, n2 = false; r2[0] !== x && (r2 = x + r2, n2 = true); let i2 = w.resolve(r2, ...e3); return n2 && i2[0] === x && !t5.authority && (i2 = i2.substring(1)), t5.with({ path: i2 }); }, t4.dirname = function(t5) { if (0 === t5.path.length || t5.path === x) return t5; let e3 = w.dirname(t5.path); return 1 === e3.length && 46 === e3.charCodeAt(0) && (e3 = ""), t5.with({ path: e3 }); }, t4.basename = function(t5) { return w.basename(t5.path); }, t4.extname = function(t5) { return w.extname(t5.path); }; }(P || (P = {})); })(), LIB = n; })(); var { URI: URI2, Utils } = LIB; // node_modules/vscode-css-languageservice/lib/esm/utils/resources.js function dirname(uriString) { return Utils.dirname(URI2.parse(uriString)).toString(true); } function joinPath(uriString, ...paths) { return Utils.joinPath(URI2.parse(uriString), ...paths).toString(true); } // node_modules/vscode-css-languageservice/lib/esm/services/pathCompletion.js var PathCompletionParticipant = class { constructor(readDirectory) { this.readDirectory = readDirectory; this.literalCompletions = []; this.importCompletions = []; } onCssURILiteralValue(context) { this.literalCompletions.push(context); } onCssImportPath(context) { this.importCompletions.push(context); } async computeCompletions(document, documentContext) { const result = { items: [], isIncomplete: false }; for (const literalCompletion of this.literalCompletions) { const uriValue = literalCompletion.uriValue; const fullValue = stripQuotes(uriValue); if (fullValue === "." || fullValue === "..") { result.isIncomplete = true; } else { const items = await this.providePathSuggestions(uriValue, literalCompletion.position, literalCompletion.range, document, documentContext); for (let item of items) { result.items.push(item); } } } for (const importCompletion of this.importCompletions) { const pathValue = importCompletion.pathValue; const fullValue = stripQuotes(pathValue); if (fullValue === "." || fullValue === "..") { result.isIncomplete = true; } else { let suggestions = await this.providePathSuggestions(pathValue, importCompletion.position, importCompletion.range, document, documentContext); if (document.languageId === "scss") { suggestions.forEach((s) => { if (startsWith(s.label, "_") && endsWith(s.label, ".scss")) { if (s.textEdit) { s.textEdit.newText = s.label.slice(1, -5); } else { s.label = s.label.slice(1, -5); } } }); } for (let item of suggestions) { result.items.push(item); } } } return result; } async providePathSuggestions(pathValue, position, range, document, documentContext) { const fullValue = stripQuotes(pathValue); const isValueQuoted = startsWith(pathValue, `'`) || startsWith(pathValue, `"`); const valueBeforeCursor = isValueQuoted ? fullValue.slice(0, position.character - (range.start.character + 1)) : fullValue.slice(0, position.character - range.start.character); const currentDocUri = document.uri; const fullValueRange = isValueQuoted ? shiftRange(range, 1, -1) : range; const replaceRange = pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange); const valueBeforeLastSlash = valueBeforeCursor.substring(0, valueBeforeCursor.lastIndexOf("/") + 1); let parentDir = documentContext.resolveReference(valueBeforeLastSlash || ".", currentDocUri); if (parentDir) { try { const result = []; const infos = await this.readDirectory(parentDir); for (const [name, type] of infos) { if (name.charCodeAt(0) !== CharCode_dot && (type === FileType.Directory || joinPath(parentDir, name) !== currentDocUri)) { result.push(createCompletionItem(name, type === FileType.Directory, replaceRange)); } } return result; } catch (e) { } } return []; } }; var CharCode_dot = ".".charCodeAt(0); function stripQuotes(fullValue) { if (startsWith(fullValue, `'`) || startsWith(fullValue, `"`)) { return fullValue.slice(1, -1); } else { return fullValue; } } function pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange) { let replaceRange; const lastIndexOfSlash = valueBeforeCursor.lastIndexOf("/"); if (lastIndexOfSlash === -1) { replaceRange = fullValueRange; } else { const valueAfterLastSlash = fullValue.slice(lastIndexOfSlash + 1); const startPos = shiftPosition(fullValueRange.end, -valueAfterLastSlash.length); const whitespaceIndex = valueAfterLastSlash.indexOf(" "); let endPos; if (whitespaceIndex !== -1) { endPos = shiftPosition(startPos, whitespaceIndex); } else { endPos = fullValueRange.end; } replaceRange = Range.create(startPos, endPos); } return replaceRange; } function createCompletionItem(name, isDir, replaceRange) { if (isDir) { name = name + "/"; return { label: escapePath(name), kind: CompletionItemKind.Folder, textEdit: TextEdit.replace(replaceRange, escapePath(name)), command: { title: "Suggest", command: "editor.action.triggerSuggest" } }; } else { return { label: escapePath(name), kind: CompletionItemKind.File, textEdit: TextEdit.replace(replaceRange, escapePath(name)) }; } } function escapePath(p) { return p.replace(/(\s|\(|\)|,|"|')/g, "\\$1"); } function shiftPosition(pos, offset) { return Position.create(pos.line, pos.character + offset); } function shiftRange(range, startOffset, endOffset) { const start = shiftPosition(range.start, startOffset); const end = shiftPosition(range.end, endOffset); return Range.create(start, end); } // node_modules/vscode-css-languageservice/lib/esm/services/cssCompletion.js var SnippetFormat = InsertTextFormat.Snippet; var retriggerCommand = { title: "Suggest", command: "editor.action.triggerSuggest" }; var SortTexts; (function(SortTexts2) { SortTexts2["Enums"] = " "; SortTexts2["Normal"] = "d"; SortTexts2["VendorPrefixed"] = "x"; SortTexts2["Term"] = "y"; SortTexts2["Variable"] = "z"; })(SortTexts || (SortTexts = {})); var CSSCompletion = class { constructor(variablePrefix = null, lsOptions, cssDataManager) { this.variablePrefix = variablePrefix; this.lsOptions = lsOptions; this.cssDataManager = cssDataManager; this.completionParticipants = []; } configure(settings) { this.defaultSettings = settings; } getSymbolContext() { if (!this.symbolContext) { this.symbolContext = new Symbols(this.styleSheet); } return this.symbolContext; } setCompletionParticipants(registeredCompletionParticipants) { this.completionParticipants = registeredCompletionParticipants || []; } async doComplete2(document, position, styleSheet, documentContext, completionSettings = this.defaultSettings) { if (!this.lsOptions.fileSystemProvider || !this.lsOptions.fileSystemProvider.readDirectory) { return this.doComplete(document, position, styleSheet, completionSettings); } const participant = new PathCompletionParticipant(this.lsOptions.fileSystemProvider.readDirectory); const contributedParticipants = this.completionParticipants; this.completionParticipants = [participant].concat(contributedParticipants); const result = this.doComplete(document, position, styleSheet, completionSettings); try { const pathCompletionResult = await participant.computeCompletions(document, documentContext); return { isIncomplete: result.isIncomplete || pathCompletionResult.isIncomplete, itemDefaults: result.itemDefaults, items: pathCompletionResult.items.concat(result.items) }; } finally { this.completionParticipants = contributedParticipants; } } doComplete(document, position, styleSheet, documentSettings) { this.offset = document.offsetAt(position); this.position = position; this.currentWord = getCurrentWord(document, this.offset); this.defaultReplaceRange = Range.create(Position.create(this.position.line, this.position.character - this.currentWord.length), this.position); this.textDocument = document; this.styleSheet = styleSheet; this.documentSettings = documentSettings; try { const result = { isIncomplete: false, itemDefaults: { editRange: { start: { line: position.line, character: position.character - this.currentWord.length }, end: position } }, items: [] }; this.nodePath = getNodePath(this.styleSheet, this.offset); for (let i = this.nodePath.length - 1; i >= 0; i--) { const node = this.nodePath[i]; if (node instanceof Property) { this.getCompletionsForDeclarationProperty(node.getParent(), result); } else if (node instanceof Expression) { if (node.parent instanceof Interpolation) { this.getVariableProposals(null, result); } else { this.getCompletionsForExpression(node, result); } } else if (node instanceof SimpleSelector) { const parentRef = node.findAParent(NodeType.ExtendsReference, NodeType.Ruleset); if (parentRef) { if (parentRef.type === NodeType.ExtendsReference) { this.getCompletionsForExtendsReference(parentRef, node, result); } else { const parentRuleSet = parentRef; this.getCompletionsForSelector(parentRuleSet, parentRuleSet && parentRuleSet.isNested(), result); } } } else if (node instanceof FunctionArgument) { this.getCompletionsForFunctionArgument(node, node.getParent(), result); } else if (node instanceof Declarations) { this.getCompletionsForDeclarations(node, result); } else if (node instanceof VariableDeclaration) { this.getCompletionsForVariableDeclaration(node, result); } else if (node instanceof RuleSet) { this.getCompletionsForRuleSet(node, result); } else if (node instanceof Interpolation) { this.getCompletionsForInterpolation(node, result); } else if (node instanceof FunctionDeclaration) { this.getCompletionsForFunctionDeclaration(node, result); } else if (node instanceof MixinReference) { this.getCompletionsForMixinReference(node, result); } else if (node instanceof Function) { this.getCompletionsForFunctionArgument(null, node, result); } else if (node instanceof Supports) { this.getCompletionsForSupports(node, result); } else if (node instanceof SupportsCondition) { this.getCompletionsForSupportsCondition(node, result); } else if (node instanceof ExtendsReference) { this.getCompletionsForExtendsReference(node, null, result); } else if (node.type === NodeType.URILiteral) { this.getCompletionForUriLiteralValue(node, result); } else if (node.parent === null) { this.getCompletionForTopLevel(result); } else if (node.type === NodeType.StringLiteral && this.isImportPathParent(node.parent.type)) { this.getCompletionForImportPath(node, result); } else { continue; } if (result.items.length > 0 || this.offset > node.offset) { return this.finalize(result); } } this.getCompletionsForStylesheet(result); if (result.items.length === 0) { if (this.variablePrefix && this.currentWord.indexOf(this.variablePrefix) === 0) { this.getVariableProposals(null, result); } } return this.finalize(result); } finally { this.position = null; this.currentWord = null; this.textDocument = null; this.styleSheet = null; this.symbolContext = null; this.defaultReplaceRange = null; this.nodePath = null; } } isImportPathParent(type) { return type === NodeType.Import; } finalize(result) { return result; } findInNodePath(...types) { for (let i = this.nodePath.length - 1; i >= 0; i--) { const node = this.nodePath[i]; if (types.indexOf(node.type) !== -1) { return node; } } return null; } getCompletionsForDeclarationProperty(declaration, result) { return this.getPropertyProposals(declaration, result); } getPropertyProposals(declaration, result) { const triggerPropertyValueCompletion = this.isTriggerPropertyValueCompletionEnabled; const completePropertyWithSemicolon = this.isCompletePropertyWithSemicolonEnabled; const properties = this.cssDataManager.getProperties(); properties.forEach((entry) => { let range; let insertText; let retrigger = false; if (declaration) { range = this.getCompletionRange(declaration.getProperty()); insertText = entry.name; if (!isDefined(declaration.colonPosition)) { insertText += ": "; retrigger = true; } } else { range = this.getCompletionRange(null); insertText = entry.name + ": "; retrigger = true; } if (!declaration && completePropertyWithSemicolon) { insertText += "$0;"; } if (declaration && !declaration.semicolonPosition) { if (completePropertyWithSemicolon && this.offset >= this.textDocument.offsetAt(range.end)) { insertText += "$0;"; } } const item = { label: entry.name, documentation: getEntryDescription(entry, this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], textEdit: TextEdit.replace(range, insertText), insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Property }; if (!entry.restrictions) { retrigger = false; } if (triggerPropertyValueCompletion && retrigger) { item.command = retriggerCommand; } const relevance = typeof entry.relevance === "number" ? Math.min(Math.max(entry.relevance, 0), 99) : 50; const sortTextSuffix = (255 - relevance).toString(16); const sortTextPrefix = startsWith(entry.name, "-") ? SortTexts.VendorPrefixed : SortTexts.Normal; item.sortText = sortTextPrefix + "_" + sortTextSuffix; result.items.push(item); }); this.completionParticipants.forEach((participant) => { if (participant.onCssProperty) { participant.onCssProperty({ propertyName: this.currentWord, range: this.defaultReplaceRange }); } }); return result; } get isTriggerPropertyValueCompletionEnabled() { return this.documentSettings?.triggerPropertyValueCompletion ?? true; } get isCompletePropertyWithSemicolonEnabled() { return this.documentSettings?.completePropertyWithSemicolon ?? true; } getCompletionsForDeclarationValue(node, result) { const propertyName = node.getFullPropertyName(); const entry = this.cssDataManager.getProperty(propertyName); let existingNode = node.getValue() || null; while (existingNode && existingNode.hasChildren()) { existingNode = existingNode.findChildAtOffset(this.offset, false); } this.completionParticipants.forEach((participant) => { if (participant.onCssPropertyValue) { participant.onCssPropertyValue({ propertyName, propertyValue: this.currentWord, range: this.getCompletionRange(existingNode) }); } }); if (entry) { if (entry.restrictions) { for (const restriction of entry.restrictions) { switch (restriction) { case "color": this.getColorProposals(entry, existingNode, result); break; case "position": this.getPositionProposals(entry, existingNode, result); break; case "repeat": this.getRepeatStyleProposals(entry, existingNode, result); break; case "line-style": this.getLineStyleProposals(entry, existingNode, result); break; case "line-width": this.getLineWidthProposals(entry, existingNode, result); break; case "geometry-box": this.getGeometryBoxProposals(entry, existingNode, result); break; case "box": this.getBoxProposals(entry, existingNode, result); break; case "image": this.getImageProposals(entry, existingNode, result); break; case "timing-function": this.getTimingFunctionProposals(entry, existingNode, result); break; case "shape": this.getBasicShapeProposals(entry, existingNode, result); break; } } } this.getValueEnumProposals(entry, existingNode, result); this.getCSSWideKeywordProposals(entry, existingNode, result); this.getUnitProposals(entry, existingNode, result); } else { const existingValues = collectValues(this.styleSheet, node); for (const existingValue of existingValues.getEntries()) { result.items.push({ label: existingValue, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), existingValue), kind: CompletionItemKind.Value }); } } this.getVariableProposals(existingNode, result); this.getTermProposals(entry, existingNode, result); return result; } getValueEnumProposals(entry, existingNode, result) { if (entry.values) { for (const value of entry.values) { let insertString = value.name; let insertTextFormat; if (endsWith(insertString, ")")) { const from = insertString.lastIndexOf("("); if (from !== -1) { insertString = insertString.substring(0, from + 1) + "$1" + insertString.substring(from + 1); insertTextFormat = SnippetFormat; } } let sortText = SortTexts.Enums; if (startsWith(value.name, "-")) { sortText += SortTexts.VendorPrefixed; } const item = { label: value.name, documentation: getEntryDescription(value, this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertString), sortText, kind: CompletionItemKind.Value, insertTextFormat }; result.items.push(item); } } return result; } getCSSWideKeywordProposals(entry, existingNode, result) { for (const keywords in cssWideKeywords) { result.items.push({ label: keywords, documentation: cssWideKeywords[keywords], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), keywords), kind: CompletionItemKind.Value }); } for (const func in cssWideFunctions) { const insertText = moveCursorInsideParenthesis(func); result.items.push({ label: func, documentation: cssWideFunctions[func], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Function, insertTextFormat: SnippetFormat, command: startsWith(func, "var") ? retriggerCommand : void 0 }); } return result; } getCompletionsForInterpolation(node, result) { if (this.offset >= node.offset + 2) { this.getVariableProposals(null, result); } return result; } getVariableProposals(existingNode, result) { const symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Variable); for (const symbol of symbols) { const insertText = startsWith(symbol.name, "--") ? `var(${symbol.name})` : symbol.name; const completionItem = { label: symbol.name, documentation: symbol.value ? getLimitedString(symbol.value) : symbol.value, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Variable, sortText: SortTexts.Variable }; if (typeof completionItem.documentation === "string" && isColorString(completionItem.documentation)) { completionItem.kind = CompletionItemKind.Color; } if (symbol.node.type === NodeType.FunctionParameter) { const mixinNode = symbol.node.getParent(); if (mixinNode.type === NodeType.MixinDeclaration) { completionItem.detail = t("argument from '{0}'", mixinNode.getName()); } } result.items.push(completionItem); } return result; } getVariableProposalsForCSSVarFunction(result) { const allReferencedVariables = new Set2(); this.styleSheet.acceptVisitor(new VariableCollector(allReferencedVariables, this.offset)); let symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Variable); for (const symbol of symbols) { if (startsWith(symbol.name, "--")) { const completionItem = { label: symbol.name, documentation: symbol.value ? getLimitedString(symbol.value) : symbol.value, textEdit: TextEdit.replace(this.getCompletionRange(null), symbol.name), kind: CompletionItemKind.Variable }; if (typeof completionItem.documentation === "string" && isColorString(completionItem.documentation)) { completionItem.kind = CompletionItemKind.Color; } result.items.push(completionItem); } allReferencedVariables.remove(symbol.name); } for (const name of allReferencedVariables.getEntries()) { if (startsWith(name, "--")) { const completionItem = { label: name, textEdit: TextEdit.replace(this.getCompletionRange(null), name), kind: CompletionItemKind.Variable }; result.items.push(completionItem); } } return result; } getUnitProposals(entry, existingNode, result) { let currentWord = "0"; if (this.currentWord.length > 0) { const numMatch = this.currentWord.match(/^-?\d[\.\d+]*/); if (numMatch) { currentWord = numMatch[0]; result.isIncomplete = currentWord.length === this.currentWord.length; } } else if (this.currentWord.length === 0) { result.isIncomplete = true; } if (existingNode && existingNode.parent && existingNode.parent.type === NodeType.Term) { existingNode = existingNode.getParent(); } if (entry.restrictions) { for (const restriction of entry.restrictions) { const units2 = units[restriction]; if (units2) { for (const unit of units2) { const insertText = currentWord + unit; result.items.push({ label: insertText, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Unit }); } } } } return result; } getCompletionRange(existingNode) { if (existingNode && existingNode.offset <= this.offset && this.offset <= existingNode.end) { const end = existingNode.end !== -1 ? this.textDocument.positionAt(existingNode.end) : this.position; const start = this.textDocument.positionAt(existingNode.offset); if (start.line === end.line) { return Range.create(start, end); } } return this.defaultReplaceRange; } getColorProposals(entry, existingNode, result) { for (const color in colors) { result.items.push({ label: color, documentation: colors[color], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), color), kind: CompletionItemKind.Color }); } for (const color in colorKeywords) { result.items.push({ label: color, documentation: colorKeywords[color], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), color), kind: CompletionItemKind.Value }); } const colorValues = new Set2(); this.styleSheet.acceptVisitor(new ColorValueCollector(colorValues, this.offset)); for (const color of colorValues.getEntries()) { result.items.push({ label: color, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), color), kind: CompletionItemKind.Color }); } for (const p of colorFunctions) { result.items.push({ label: p.label, detail: p.func, documentation: p.desc, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), p.insertText), insertTextFormat: SnippetFormat, kind: CompletionItemKind.Function }); } return result; } getPositionProposals(entry, existingNode, result) { for (const position in positionKeywords) { result.items.push({ label: position, documentation: positionKeywords[position], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), position), kind: CompletionItemKind.Value }); } return result; } getRepeatStyleProposals(entry, existingNode, result) { for (const repeat2 in repeatStyleKeywords) { result.items.push({ label: repeat2, documentation: repeatStyleKeywords[repeat2], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), repeat2), kind: CompletionItemKind.Value }); } return result; } getLineStyleProposals(entry, existingNode, result) { for (const lineStyle in lineStyleKeywords) { result.items.push({ label: lineStyle, documentation: lineStyleKeywords[lineStyle], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), lineStyle), kind: CompletionItemKind.Value }); } return result; } getLineWidthProposals(entry, existingNode, result) { for (const lineWidth of lineWidthKeywords) { result.items.push({ label: lineWidth, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), lineWidth), kind: CompletionItemKind.Value }); } return result; } getGeometryBoxProposals(entry, existingNode, result) { for (const box in geometryBoxKeywords) { result.items.push({ label: box, documentation: geometryBoxKeywords[box], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), box), kind: CompletionItemKind.Value }); } return result; } getBoxProposals(entry, existingNode, result) { for (const box in boxKeywords) { result.items.push({ label: box, documentation: boxKeywords[box], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), box), kind: CompletionItemKind.Value }); } return result; } getImageProposals(entry, existingNode, result) { for (const image in imageFunctions) { const insertText = moveCursorInsideParenthesis(image); result.items.push({ label: image, documentation: imageFunctions[image], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Function, insertTextFormat: image !== insertText ? SnippetFormat : void 0 }); } return result; } getTimingFunctionProposals(entry, existingNode, result) { for (const timing in transitionTimingFunctions) { const insertText = moveCursorInsideParenthesis(timing); result.items.push({ label: timing, documentation: transitionTimingFunctions[timing], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Function, insertTextFormat: timing !== insertText ? SnippetFormat : void 0 }); } return result; } getBasicShapeProposals(entry, existingNode, result) { for (const shape in basicShapeFunctions) { const insertText = moveCursorInsideParenthesis(shape); result.items.push({ label: shape, documentation: basicShapeFunctions[shape], textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: CompletionItemKind.Function, insertTextFormat: shape !== insertText ? SnippetFormat : void 0 }); } return result; } getCompletionsForStylesheet(result) { const node = this.styleSheet.findFirstChildBeforeOffset(this.offset); if (!node) { return this.getCompletionForTopLevel(result); } if (node instanceof RuleSet) { return this.getCompletionsForRuleSet(node, result); } if (node instanceof Supports) { return this.getCompletionsForSupports(node, result); } return result; } getCompletionForTopLevel(result) { this.cssDataManager.getAtDirectives().forEach((entry) => { result.items.push({ label: entry.name, textEdit: TextEdit.replace(this.getCompletionRange(null), entry.name), documentation: getEntryDescription(entry, this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], kind: CompletionItemKind.Keyword }); }); this.getCompletionsForSelector(null, false, result); return result; } getCompletionsForRuleSet(ruleSet, result) { const declarations = ruleSet.getDeclarations(); const isAfter = declarations && declarations.endsWith("}") && this.offset >= declarations.end; if (isAfter) { return this.getCompletionForTopLevel(result); } const isInSelectors = !declarations || this.offset <= declarations.offset; if (isInSelectors) { return this.getCompletionsForSelector(ruleSet, ruleSet.isNested(), result); } return this.getCompletionsForDeclarations(ruleSet.getDeclarations(), result); } getCompletionsForSelector(ruleSet, isNested, result) { const existingNode = this.findInNodePath(NodeType.PseudoSelector, NodeType.IdentifierSelector, NodeType.ClassSelector, NodeType.ElementNameSelector); if (!existingNode && this.hasCharacterAtPosition(this.offset - this.currentWord.length - 1, ":")) { this.currentWord = ":" + this.currentWord; if (this.hasCharacterAtPosition(this.offset - this.currentWord.length - 1, ":")) { this.currentWord = ":" + this.currentWord; } this.defaultReplaceRange = Range.create(Position.create(this.position.line, this.position.character - this.currentWord.length), this.position); } const pseudoClasses = this.cssDataManager.getPseudoClasses(); pseudoClasses.forEach((entry) => { const insertText = moveCursorInsideParenthesis(entry.name); const item = { label: entry.name, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), documentation: getEntryDescription(entry, this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], kind: CompletionItemKind.Function, insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0 }; if (startsWith(entry.name, ":-")) { item.sortText = SortTexts.VendorPrefixed; } result.items.push(item); }); const pseudoElements = this.cssDataManager.getPseudoElements(); pseudoElements.forEach((entry) => { const insertText = moveCursorInsideParenthesis(entry.name); const item = { label: entry.name, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), documentation: getEntryDescription(entry, this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [CompletionItemTag.Deprecated] : [], kind: CompletionItemKind.Function, insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0 }; if (startsWith(entry.name, "::-")) { item.sortText = SortTexts.VendorPrefixed; } result.items.push(item); }); if (!isNested) { for (const entry of html5Tags) { result.items.push({ label: entry, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), entry), kind: CompletionItemKind.Keyword }); } for (const entry of svgElements) { result.items.push({ label: entry, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), entry), kind: CompletionItemKind.Keyword }); } } const visited = {}; visited[this.currentWord] = true; const docText = this.textDocument.getText(); this.styleSheet.accept((n) => { if (n.type === NodeType.SimpleSelector && n.length > 0) { const selector = docText.substr(n.offset, n.length); if (selector.charAt(0) === "." && !visited[selector]) { visited[selector] = true; result.items.push({ label: selector, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), selector), kind: CompletionItemKind.Keyword }); } return false; } return true; }); if (ruleSet && ruleSet.isNested()) { const selector = ruleSet.getSelectors().findFirstChildBeforeOffset(this.offset); if (selector && ruleSet.getSelectors().getChildren().indexOf(selector) === 0) { this.getPropertyProposals(null, result); } } return result; } getCompletionsForDeclarations(declarations, result) { if (!declarations || this.offset === declarations.offset) { return result; } const node = declarations.findFirstChildBeforeOffset(this.offset); if (!node) { return this.getCompletionsForDeclarationProperty(null, result); } if (node instanceof AbstractDeclaration) { const declaration = node; if (!isDefined(declaration.colonPosition) || this.offset <= declaration.colonPosition) { return this.getCompletionsForDeclarationProperty(declaration, result); } else if (isDefined(declaration.semicolonPosition) && declaration.semicolonPosition < this.offset) { if (this.offset === declaration.semicolonPosition + 1) { return result; } return this.getCompletionsForDeclarationProperty(null, result); } if (declaration instanceof Declaration) { return this.getCompletionsForDeclarationValue(declaration, result); } } else if (node instanceof ExtendsReference) { this.getCompletionsForExtendsReference(node, null, result); } else if (this.currentWord && this.currentWord[0] === "@") { this.getCompletionsForDeclarationProperty(null, result); } else if (node instanceof RuleSet) { this.getCompletionsForDeclarationProperty(null, result); } return result; } getCompletionsForVariableDeclaration(declaration, result) { if (this.offset && isDefined(declaration.colonPosition) && this.offset > declaration.colonPosition) { this.getVariableProposals(declaration.getValue() || null, result); } return result; } getCompletionsForExpression(expression, result) { const parent = expression.getParent(); if (parent instanceof FunctionArgument) { this.getCompletionsForFunctionArgument(parent, parent.getParent(), result); return result; } const declaration = expression.findParent(NodeType.Declaration); if (!declaration) { this.getTermProposals(void 0, null, result); return result; } const node = expression.findChildAtOffset(this.offset, true); if (!node) { return this.getCompletionsForDeclarationValue(declaration, result); } if (node instanceof NumericValue || node instanceof Identifier) { return this.getCompletionsForDeclarationValue(declaration, result); } return result; } getCompletionsForFunctionArgument(arg, func, result) { const identifier = func.getIdentifier(); if (identifier && identifier.matches("var")) { if (!func.getArguments().hasChildren() || func.getArguments().getChild(0) === arg) { this.getVariableProposalsForCSSVarFunction(result); } } return result; } getCompletionsForFunctionDeclaration(decl, result) { const declarations = decl.getDeclarations(); if (declarations && this.offset > declarations.offset && this.offset < declarations.end) { this.getTermProposals(void 0, null, result); } return result; } getCompletionsForMixinReference(ref, result) { const allMixins = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Mixin); for (const mixinSymbol of allMixins) { if (mixinSymbol.node instanceof MixinDeclaration) { result.items.push(this.makeTermProposal(mixinSymbol, mixinSymbol.node.getParameters(), null)); } } const identifierNode = ref.getIdentifier() || null; this.completionParticipants.forEach((participant) => { if (participant.onCssMixinReference) { participant.onCssMixinReference({ mixinName: this.currentWord, range: this.getCompletionRange(identifierNode) }); } }); return result; } getTermProposals(entry, existingNode, result) { const allFunctions = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Function); for (const functionSymbol of allFunctions) { if (functionSymbol.node instanceof FunctionDeclaration) { result.items.push(this.makeTermProposal(functionSymbol, functionSymbol.node.getParameters(), existingNode)); } } return result; } makeTermProposal(symbol, parameters, existingNode) { const decl = symbol.node; const params = parameters.getChildren().map((c) => { return c instanceof FunctionParameter ? c.getName() : c.getText(); }); const insertText = symbol.name + "(" + params.map((p, index) => "${" + (index + 1) + ":" + p + "}").join(", ") + ")"; return { label: symbol.name, detail: symbol.name + "(" + params.join(", ") + ")", textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), insertTextFormat: SnippetFormat, kind: CompletionItemKind.Function, sortText: SortTexts.Term }; } getCompletionsForSupportsCondition(supportsCondition, result) { const child = supportsCondition.findFirstChildBeforeOffset(this.offset); if (child) { if (child instanceof Declaration) { if (!isDefined(child.colonPosition) || this.offset <= child.colonPosition) { return this.getCompletionsForDeclarationProperty(child, result); } else { return this.getCompletionsForDeclarationValue(child, result); } } else if (child instanceof SupportsCondition) { return this.getCompletionsForSupportsCondition(child, result); } } if (isDefined(supportsCondition.lParent) && this.offset > supportsCondition.lParent && (!isDefined(supportsCondition.rParent) || this.offset <= supportsCondition.rParent)) { return this.getCompletionsForDeclarationProperty(null, result); } return result; } getCompletionsForSupports(supports, result) { const declarations = supports.getDeclarations(); const inInCondition = !declarations || this.offset <= declarations.offset; if (inInCondition) { const child = supports.findFirstChildBeforeOffset(this.offset); if (child instanceof SupportsCondition) { return this.getCompletionsForSupportsCondition(child, result); } return result; } return this.getCompletionForTopLevel(result); } getCompletionsForExtendsReference(extendsRef, existingNode, result) { return result; } getCompletionForUriLiteralValue(uriLiteralNode, result) { let uriValue; let position; let range; if (!uriLiteralNode.hasChildren()) { uriValue = ""; position = this.position; const emptyURIValuePosition = this.textDocument.positionAt(uriLiteralNode.offset + "url(".length); range = Range.create(emptyURIValuePosition, emptyURIValuePosition); } else { const uriValueNode = uriLiteralNode.getChild(0); uriValue = uriValueNode.getText(); position = this.position; range = this.getCompletionRange(uriValueNode); } this.completionParticipants.forEach((participant) => { if (participant.onCssURILiteralValue) { participant.onCssURILiteralValue({ uriValue, position, range }); } }); return result; } getCompletionForImportPath(importPathNode, result) { this.completionParticipants.forEach((participant) => { if (participant.onCssImportPath) { participant.onCssImportPath({ pathValue: importPathNode.getText(), position: this.position, range: this.getCompletionRange(importPathNode) }); } }); return result; } hasCharacterAtPosition(offset, char) { const text = this.textDocument.getText(); return offset >= 0 && offset < text.length && text.charAt(offset) === char; } doesSupportMarkdown() { if (!isDefined(this.supportsMarkdown)) { if (!isDefined(this.lsOptions.clientCapabilities)) { this.supportsMarkdown = true; return this.supportsMarkdown; } const documentationFormat = this.lsOptions.clientCapabilities.textDocument?.completion?.completionItem?.documentationFormat; this.supportsMarkdown = Array.isArray(documentationFormat) && documentationFormat.indexOf(MarkupKind.Markdown) !== -1; } return this.supportsMarkdown; } }; function isDeprecated(entry) { if (entry.status && (entry.status === "nonstandard" || entry.status === "obsolete")) { return true; } return false; } var Set2 = class { constructor() { this.entries = {}; } add(entry) { this.entries[entry] = true; } remove(entry) { delete this.entries[entry]; } getEntries() { return Object.keys(this.entries); } }; function moveCursorInsideParenthesis(text) { return text.replace(/\(\)$/, "($1)"); } function collectValues(styleSheet, declaration) { const fullPropertyName = declaration.getFullPropertyName(); const entries = new Set2(); function visitValue(node) { if (node instanceof Identifier || node instanceof NumericValue || node instanceof HexColorValue) { entries.add(node.getText()); } return true; } function matchesProperty(decl) { const propertyName = decl.getFullPropertyName(); return fullPropertyName === propertyName; } function vistNode(node) { if (node instanceof Declaration && node !== declaration) { if (matchesProperty(node)) { const value = node.getValue(); if (value) { value.accept(visitValue); } } } return true; } styleSheet.accept(vistNode); return entries; } var ColorValueCollector = class { constructor(entries, currentOffset) { this.entries = entries; this.currentOffset = currentOffset; } visitNode(node) { if (node instanceof HexColorValue || node instanceof Function && isColorConstructor(node)) { if (this.currentOffset < node.offset || node.end < this.currentOffset) { this.entries.add(node.getText()); } } return true; } }; var VariableCollector = class { constructor(entries, currentOffset) { this.entries = entries; this.currentOffset = currentOffset; } visitNode(node) { if (node instanceof Identifier && node.isCustomProperty) { if (this.currentOffset < node.offset || node.end < this.currentOffset) { this.entries.add(node.getText()); } } return true; } }; function getCurrentWord(document, offset) { let i = offset - 1; const text = document.getText(); while (i >= 0 && ' \n\r":{[()]},*>+'.indexOf(text.charAt(i)) === -1) { i--; } return text.substring(i + 1, offset); } // node_modules/vscode-css-languageservice/lib/esm/services/selectorPrinting.js var Element = class _Element { constructor() { this.parent = null; this.children = null; this.attributes = null; } findAttribute(name) { if (this.attributes) { for (const attribute of this.attributes) { if (attribute.name === name) { return attribute.value; } } } return null; } addChild(child) { if (child instanceof _Element) { child.parent = this; } if (!this.children) { this.children = []; } this.children.push(child); } append(text) { if (this.attributes) { const last = this.attributes[this.attributes.length - 1]; last.value = last.value + text; } } prepend(text) { if (this.attributes) { const first = this.attributes[0]; first.value = text + first.value; } } findRoot() { let curr = this; while (curr.parent && !(curr.parent instanceof RootElement)) { curr = curr.parent; } return curr; } removeChild(child) { if (this.children) { const index = this.children.indexOf(child); if (index !== -1) { this.children.splice(index, 1); return true; } } return false; } addAttr(name, value) { if (!this.attributes) { this.attributes = []; } for (const attribute of this.attributes) { if (attribute.name === name) { attribute.value += " " + value; return; } } this.attributes.push({ name, value }); } clone(cloneChildren = true) { const elem = new _Element(); if (this.attributes) { elem.attributes = []; for (const attribute of this.attributes) { elem.addAttr(attribute.name, attribute.value); } } if (cloneChildren && this.children) { elem.children = []; for (let index = 0; index < this.children.length; index++) { elem.addChild(this.children[index].clone()); } } return elem; } cloneWithParent() { const clone = this.clone(false); if (this.parent && !(this.parent instanceof RootElement)) { const parentClone = this.parent.cloneWithParent(); parentClone.addChild(clone); } return clone; } }; var RootElement = class extends Element { }; var LabelElement = class extends Element { constructor(label) { super(); this.addAttr("name", label); } }; var MarkedStringPrinter = class { constructor(quote) { this.quote = quote; this.result = []; } print(element, flagOpts) { this.result = []; if (element instanceof RootElement) { if (element.children) { this.doPrint(element.children, 0); } } else { this.doPrint([element], 0); } let value; if (flagOpts) { value = `${flagOpts.text} \u2026 ` + this.result.join("\n"); } else { value = this.result.join("\n"); } return [{ language: "html", value }]; } doPrint(elements, indent) { for (const element of elements) { this.doPrintElement(element, indent); if (element.children) { this.doPrint(element.children, indent + 1); } } } writeLine(level, content) { const indent = new Array(level + 1).join(" "); this.result.push(indent + content); } doPrintElement(element, indent) { const name = element.findAttribute("name"); if (element instanceof LabelElement || name === "\u2026") { this.writeLine(indent, name); return; } const content = ["<"]; if (name) { content.push(name); } else { content.push("element"); } if (element.attributes) { for (const attr of element.attributes) { if (attr.name !== "name") { content.push(" "); content.push(attr.name); const value = attr.value; if (value) { content.push("="); content.push(quotes.ensure(value, this.quote)); } } } } content.push(">"); this.writeLine(indent, content.join("")); } }; var quotes; (function(quotes2) { function ensure(value, which) { return which + remove(value) + which; } quotes2.ensure = ensure; function remove(value) { const match = value.match(/^['"](.*)["']$/); if (match) { return match[1]; } return value; } quotes2.remove = remove; })(quotes || (quotes = {})); var Specificity = class { constructor() { this.id = 0; this.attr = 0; this.tag = 0; } }; function toElement(node, parentElement) { let result = new Element(); for (const child of node.getChildren()) { switch (child.type) { case NodeType.SelectorCombinator: if (parentElement) { const segments = child.getText().split("&"); if (segments.length === 1) { result.addAttr("name", segments[0]); break; } result = parentElement.cloneWithParent(); if (segments[0]) { const root = result.findRoot(); root.prepend(segments[0]); } for (let i = 1; i < segments.length; i++) { if (i > 1) { const clone = parentElement.cloneWithParent(); result.addChild(clone.findRoot()); result = clone; } result.append(segments[i]); } } break; case NodeType.SelectorPlaceholder: if (child.matches("@at-root")) { return result; } case NodeType.ElementNameSelector: const text = child.getText(); result.addAttr("name", text === "*" ? "element" : unescape(text)); break; case NodeType.ClassSelector: result.addAttr("class", unescape(child.getText().substring(1))); break; case NodeType.IdentifierSelector: result.addAttr("id", unescape(child.getText().substring(1))); break; case NodeType.MixinDeclaration: result.addAttr("class", child.getName()); break; case NodeType.PseudoSelector: result.addAttr(unescape(child.getText()), ""); break; case NodeType.AttributeSelector: const selector = child; const identifier = selector.getIdentifier(); if (identifier) { const expression = selector.getValue(); const operator = selector.getOperator(); let value; if (expression && operator) { switch (unescape(operator.getText())) { case "|=": value = `${quotes.remove(unescape(expression.getText()))}-\u2026`; break; case "^=": value = `${quotes.remove(unescape(expression.getText()))}\u2026`; break; case "$=": value = `\u2026${quotes.remove(unescape(expression.getText()))}`; break; case "~=": value = ` \u2026 ${quotes.remove(unescape(expression.getText()))} \u2026 `; break; case "*=": value = `\u2026${quotes.remove(unescape(expression.getText()))}\u2026`; break; default: value = quotes.remove(unescape(expression.getText())); break; } } result.addAttr(unescape(identifier.getText()), value); } break; } } return result; } function unescape(content) { const scanner = new Scanner(); scanner.setSource(content); const token = scanner.scanUnquotedString(); if (token) { return token.text; } return content; } var SelectorPrinting = class { constructor(cssDataManager) { this.cssDataManager = cssDataManager; } selectorToMarkedString(node, flagOpts) { const root = selectorToElement(node); if (root) { const markedStrings = new MarkedStringPrinter('"').print(root, flagOpts); markedStrings.push(this.selectorToSpecificityMarkedString(node)); return markedStrings; } else { return []; } } simpleSelectorToMarkedString(node) { const element = toElement(node); const markedStrings = new MarkedStringPrinter('"').print(element); markedStrings.push(this.selectorToSpecificityMarkedString(node)); return markedStrings; } isPseudoElementIdentifier(text) { const match = text.match(/^::?([\w-]+)/); if (!match) { return false; } return !!this.cssDataManager.getPseudoElement("::" + match[1]); } selectorToSpecificityMarkedString(node) { const calculateMostSpecificListItem = (childElements) => { const specificity2 = new Specificity(); let mostSpecificListItem = new Specificity(); for (const containerElement of childElements) { for (const childElement of containerElement.getChildren()) { const itemSpecificity = calculateScore(childElement); if (itemSpecificity.id > mostSpecificListItem.id) { mostSpecificListItem = itemSpecificity; continue; } else if (itemSpecificity.id < mostSpecificListItem.id) { continue; } if (itemSpecificity.attr > mostSpecificListItem.attr) { mostSpecificListItem = itemSpecificity; continue; } else if (itemSpecificity.attr < mostSpecificListItem.attr) { continue; } if (itemSpecificity.tag > mostSpecificListItem.tag) { mostSpecificListItem = itemSpecificity; continue; } } } specificity2.id += mostSpecificListItem.id; specificity2.attr += mostSpecificListItem.attr; specificity2.tag += mostSpecificListItem.tag; return specificity2; }; const calculateScore = (node2) => { const specificity2 = new Specificity(); elementLoop: for (const element of node2.getChildren()) { switch (element.type) { case NodeType.IdentifierSelector: specificity2.id++; break; case NodeType.ClassSelector: case NodeType.AttributeSelector: specificity2.attr++; break; case NodeType.ElementNameSelector: if (element.matches("*")) { break; } specificity2.tag++; break; case NodeType.PseudoSelector: const text = element.getText(); const childElements = element.getChildren(); if (this.isPseudoElementIdentifier(text)) { if (text.match(/^::slotted/i) && childElements.length > 0) { specificity2.tag++; let mostSpecificListItem = calculateMostSpecificListItem(childElements); specificity2.id += mostSpecificListItem.id; specificity2.attr += mostSpecificListItem.attr; specificity2.tag += mostSpecificListItem.tag; continue elementLoop; } specificity2.tag++; continue elementLoop; } if (text.match(/^:where/i)) { continue elementLoop; } if (text.match(/^:(?:not|has|is)/i) && childElements.length > 0) { let mostSpecificListItem = calculateMostSpecificListItem(childElements); specificity2.id += mostSpecificListItem.id; specificity2.attr += mostSpecificListItem.attr; specificity2.tag += mostSpecificListItem.tag; continue elementLoop; } if (text.match(/^:(?:host|host-context)/i) && childElements.length > 0) { specificity2.attr++; let mostSpecificListItem = calculateMostSpecificListItem(childElements); specificity2.id += mostSpecificListItem.id; specificity2.attr += mostSpecificListItem.attr; specificity2.tag += mostSpecificListItem.tag; continue elementLoop; } if (text.match(/^:(?:nth-child|nth-last-child)/i) && childElements.length > 0) { specificity2.attr++; if (childElements.length === 3 && childElements[1].type === 23) { let mostSpecificListItem = calculateMostSpecificListItem(childElements[2].getChildren()); specificity2.id += mostSpecificListItem.id; specificity2.attr += mostSpecificListItem.attr; specificity2.tag += mostSpecificListItem.tag; continue elementLoop; } const parser = new Parser(); const pseudoSelectorText = childElements[1].getText(); parser.scanner.setSource(pseudoSelectorText); const firstToken = parser.scanner.scan(); const secondToken = parser.scanner.scan(); if (firstToken.text === "n" || firstToken.text === "-n" && secondToken.text === "of") { const complexSelectorListNodes = []; const complexSelectorText = pseudoSelectorText.slice(secondToken.offset + 2); const complexSelectorArray = complexSelectorText.split(","); for (const selector of complexSelectorArray) { const node3 = parser.internalParse(selector, parser._parseSelector); if (node3) { complexSelectorListNodes.push(node3); } } let mostSpecificListItem = calculateMostSpecificListItem(complexSelectorListNodes); specificity2.id += mostSpecificListItem.id; specificity2.attr += mostSpecificListItem.attr; specificity2.tag += mostSpecificListItem.tag; continue elementLoop; } continue elementLoop; } specificity2.attr++; continue elementLoop; } if (element.getChildren().length > 0) { const itemSpecificity = calculateScore(element); specificity2.id += itemSpecificity.id; specificity2.attr += itemSpecificity.attr; specificity2.tag += itemSpecificity.tag; } } return specificity2; }; const specificity = calculateScore(node); return `[${t("Selector Specificity")}](https://developer.mozilla.org/docs/Web/CSS/Specificity): (${specificity.id}, ${specificity.attr}, ${specificity.tag})`; } }; var SelectorElementBuilder = class { constructor(element) { this.prev = null; this.element = element; } processSelector(selector) { let parentElement = null; if (!(this.element instanceof RootElement)) { if (selector.getChildren().some((c) => c.hasChildren() && c.getChild(0).type === NodeType.SelectorCombinator)) { const curr = this.element.findRoot(); if (curr.parent instanceof RootElement) { parentElement = this.element; this.element = curr.parent; this.element.removeChild(curr); this.prev = null; } } } for (const selectorChild of selector.getChildren()) { if (selectorChild instanceof SimpleSelector) { if (this.prev instanceof SimpleSelector) { const labelElement = new LabelElement("\u2026"); this.element.addChild(labelElement); this.element = labelElement; } else if (this.prev && (this.prev.matches("+") || this.prev.matches("~")) && this.element.parent) { this.element = this.element.parent; } if (this.prev && this.prev.matches("~")) { this.element.addChild(new LabelElement("\u22EE")); } const thisElement = toElement(selectorChild, parentElement); const root = thisElement.findRoot(); this.element.addChild(root); this.element = thisElement; } if (selectorChild instanceof SimpleSelector || selectorChild.type === NodeType.SelectorCombinatorParent || selectorChild.type === NodeType.SelectorCombinatorShadowPiercingDescendant || selectorChild.type === NodeType.SelectorCombinatorSibling || selectorChild.type === NodeType.SelectorCombinatorAllSiblings) { this.prev = selectorChild; } } } }; function isNewSelectorContext(node) { switch (node.type) { case NodeType.MixinDeclaration: case NodeType.Stylesheet: return true; } return false; } function selectorToElement(node) { if (node.matches("@at-root")) { return null; } const root = new RootElement(); const parentRuleSets = []; const ruleSet = node.getParent(); if (ruleSet instanceof RuleSet) { let parent = ruleSet.getParent(); while (parent && !isNewSelectorContext(parent)) { if (parent instanceof RuleSet) { if (parent.getSelectors().matches("@at-root")) { break; } parentRuleSets.push(parent); } parent = parent.getParent(); } } const builder = new SelectorElementBuilder(root); for (let i = parentRuleSets.length - 1; i >= 0; i--) { const selector = parentRuleSets[i].getSelectors().getChild(0); if (selector) { builder.processSelector(selector); } } builder.processSelector(node); return root; } // node_modules/vscode-css-languageservice/lib/esm/services/cssHover.js var CSSHover = class { constructor(clientCapabilities, cssDataManager) { this.clientCapabilities = clientCapabilities; this.cssDataManager = cssDataManager; this.selectorPrinting = new SelectorPrinting(cssDataManager); } configure(settings) { this.defaultSettings = settings; } doHover(document, position, stylesheet, settings = this.defaultSettings) { function getRange2(node) { return Range.create(document.positionAt(node.offset), document.positionAt(node.end)); } const offset = document.offsetAt(position); const nodepath = getNodePath(stylesheet, offset); let hover = null; let flagOpts; for (let i = 0; i < nodepath.length; i++) { const node = nodepath[i]; if (node instanceof Media) { const regex = /@media[^\{]+/g; const matches2 = node.getText().match(regex); flagOpts = { isMedia: true, text: matches2?.[0] }; } if (node instanceof Selector) { hover = { contents: this.selectorPrinting.selectorToMarkedString(node, flagOpts), range: getRange2(node) }; break; } if (node instanceof SimpleSelector) { if (!startsWith(node.getText(), "@")) { hover = { contents: this.selectorPrinting.simpleSelectorToMarkedString(node), range: getRange2(node) }; } break; } if (node instanceof Declaration) { const propertyName = node.getFullPropertyName(); const entry = this.cssDataManager.getProperty(propertyName); if (entry) { const contents = getEntryDescription(entry, this.doesSupportMarkdown(), settings); if (contents) { hover = { contents, range: getRange2(node) }; } else { hover = null; } } continue; } if (node instanceof UnknownAtRule) { const atRuleName = node.getText(); const entry = this.cssDataManager.getAtDirective(atRuleName); if (entry) { const contents = getEntryDescription(entry, this.doesSupportMarkdown(), settings); if (contents) { hover = { contents, range: getRange2(node) }; } else { hover = null; } } continue; } if (node instanceof Node && node.type === NodeType.PseudoSelector) { const selectorName = node.getText(); const entry = selectorName.slice(0, 2) === "::" ? this.cssDataManager.getPseudoElement(selectorName) : this.cssDataManager.getPseudoClass(selectorName); if (entry) { const contents = getEntryDescription(entry, this.doesSupportMarkdown(), settings); if (contents) { hover = { contents, range: getRange2(node) }; } else { hover = null; } } continue; } } if (hover) { hover.contents = this.convertContents(hover.contents); } return hover; } convertContents(contents) { if (!this.doesSupportMarkdown()) { if (typeof contents === "string") { return contents; } else if ("kind" in contents) { return { kind: "plaintext", value: contents.value }; } else if (Array.isArray(contents)) { return contents.map((c) => { return typeof c === "string" ? c : c.value; }); } else { return contents.value; } } return contents; } doesSupportMarkdown() { if (!isDefined(this.supportsMarkdown)) { if (!isDefined(this.clientCapabilities)) { this.supportsMarkdown = true; return this.supportsMarkdown; } const hover = this.clientCapabilities.textDocument && this.clientCapabilities.textDocument.hover; this.supportsMarkdown = hover && hover.contentFormat && Array.isArray(hover.contentFormat) && hover.contentFormat.indexOf(MarkupKind.Markdown) !== -1; } return this.supportsMarkdown; } }; // node_modules/vscode-css-languageservice/lib/esm/services/cssNavigation.js var startsWithSchemeRegex = /^\w+:\/\//; var startsWithData = /^data:/; var CSSNavigation = class { constructor(fileSystemProvider, resolveModuleReferences) { this.fileSystemProvider = fileSystemProvider; this.resolveModuleReferences = resolveModuleReferences; } configure(settings) { this.defaultSettings = settings; } findDefinition(document, position, stylesheet) { const symbols = new Symbols(stylesheet); const offset = document.offsetAt(position); const node = getNodeAtOffset(stylesheet, offset); if (!node) { return null; } const symbol = symbols.findSymbolFromNode(node); if (!symbol) { return null; } return { uri: document.uri, range: getRange(symbol.node, document) }; } findReferences(document, position, stylesheet) { const highlights = this.findDocumentHighlights(document, position, stylesheet); return highlights.map((h) => { return { uri: document.uri, range: h.range }; }); } getHighlightNode(document, position, stylesheet) { const offset = document.offsetAt(position); let node = getNodeAtOffset(stylesheet, offset); if (!node || node.type === NodeType.Stylesheet || node.type === NodeType.Declarations) { return; } if (node.type === NodeType.Identifier && node.parent && node.parent.type === NodeType.ClassSelector) { node = node.parent; } return node; } findDocumentHighlights(document, position, stylesheet) { const result = []; const node = this.getHighlightNode(document, position, stylesheet); if (!node) { return result; } const symbols = new Symbols(stylesheet); const symbol = symbols.findSymbolFromNode(node); const name = node.getText(); stylesheet.accept((candidate) => { if (symbol) { if (symbols.matchesSymbol(candidate, symbol)) { result.push({ kind: getHighlightKind(candidate), range: getRange(candidate, document) }); return false; } } else if (node && node.type === candidate.type && candidate.matches(name)) { result.push({ kind: getHighlightKind(candidate), range: getRange(candidate, document) }); } return true; }); return result; } isRawStringDocumentLinkNode(node) { return node.type === NodeType.Import; } findDocumentLinks(document, stylesheet, documentContext) { const linkData = this.findUnresolvedLinks(document, stylesheet); const resolvedLinks = []; for (let data of linkData) { const link = data.link; const target = link.target; if (!target || startsWithData.test(target)) { } else if (startsWithSchemeRegex.test(target)) { resolvedLinks.push(link); } else { const resolved = documentContext.resolveReference(target, document.uri); if (resolved) { link.target = resolved; } resolvedLinks.push(link); } } return resolvedLinks; } async findDocumentLinks2(document, stylesheet, documentContext) { const linkData = this.findUnresolvedLinks(document, stylesheet); const resolvedLinks = []; for (let data of linkData) { const link = data.link; const target = link.target; if (!target || startsWithData.test(target)) { } else if (startsWithSchemeRegex.test(target)) { resolvedLinks.push(link); } else { const resolvedTarget = await this.resolveReference(target, document.uri, documentContext, data.isRawLink); if (resolvedTarget !== void 0) { link.target = resolvedTarget; resolvedLinks.push(link); } } } return resolvedLinks; } findUnresolvedLinks(document, stylesheet) { const result = []; const collect = (uriStringNode) => { let rawUri = uriStringNode.getText(); const range = getRange(uriStringNode, document); if (range.start.line === range.end.line && range.start.character === range.end.character) { return; } if (startsWith(rawUri, `'`) || startsWith(rawUri, `"`)) { rawUri = rawUri.slice(1, -1); } const isRawLink = uriStringNode.parent ? this.isRawStringDocumentLinkNode(uriStringNode.parent) : false; result.push({ link: { target: rawUri, range }, isRawLink }); }; stylesheet.accept((candidate) => { if (candidate.type === NodeType.URILiteral) { const first = candidate.getChild(0); if (first) { collect(first); } return false; } if (candidate.parent && this.isRawStringDocumentLinkNode(candidate.parent)) { const rawText = candidate.getText(); if (startsWith(rawText, `'`) || startsWith(rawText, `"`)) { collect(candidate); } return false; } return true; }); return result; } findSymbolInformations(document, stylesheet) { const result = []; const addSymbolInformation = (name, kind, symbolNodeOrRange) => { const range = symbolNodeOrRange instanceof Node ? getRange(symbolNodeOrRange, document) : symbolNodeOrRange; const entry = { name: name || t(""), kind, location: Location.create(document.uri, range) }; result.push(entry); }; this.collectDocumentSymbols(document, stylesheet, addSymbolInformation); return result; } findDocumentSymbols(document, stylesheet) { const result = []; const parents = []; const addDocumentSymbol = (name, kind, symbolNodeOrRange, nameNodeOrRange, bodyNode) => { const range = symbolNodeOrRange instanceof Node ? getRange(symbolNodeOrRange, document) : symbolNodeOrRange; let selectionRange = nameNodeOrRange instanceof Node ? getRange(nameNodeOrRange, document) : nameNodeOrRange; if (!selectionRange || !containsRange(range, selectionRange)) { selectionRange = Range.create(range.start, range.start); } const entry = { name: name || t(""), kind, range, selectionRange }; let top = parents.pop(); while (top && !containsRange(top[1], range)) { top = parents.pop(); } if (top) { const topSymbol = top[0]; if (!topSymbol.children) { topSymbol.children = []; } topSymbol.children.push(entry); parents.push(top); } else { result.push(entry); } if (bodyNode) { parents.push([entry, getRange(bodyNode, document)]); } }; this.collectDocumentSymbols(document, stylesheet, addDocumentSymbol); return result; } collectDocumentSymbols(document, stylesheet, collect) { stylesheet.accept((node) => { if (node instanceof RuleSet) { for (const selector of node.getSelectors().getChildren()) { if (selector instanceof Selector) { const range = Range.create(document.positionAt(selector.offset), document.positionAt(node.end)); collect(selector.getText(), SymbolKind.Class, range, selector, node.getDeclarations()); } } } else if (node instanceof VariableDeclaration) { collect(node.getName(), SymbolKind.Variable, node, node.getVariable(), void 0); } else if (node instanceof MixinDeclaration) { collect(node.getName(), SymbolKind.Method, node, node.getIdentifier(), node.getDeclarations()); } else if (node instanceof FunctionDeclaration) { collect(node.getName(), SymbolKind.Function, node, node.getIdentifier(), node.getDeclarations()); } else if (node instanceof Keyframe) { const name = t("@keyframes {0}", node.getName()); collect(name, SymbolKind.Class, node, node.getIdentifier(), node.getDeclarations()); } else if (node instanceof FontFace) { const name = t("@font-face"); collect(name, SymbolKind.Class, node, void 0, node.getDeclarations()); } else if (node instanceof Media) { const mediaList = node.getChild(0); if (mediaList instanceof Medialist) { const name = "@media " + mediaList.getText(); collect(name, SymbolKind.Module, node, mediaList, node.getDeclarations()); } } return true; }); } findDocumentColors(document, stylesheet) { const result = []; stylesheet.accept((node) => { const colorInfo = getColorInformation(node, document); if (colorInfo) { result.push(colorInfo); } return true; }); return result; } getColorPresentations(document, stylesheet, color, range) { const result = []; const red256 = Math.round(color.red * 255), green256 = Math.round(color.green * 255), blue256 = Math.round(color.blue * 255); let label; if (color.alpha === 1) { label = `rgb(${red256}, ${green256}, ${blue256})`; } else { label = `rgba(${red256}, ${green256}, ${blue256}, ${color.alpha})`; } result.push({ label, textEdit: TextEdit.replace(range, label) }); if (color.alpha === 1) { label = `#${toTwoDigitHex(red256)}${toTwoDigitHex(green256)}${toTwoDigitHex(blue256)}`; } else { label = `#${toTwoDigitHex(red256)}${toTwoDigitHex(green256)}${toTwoDigitHex(blue256)}${toTwoDigitHex(Math.round(color.alpha * 255))}`; } result.push({ label, textEdit: TextEdit.replace(range, label) }); const hsl = hslFromColor(color); if (hsl.a === 1) { label = `hsl(${hsl.h}, ${Math.round(hsl.s * 100)}%, ${Math.round(hsl.l * 100)}%)`; } else { label = `hsla(${hsl.h}, ${Math.round(hsl.s * 100)}%, ${Math.round(hsl.l * 100)}%, ${hsl.a})`; } result.push({ label, textEdit: TextEdit.replace(range, label) }); const hwb = hwbFromColor(color); if (hwb.a === 1) { label = `hwb(${hwb.h} ${Math.round(hwb.w * 100)}% ${Math.round(hwb.b * 100)}%)`; } else { label = `hwb(${hwb.h} ${Math.round(hwb.w * 100)}% ${Math.round(hwb.b * 100)}% / ${hwb.a})`; } result.push({ label, textEdit: TextEdit.replace(range, label) }); return result; } prepareRename(document, position, stylesheet) { const node = this.getHighlightNode(document, position, stylesheet); if (node) { return Range.create(document.positionAt(node.offset), document.positionAt(node.end)); } } doRename(document, position, newName, stylesheet) { const highlights = this.findDocumentHighlights(document, position, stylesheet); const edits = highlights.map((h) => TextEdit.replace(h.range, newName)); return { changes: { [document.uri]: edits } }; } async resolveModuleReference(ref, documentUri, documentContext) { if (startsWith(documentUri, "file://")) { const moduleName = getModuleNameFromPath(ref); if (moduleName && moduleName !== "." && moduleName !== "..") { const rootFolderUri = documentContext.resolveReference("/", documentUri); const documentFolderUri = dirname(documentUri); const modulePath = await this.resolvePathToModule(moduleName, documentFolderUri, rootFolderUri); if (modulePath) { const pathWithinModule = ref.substring(moduleName.length + 1); return joinPath(modulePath, pathWithinModule); } } } return void 0; } async mapReference(target, isRawLink) { return target; } async resolveReference(target, documentUri, documentContext, isRawLink = false, settings = this.defaultSettings) { if (target[0] === "~" && target[1] !== "/" && this.fileSystemProvider) { target = target.substring(1); return this.mapReference(await this.resolveModuleReference(target, documentUri, documentContext), isRawLink); } const ref = await this.mapReference(documentContext.resolveReference(target, documentUri), isRawLink); if (this.resolveModuleReferences) { if (ref && await this.fileExists(ref)) { return ref; } const moduleReference = await this.mapReference(await this.resolveModuleReference(target, documentUri, documentContext), isRawLink); if (moduleReference) { return moduleReference; } } if (ref && !await this.fileExists(ref)) { const rootFolderUri = documentContext.resolveReference("/", documentUri); if (settings && rootFolderUri) { if (target in settings) { return this.mapReference(joinPath(rootFolderUri, settings[target]), isRawLink); } const firstSlash = target.indexOf("/"); const prefix = `${target.substring(0, firstSlash)}/`; if (prefix in settings) { const aliasPath = settings[prefix].slice(0, -1); let newPath = joinPath(rootFolderUri, aliasPath); return this.mapReference(newPath = joinPath(newPath, target.substring(prefix.length - 1)), isRawLink); } } } return ref; } async resolvePathToModule(_moduleName, documentFolderUri, rootFolderUri) { const packPath = joinPath(documentFolderUri, "node_modules", _moduleName, "package.json"); if (await this.fileExists(packPath)) { return dirname(packPath); } else if (rootFolderUri && documentFolderUri.startsWith(rootFolderUri) && documentFolderUri.length !== rootFolderUri.length) { return this.resolvePathToModule(_moduleName, dirname(documentFolderUri), rootFolderUri); } return void 0; } async fileExists(uri) { if (!this.fileSystemProvider) { return false; } try { const stat = await this.fileSystemProvider.stat(uri); if (stat.type === FileType.Unknown && stat.size === -1) { return false; } return true; } catch (err) { return false; } } }; function getColorInformation(node, document) { const color = getColorValue(node); if (color) { const range = getRange(node, document); return { color, range }; } return null; } function getRange(node, document) { return Range.create(document.positionAt(node.offset), document.positionAt(node.end)); } function containsRange(range, otherRange) { const otherStartLine = otherRange.start.line, otherEndLine = otherRange.end.line; const rangeStartLine = range.start.line, rangeEndLine = range.end.line; if (otherStartLine < rangeStartLine || otherEndLine < rangeStartLine) { return false; } if (otherStartLine > rangeEndLine || otherEndLine > rangeEndLine) { return false; } if (otherStartLine === rangeStartLine && otherRange.start.character < range.start.character) { return false; } if (otherEndLine === rangeEndLine && otherRange.end.character > range.end.character) { return false; } return true; } function getHighlightKind(node) { if (node.type === NodeType.Selector) { return DocumentHighlightKind.Write; } if (node instanceof Identifier) { if (node.parent && node.parent instanceof Property) { if (node.isCustomProperty) { return DocumentHighlightKind.Write; } } } if (node.parent) { switch (node.parent.type) { case NodeType.FunctionDeclaration: case NodeType.MixinDeclaration: case NodeType.Keyframe: case NodeType.VariableDeclaration: case NodeType.FunctionParameter: return DocumentHighlightKind.Write; } } return DocumentHighlightKind.Read; } function toTwoDigitHex(n) { const r = n.toString(16); return r.length !== 2 ? "0" + r : r; } function getModuleNameFromPath(path) { const firstSlash = path.indexOf("/"); if (firstSlash === -1) { return ""; } if (path[0] === "@") { const secondSlash = path.indexOf("/", firstSlash + 1); if (secondSlash === -1) { return path; } return path.substring(0, secondSlash); } return path.substring(0, firstSlash); } // node_modules/vscode-css-languageservice/lib/esm/services/lintRules.js var Warning = Level.Warning; var Error2 = Level.Error; var Ignore = Level.Ignore; var Rule = class { constructor(id, message, defaultValue) { this.id = id; this.message = message; this.defaultValue = defaultValue; } }; var Setting = class { constructor(id, message, defaultValue) { this.id = id; this.message = message; this.defaultValue = defaultValue; } }; var Rules = { AllVendorPrefixes: new Rule("compatibleVendorPrefixes", t("When using a vendor-specific prefix make sure to also include all other vendor-specific properties"), Ignore), IncludeStandardPropertyWhenUsingVendorPrefix: new Rule("vendorPrefix", t("When using a vendor-specific prefix also include the standard property"), Warning), DuplicateDeclarations: new Rule("duplicateProperties", t("Do not use duplicate style definitions"), Ignore), EmptyRuleSet: new Rule("emptyRules", t("Do not use empty rulesets"), Warning), ImportStatemement: new Rule("importStatement", t("Import statements do not load in parallel"), Ignore), BewareOfBoxModelSize: new Rule("boxModel", t("Do not use width or height when using padding or border"), Ignore), UniversalSelector: new Rule("universalSelector", t("The universal selector (*) is known to be slow"), Ignore), ZeroWithUnit: new Rule("zeroUnits", t("No unit for zero needed"), Ignore), RequiredPropertiesForFontFace: new Rule("fontFaceProperties", t("@font-face rule must define 'src' and 'font-family' properties"), Warning), HexColorLength: new Rule("hexColorLength", t("Hex colors must consist of three, four, six or eight hex numbers"), Error2), ArgsInColorFunction: new Rule("argumentsInColorFunction", t("Invalid number of parameters"), Error2), UnknownProperty: new Rule("unknownProperties", t("Unknown property."), Warning), UnknownAtRules: new Rule("unknownAtRules", t("Unknown at-rule."), Warning), IEStarHack: new Rule("ieHack", t("IE hacks are only necessary when supporting IE7 and older"), Ignore), UnknownVendorSpecificProperty: new Rule("unknownVendorSpecificProperties", t("Unknown vendor specific property."), Ignore), PropertyIgnoredDueToDisplay: new Rule("propertyIgnoredDueToDisplay", t("Property is ignored due to the display."), Warning), AvoidImportant: new Rule("important", t("Avoid using !important. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored."), Ignore), AvoidFloat: new Rule("float", t("Avoid using 'float'. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes."), Ignore), AvoidIdSelector: new Rule("idSelector", t("Selectors should not contain IDs because these rules are too tightly coupled with the HTML."), Ignore) }; var Settings = { ValidProperties: new Setting("validProperties", t("A list of properties that are not validated against the `unknownProperties` rule."), []) }; var LintConfigurationSettings = class { constructor(conf = {}) { this.conf = conf; } getRule(rule) { if (this.conf.hasOwnProperty(rule.id)) { const level = toLevel(this.conf[rule.id]); if (level) { return level; } } return rule.defaultValue; } getSetting(setting) { return this.conf[setting.id]; } }; function toLevel(level) { switch (level) { case "ignore": return Level.Ignore; case "warning": return Level.Warning; case "error": return Level.Error; } return null; } // node_modules/vscode-css-languageservice/lib/esm/services/cssCodeActions.js var CSSCodeActions = class { constructor(cssDataManager) { this.cssDataManager = cssDataManager; } doCodeActions(document, range, context, stylesheet) { return this.doCodeActions2(document, range, context, stylesheet).map((ca) => { const textDocumentEdit = ca.edit && ca.edit.documentChanges && ca.edit.documentChanges[0]; return Command.create(ca.title, "_css.applyCodeAction", document.uri, document.version, textDocumentEdit && textDocumentEdit.edits); }); } doCodeActions2(document, range, context, stylesheet) { const result = []; if (context.diagnostics) { for (const diagnostic of context.diagnostics) { this.appendFixesForMarker(document, stylesheet, diagnostic, result); } } return result; } getFixesForUnknownProperty(document, property, marker, result) { const propertyName = property.getName(); const candidates = []; this.cssDataManager.getProperties().forEach((p) => { const score = difference(propertyName, p.name); if (score >= propertyName.length / 2) { candidates.push({ property: p.name, score }); } }); candidates.sort((a2, b) => { return b.score - a2.score || a2.property.localeCompare(b.property); }); let maxActions = 3; for (const candidate of candidates) { const propertyName2 = candidate.property; const title = t("Rename to '{0}'", propertyName2); const edit = TextEdit.replace(marker.range, propertyName2); const documentIdentifier = VersionedTextDocumentIdentifier.create(document.uri, document.version); const workspaceEdit = { documentChanges: [TextDocumentEdit.create(documentIdentifier, [edit])] }; const codeAction = CodeAction.create(title, workspaceEdit, CodeActionKind.QuickFix); codeAction.diagnostics = [marker]; result.push(codeAction); if (--maxActions <= 0) { return; } } } appendFixesForMarker(document, stylesheet, marker, result) { if (marker.code !== Rules.UnknownProperty.id) { return; } const offset = document.offsetAt(marker.range.start); const end = document.offsetAt(marker.range.end); const nodepath = getNodePath(stylesheet, offset); for (let i = nodepath.length - 1; i >= 0; i--) { const node = nodepath[i]; if (node instanceof Declaration) { const property = node.getProperty(); if (property && property.offset === offset && property.end === end) { this.getFixesForUnknownProperty(document, property, marker, result); return; } } } } }; // node_modules/vscode-css-languageservice/lib/esm/services/lintUtil.js var Element2 = class { constructor(decl) { this.fullPropertyName = decl.getFullPropertyName().toLowerCase(); this.node = decl; } }; function setSide(model, side, value, property) { const state = model[side]; state.value = value; if (value) { if (!includes(state.properties, property)) { state.properties.push(property); } } } function setAllSides(model, value, property) { setSide(model, "top", value, property); setSide(model, "right", value, property); setSide(model, "bottom", value, property); setSide(model, "left", value, property); } function updateModelWithValue(model, side, value, property) { if (side === "top" || side === "right" || side === "bottom" || side === "left") { setSide(model, side, value, property); } else { setAllSides(model, value, property); } } function updateModelWithList(model, values2, property) { switch (values2.length) { case 1: updateModelWithValue(model, void 0, values2[0], property); break; case 2: updateModelWithValue(model, "top", values2[0], property); updateModelWithValue(model, "bottom", values2[0], property); updateModelWithValue(model, "right", values2[1], property); updateModelWithValue(model, "left", values2[1], property); break; case 3: updateModelWithValue(model, "top", values2[0], property); updateModelWithValue(model, "right", values2[1], property); updateModelWithValue(model, "left", values2[1], property); updateModelWithValue(model, "bottom", values2[2], property); break; case 4: updateModelWithValue(model, "top", values2[0], property); updateModelWithValue(model, "right", values2[1], property); updateModelWithValue(model, "bottom", values2[2], property); updateModelWithValue(model, "left", values2[3], property); break; } } function matches(value, candidates) { for (let candidate of candidates) { if (value.matches(candidate)) { return true; } } return false; } function checkLineWidth(value, allowsKeywords = true) { if (allowsKeywords && matches(value, ["initial", "unset"])) { return false; } return parseFloat(value.getText()) !== 0; } function checkLineWidthList(nodes, allowsKeywords = true) { return nodes.map((node) => checkLineWidth(node, allowsKeywords)); } function checkLineStyle(valueNode, allowsKeywords = true) { if (matches(valueNode, ["none", "hidden"])) { return false; } if (allowsKeywords && matches(valueNode, ["initial", "unset"])) { return false; } return true; } function checkLineStyleList(nodes, allowsKeywords = true) { return nodes.map((node) => checkLineStyle(node, allowsKeywords)); } function checkBorderShorthand(node) { const children = node.getChildren(); if (children.length === 1) { const value = children[0]; return checkLineWidth(value) && checkLineStyle(value); } for (const child of children) { const value = child; if (!checkLineWidth( value, /* allowsKeywords: */ false ) || !checkLineStyle( value, /* allowsKeywords: */ false )) { return false; } } return true; } function calculateBoxModel(propertyTable) { const model = { top: { value: false, properties: [] }, right: { value: false, properties: [] }, bottom: { value: false, properties: [] }, left: { value: false, properties: [] } }; for (const property of propertyTable) { const value = property.node.value; if (typeof value === "undefined") { continue; } switch (property.fullPropertyName) { case "box-sizing": return { top: { value: false, properties: [] }, right: { value: false, properties: [] }, bottom: { value: false, properties: [] }, left: { value: false, properties: [] } }; case "width": model.width = property; break; case "height": model.height = property; break; default: const segments = property.fullPropertyName.split("-"); switch (segments[0]) { case "border": switch (segments[1]) { case void 0: case "top": case "right": case "bottom": case "left": switch (segments[2]) { case void 0: updateModelWithValue(model, segments[1], checkBorderShorthand(value), property); break; case "width": updateModelWithValue(model, segments[1], checkLineWidth(value, false), property); break; case "style": updateModelWithValue(model, segments[1], checkLineStyle(value, true), property); break; } break; case "width": updateModelWithList(model, checkLineWidthList(value.getChildren(), false), property); break; case "style": updateModelWithList(model, checkLineStyleList(value.getChildren(), true), property); break; } break; case "padding": if (segments.length === 1) { updateModelWithList(model, checkLineWidthList(value.getChildren(), true), property); } else { updateModelWithValue(model, segments[1], checkLineWidth(value, true), property); } break; } break; } } return model; } // node_modules/vscode-css-languageservice/lib/esm/services/lint.js var NodesByRootMap = class { constructor() { this.data = {}; } add(root, name, node) { let entry = this.data[root]; if (!entry) { entry = { nodes: [], names: [] }; this.data[root] = entry; } entry.names.push(name); if (node) { entry.nodes.push(node); } } }; var LintVisitor = class _LintVisitor { static entries(node, document, settings, cssDataManager, entryFilter) { const visitor = new _LintVisitor(document, settings, cssDataManager); node.acceptVisitor(visitor); visitor.completeValidations(); return visitor.getEntries(entryFilter); } constructor(document, settings, cssDataManager) { this.cssDataManager = cssDataManager; this.warnings = []; this.settings = settings; this.documentText = document.getText(); this.keyframes = new NodesByRootMap(); this.validProperties = {}; const properties = settings.getSetting(Settings.ValidProperties); if (Array.isArray(properties)) { properties.forEach((p) => { if (typeof p === "string") { const name = p.trim().toLowerCase(); if (name.length) { this.validProperties[name] = true; } } }); } } isValidPropertyDeclaration(element) { const propertyName = element.fullPropertyName; return this.validProperties[propertyName]; } fetch(input, s) { const elements = []; for (const curr of input) { if (curr.fullPropertyName === s) { elements.push(curr); } } return elements; } fetchWithValue(input, s, v) { const elements = []; for (const inputElement of input) { if (inputElement.fullPropertyName === s) { const expression = inputElement.node.getValue(); if (expression && this.findValueInExpression(expression, v)) { elements.push(inputElement); } } } return elements; } findValueInExpression(expression, v) { let found = false; expression.accept((node) => { if (node.type === NodeType.Identifier && node.matches(v)) { found = true; } return !found; }); return found; } getEntries(filter = Level.Warning | Level.Error) { return this.warnings.filter((entry) => { return (entry.getLevel() & filter) !== 0; }); } addEntry(node, rule, details) { const entry = new Marker(node, rule, this.settings.getRule(rule), details); this.warnings.push(entry); } getMissingNames(expected, actual) { const expectedClone = expected.slice(0); for (let i = 0; i < actual.length; i++) { const k = expectedClone.indexOf(actual[i]); if (k !== -1) { expectedClone[k] = null; } } let result = null; for (let i = 0; i < expectedClone.length; i++) { const curr = expectedClone[i]; if (curr) { if (result === null) { result = t("'{0}'", curr); } else { result = t("{0}, '{1}'", result, curr); } } } return result; } visitNode(node) { switch (node.type) { case NodeType.UnknownAtRule: return this.visitUnknownAtRule(node); case NodeType.Keyframe: return this.visitKeyframe(node); case NodeType.FontFace: return this.visitFontFace(node); case NodeType.Ruleset: return this.visitRuleSet(node); case NodeType.SimpleSelector: return this.visitSimpleSelector(node); case NodeType.Function: return this.visitFunction(node); case NodeType.NumericValue: return this.visitNumericValue(node); case NodeType.Import: return this.visitImport(node); case NodeType.HexColorValue: return this.visitHexColorValue(node); case NodeType.Prio: return this.visitPrio(node); case NodeType.IdentifierSelector: return this.visitIdentifierSelector(node); } return true; } completeValidations() { this.validateKeyframes(); } visitUnknownAtRule(node) { const atRuleName = node.getChild(0); if (!atRuleName) { return false; } const atDirective = this.cssDataManager.getAtDirective(atRuleName.getText()); if (atDirective) { return false; } this.addEntry(atRuleName, Rules.UnknownAtRules, `Unknown at rule ${atRuleName.getText()}`); return true; } visitKeyframe(node) { const keyword = node.getKeyword(); if (!keyword) { return false; } const text = keyword.getText(); this.keyframes.add(node.getName(), text, text !== "@keyframes" ? keyword : null); return true; } validateKeyframes() { const expected = ["@-webkit-keyframes", "@-moz-keyframes", "@-o-keyframes"]; for (const name in this.keyframes.data) { const actual = this.keyframes.data[name].names; const needsStandard = actual.indexOf("@keyframes") === -1; if (!needsStandard && actual.length === 1) { continue; } const missingVendorSpecific = this.getMissingNames(expected, actual); if (missingVendorSpecific || needsStandard) { for (const node of this.keyframes.data[name].nodes) { if (needsStandard) { const message = t("Always define standard rule '@keyframes' when defining keyframes."); this.addEntry(node, Rules.IncludeStandardPropertyWhenUsingVendorPrefix, message); } if (missingVendorSpecific) { const message = t("Always include all vendor specific rules: Missing: {0}", missingVendorSpecific); this.addEntry(node, Rules.AllVendorPrefixes, message); } } } } return true; } visitSimpleSelector(node) { const firstChar = this.documentText.charAt(node.offset); if (node.length === 1 && firstChar === "*") { this.addEntry(node, Rules.UniversalSelector); } return true; } visitIdentifierSelector(node) { this.addEntry(node, Rules.AvoidIdSelector); return true; } visitImport(node) { this.addEntry(node, Rules.ImportStatemement); return true; } visitRuleSet(node) { const declarations = node.getDeclarations(); if (!declarations) { return false; } if (!declarations.hasChildren()) { this.addEntry(node.getSelectors(), Rules.EmptyRuleSet); } const propertyTable = []; for (const element of declarations.getChildren()) { if (element instanceof Declaration) { propertyTable.push(new Element2(element)); } } const boxModel = calculateBoxModel(propertyTable); if (boxModel.width) { let properties = []; if (boxModel.right.value) { properties = union(properties, boxModel.right.properties); } if (boxModel.left.value) { properties = union(properties, boxModel.left.properties); } if (properties.length !== 0) { for (const item of properties) { this.addEntry(item.node, Rules.BewareOfBoxModelSize); } this.addEntry(boxModel.width.node, Rules.BewareOfBoxModelSize); } } if (boxModel.height) { let properties = []; if (boxModel.top.value) { properties = union(properties, boxModel.top.properties); } if (boxModel.bottom.value) { properties = union(properties, boxModel.bottom.properties); } if (properties.length !== 0) { for (const item of properties) { this.addEntry(item.node, Rules.BewareOfBoxModelSize); } this.addEntry(boxModel.height.node, Rules.BewareOfBoxModelSize); } } let displayElems = this.fetchWithValue(propertyTable, "display", "inline-block"); if (displayElems.length > 0) { const elem = this.fetch(propertyTable, "float"); for (let index = 0; index < elem.length; index++) { const node2 = elem[index].node; const value = node2.getValue(); if (value && !value.matches("none")) { this.addEntry(node2, Rules.PropertyIgnoredDueToDisplay, t("inline-block is ignored due to the float. If 'float' has a value other than 'none', the box is floated and 'display' is treated as 'block'")); } } } displayElems = this.fetchWithValue(propertyTable, "display", "block"); if (displayElems.length > 0) { const elem = this.fetch(propertyTable, "vertical-align"); for (let index = 0; index < elem.length; index++) { this.addEntry(elem[index].node, Rules.PropertyIgnoredDueToDisplay, t("Property is ignored due to the display. With 'display: block', vertical-align should not be used.")); } } const elements = this.fetch(propertyTable, "float"); for (let index = 0; index < elements.length; index++) { const element = elements[index]; if (!this.isValidPropertyDeclaration(element)) { this.addEntry(element.node, Rules.AvoidFloat); } } for (let i = 0; i < propertyTable.length; i++) { const element = propertyTable[i]; if (element.fullPropertyName !== "background" && !this.validProperties[element.fullPropertyName]) { const value = element.node.getValue(); if (value && this.documentText.charAt(value.offset) !== "-") { const elements2 = this.fetch(propertyTable, element.fullPropertyName); if (elements2.length > 1) { for (let k = 0; k < elements2.length; k++) { const value2 = elements2[k].node.getValue(); if (value2 && this.documentText.charAt(value2.offset) !== "-" && elements2[k] !== element) { this.addEntry(element.node, Rules.DuplicateDeclarations); } } } } } } const isExportBlock = node.getSelectors().matches(":export"); if (!isExportBlock) { const propertiesBySuffix = new NodesByRootMap(); let containsUnknowns = false; for (const element of propertyTable) { const decl = element.node; if (this.isCSSDeclaration(decl)) { let name = element.fullPropertyName; const firstChar = name.charAt(0); if (firstChar === "-") { if (name.charAt(1) !== "-") { if (!this.cssDataManager.isKnownProperty(name) && !this.validProperties[name]) { this.addEntry(decl.getProperty(), Rules.UnknownVendorSpecificProperty); } const nonPrefixedName = decl.getNonPrefixedPropertyName(); propertiesBySuffix.add(nonPrefixedName, name, decl.getProperty()); } } else { const fullName = name; if (firstChar === "*" || firstChar === "_") { this.addEntry(decl.getProperty(), Rules.IEStarHack); name = name.substr(1); } if (!this.cssDataManager.isKnownProperty(fullName) && !this.cssDataManager.isKnownProperty(name)) { if (!this.validProperties[name]) { this.addEntry(decl.getProperty(), Rules.UnknownProperty, t("Unknown property: '{0}'", decl.getFullPropertyName())); } } propertiesBySuffix.add(name, name, null); } } else { containsUnknowns = true; } } if (!containsUnknowns) { for (const suffix in propertiesBySuffix.data) { const entry = propertiesBySuffix.data[suffix]; const actual = entry.names; const needsStandard = this.cssDataManager.isStandardProperty(suffix) && actual.indexOf(suffix) === -1; if (!needsStandard && actual.length === 1) { continue; } const entriesThatNeedStandard = new Set(needsStandard ? entry.nodes : []); if (needsStandard) { const pseudoElements = this.getContextualVendorSpecificPseudoElements(node); for (const node2 of entry.nodes) { const propertyName = node2.getName(); const prefix = propertyName.substring(0, propertyName.length - suffix.length); if (pseudoElements.some((x) => x.startsWith(prefix))) { entriesThatNeedStandard.delete(node2); } } } const expected = []; for (let i = 0, len = _LintVisitor.prefixes.length; i < len; i++) { const prefix = _LintVisitor.prefixes[i]; if (this.cssDataManager.isStandardProperty(prefix + suffix)) { expected.push(prefix + suffix); } } const missingVendorSpecific = this.getMissingNames(expected, actual); if (missingVendorSpecific || needsStandard) { for (const node2 of entry.nodes) { if (needsStandard && entriesThatNeedStandard.has(node2)) { const message = t("Also define the standard property '{0}' for compatibility", suffix); this.addEntry(node2, Rules.IncludeStandardPropertyWhenUsingVendorPrefix, message); } if (missingVendorSpecific) { const message = t("Always include all vendor specific properties: Missing: {0}", missingVendorSpecific); this.addEntry(node2, Rules.AllVendorPrefixes, message); } } } } } } return true; } /** * Walks up the syntax tree (starting from given `node`) and captures vendor * specific pseudo-element selectors. * @returns An array of vendor specific pseudo-elements; or empty if none * was found. */ getContextualVendorSpecificPseudoElements(node) { function walkDown(s, n) { for (const child of n.getChildren()) { if (child.type === NodeType.PseudoSelector) { const pseudoElement = child.getChildren()[0]?.getText(); if (pseudoElement) { s.add(pseudoElement); } } walkDown(s, child); } } function walkUp(s, n) { if (n.type === NodeType.Ruleset) { for (const selector of n.getSelectors().getChildren()) { walkDown(s, selector); } } return n.parent ? walkUp(s, n.parent) : void 0; } const result = /* @__PURE__ */ new Set(); walkUp(result, node); return Array.from(result); } visitPrio(node) { this.addEntry(node, Rules.AvoidImportant); return true; } visitNumericValue(node) { const funcDecl = node.findParent(NodeType.Function); if (funcDecl && funcDecl.getName() === "calc") { return true; } const decl = node.findParent(NodeType.Declaration); if (decl) { const declValue = decl.getValue(); if (declValue) { const value = node.getValue(); if (!value.unit || units.length.indexOf(value.unit.toLowerCase()) === -1) { return true; } if (parseFloat(value.value) === 0 && !!value.unit && !this.validProperties[decl.getFullPropertyName()]) { this.addEntry(node, Rules.ZeroWithUnit); } } } return true; } visitFontFace(node) { const declarations = node.getDeclarations(); if (!declarations) { return false; } let definesSrc = false, definesFontFamily = false; let containsUnknowns = false; for (const node2 of declarations.getChildren()) { if (this.isCSSDeclaration(node2)) { const name = node2.getProperty().getName().toLowerCase(); if (name === "src") { definesSrc = true; } if (name === "font-family") { definesFontFamily = true; } } else { containsUnknowns = true; } } if (!containsUnknowns && (!definesSrc || !definesFontFamily)) { this.addEntry(node, Rules.RequiredPropertiesForFontFace); } return true; } isCSSDeclaration(node) { if (node instanceof Declaration) { if (!node.getValue()) { return false; } const property = node.getProperty(); if (!property) { return false; } const identifier = property.getIdentifier(); if (!identifier || identifier.containsInterpolation()) { return false; } return true; } return false; } visitHexColorValue(node) { const length = node.length; if (length !== 9 && length !== 7 && length !== 5 && length !== 4) { this.addEntry(node, Rules.HexColorLength); } return false; } visitFunction(node) { const fnName = node.getName().toLowerCase(); let expectedAttrCount = -1; let actualAttrCount = 0; switch (fnName) { case "rgb(": case "hsl(": expectedAttrCount = 3; break; case "rgba(": case "hsla(": expectedAttrCount = 4; break; } if (expectedAttrCount !== -1) { node.getArguments().accept((n) => { if (n instanceof BinaryExpression) { actualAttrCount += 1; return false; } return true; }); if (actualAttrCount !== expectedAttrCount) { this.addEntry(node, Rules.ArgsInColorFunction); } } return true; } }; LintVisitor.prefixes = [ "-ms-", "-moz-", "-o-", "-webkit-" // Quite common // '-xv-', '-atsc-', '-wap-', '-khtml-', 'mso-', 'prince-', '-ah-', '-hp-', '-ro-', '-rim-', '-tc-' // Quite un-common ]; // node_modules/vscode-css-languageservice/lib/esm/services/cssValidation.js var CSSValidation = class { constructor(cssDataManager) { this.cssDataManager = cssDataManager; } configure(settings) { this.settings = settings; } doValidation(document, stylesheet, settings = this.settings) { if (settings && settings.validate === false) { return []; } const entries = []; entries.push.apply(entries, ParseErrorCollector.entries(stylesheet)); entries.push.apply(entries, LintVisitor.entries(stylesheet, document, new LintConfigurationSettings(settings && settings.lint), this.cssDataManager)); const ruleIds = []; for (const r in Rules) { ruleIds.push(Rules[r].id); } function toDiagnostic(marker) { const range = Range.create(document.positionAt(marker.getOffset()), document.positionAt(marker.getOffset() + marker.getLength())); const source = document.languageId; return { code: marker.getRule().id, source, message: marker.getMessage(), severity: marker.getLevel() === Level.Warning ? DiagnosticSeverity.Warning : DiagnosticSeverity.Error, range }; } return entries.filter((entry) => entry.getLevel() !== Level.Ignore).map(toDiagnostic); } }; // node_modules/vscode-css-languageservice/lib/esm/parser/scssScanner.js var _FSL2 = "/".charCodeAt(0); var _NWL2 = "\n".charCodeAt(0); var _CAR2 = "\r".charCodeAt(0); var _LFD2 = "\f".charCodeAt(0); var _DLR2 = "$".charCodeAt(0); var _HSH2 = "#".charCodeAt(0); var _CUL2 = "{".charCodeAt(0); var _EQS2 = "=".charCodeAt(0); var _BNG2 = "!".charCodeAt(0); var _LAN2 = "<".charCodeAt(0); var _RAN2 = ">".charCodeAt(0); var _DOT2 = ".".charCodeAt(0); var _ATS2 = "@".charCodeAt(0); var customTokenValue = TokenType.CustomToken; var VariableName = customTokenValue++; var InterpolationFunction = customTokenValue++; var Default = customTokenValue++; var EqualsOperator = customTokenValue++; var NotEqualsOperator = customTokenValue++; var GreaterEqualsOperator = customTokenValue++; var SmallerEqualsOperator = customTokenValue++; var Ellipsis = customTokenValue++; var Module2 = customTokenValue++; var SCSSScanner = class extends Scanner { scanNext(offset) { if (this.stream.advanceIfChar(_DLR2)) { const content = ["$"]; if (this.ident(content)) { return this.finishToken(offset, VariableName, content.join("")); } else { this.stream.goBackTo(offset); } } if (this.stream.advanceIfChars([_HSH2, _CUL2])) { return this.finishToken(offset, InterpolationFunction); } if (this.stream.advanceIfChars([_EQS2, _EQS2])) { return this.finishToken(offset, EqualsOperator); } if (this.stream.advanceIfChars([_BNG2, _EQS2])) { return this.finishToken(offset, NotEqualsOperator); } if (this.stream.advanceIfChar(_LAN2)) { if (this.stream.advanceIfChar(_EQS2)) { return this.finishToken(offset, SmallerEqualsOperator); } return this.finishToken(offset, TokenType.Delim); } if (this.stream.advanceIfChar(_RAN2)) { if (this.stream.advanceIfChar(_EQS2)) { return this.finishToken(offset, GreaterEqualsOperator); } return this.finishToken(offset, TokenType.Delim); } if (this.stream.advanceIfChars([_DOT2, _DOT2, _DOT2])) { return this.finishToken(offset, Ellipsis); } return super.scanNext(offset); } comment() { if (super.comment()) { return true; } if (!this.inURL && this.stream.advanceIfChars([_FSL2, _FSL2])) { this.stream.advanceWhileChar((ch) => { switch (ch) { case _NWL2: case _CAR2: case _LFD2: return false; default: return true; } }); return true; } else { return false; } } }; // node_modules/vscode-css-languageservice/lib/esm/parser/scssErrors.js var SCSSIssueType = class { constructor(id, message) { this.id = id; this.message = message; } }; var SCSSParseError = { FromExpected: new SCSSIssueType("scss-fromexpected", t("'from' expected")), ThroughOrToExpected: new SCSSIssueType("scss-throughexpected", t("'through' or 'to' expected")), InExpected: new SCSSIssueType("scss-fromexpected", t("'in' expected")) }; // node_modules/vscode-css-languageservice/lib/esm/parser/scssParser.js var SCSSParser = class extends Parser { constructor() { super(new SCSSScanner()); } _parseStylesheetStatement(isNested = false) { if (this.peek(TokenType.AtKeyword)) { return this._parseWarnAndDebug() || this._parseControlStatement() || this._parseMixinDeclaration() || this._parseMixinContent() || this._parseMixinReference() || this._parseFunctionDeclaration() || this._parseForward() || this._parseUse() || this._parseRuleset(isNested) || super._parseStylesheetAtStatement(isNested); } return this._parseRuleset(true) || this._parseVariableDeclaration(); } _parseImport() { if (!this.peekKeyword("@import")) { return null; } const node = this.create(Import); this.consumeToken(); if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIOrStringExpected); } while (this.accept(TokenType.Comma)) { if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIOrStringExpected); } } return this._completeParseImport(node); } // scss variables: $font-size: 12px; _parseVariableDeclaration(panic = []) { if (!this.peek(VariableName)) { return null; } const node = this.create(VariableDeclaration); if (!node.setVariable(this._parseVariable())) { return null; } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected); } if (this.prevToken) { node.colonPosition = this.prevToken.offset; } if (!node.setValue(this._parseExpr())) { return this.finish(node, ParseError.VariableValueExpected, [], panic); } while (this.peek(TokenType.Exclamation)) { if (node.addChild(this._tryParsePrio())) { } else { this.consumeToken(); if (!this.peekRegExp(TokenType.Ident, /^(default|global)$/)) { return this.finish(node, ParseError.UnknownKeyword); } this.consumeToken(); } } if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); } _parseMediaCondition() { return this._parseInterpolation() || super._parseMediaCondition(); } _parseMediaFeatureRangeOperator() { return this.accept(SmallerEqualsOperator) || this.accept(GreaterEqualsOperator) || super._parseMediaFeatureRangeOperator(); } _parseMediaFeatureName() { return this._parseModuleMember() || this._parseFunction() || this._parseIdent() || this._parseVariable(); } _parseKeyframeSelector() { return this._tryParseKeyframeSelector() || this._parseControlStatement(this._parseKeyframeSelector.bind(this)) || this._parseWarnAndDebug() || this._parseMixinReference() || this._parseFunctionDeclaration() || this._parseVariableDeclaration() || this._parseMixinContent(); } _parseVariable() { if (!this.peek(VariableName)) { return null; } const node = this.create(Variable); this.consumeToken(); return node; } _parseModuleMember() { const pos = this.mark(); const node = this.create(Module); if (!node.setIdentifier(this._parseIdent([ReferenceType.Module]))) { return null; } if (this.hasWhitespace() || !this.acceptDelim(".") || this.hasWhitespace()) { this.restoreAtMark(pos); return null; } if (!node.addChild(this._parseVariable() || this._parseFunction())) { return this.finish(node, ParseError.IdentifierOrVariableExpected); } return node; } _parseIdent(referenceTypes) { if (!this.peek(TokenType.Ident) && !this.peek(InterpolationFunction) && !this.peekDelim("-")) { return null; } const node = this.create(Identifier); node.referenceTypes = referenceTypes; node.isCustomProperty = this.peekRegExp(TokenType.Ident, /^--/); let hasContent = false; const indentInterpolation = () => { const pos = this.mark(); if (this.acceptDelim("-")) { if (!this.hasWhitespace()) { this.acceptDelim("-"); } if (this.hasWhitespace()) { this.restoreAtMark(pos); return null; } } return this._parseInterpolation(); }; while (this.accept(TokenType.Ident) || node.addChild(indentInterpolation()) || hasContent && this.acceptRegexp(/^[\w-]/)) { hasContent = true; if (this.hasWhitespace()) { break; } } return hasContent ? this.finish(node) : null; } _parseTermExpression() { return this._parseModuleMember() || this._parseVariable() || this._parseNestingSelector() || //this._tryParsePrio() || super._parseTermExpression(); } _parseInterpolation() { if (this.peek(InterpolationFunction)) { const node = this.create(Interpolation); this.consumeToken(); if (!node.addChild(this._parseExpr()) && !this._parseNestingSelector()) { if (this.accept(TokenType.CurlyR)) { return this.finish(node); } return this.finish(node, ParseError.ExpressionExpected); } if (!this.accept(TokenType.CurlyR)) { return this.finish(node, ParseError.RightCurlyExpected); } return this.finish(node); } return null; } _parseOperator() { if (this.peek(EqualsOperator) || this.peek(NotEqualsOperator) || this.peek(GreaterEqualsOperator) || this.peek(SmallerEqualsOperator) || this.peekDelim(">") || this.peekDelim("<") || this.peekIdent("and") || this.peekIdent("or") || this.peekDelim("%")) { const node = this.createNode(NodeType.Operator); this.consumeToken(); return this.finish(node); } return super._parseOperator(); } _parseUnaryOperator() { if (this.peekIdent("not")) { const node = this.create(Node); this.consumeToken(); return this.finish(node); } return super._parseUnaryOperator(); } _parseRuleSetDeclaration() { if (this.peek(TokenType.AtKeyword)) { return this._parseKeyframe() || this._parseImport() || this._parseMedia(true) || this._parseFontFace() || this._parseWarnAndDebug() || this._parseControlStatement() || this._parseFunctionDeclaration() || this._parseExtends() || this._parseMixinReference() || this._parseMixinContent() || this._parseMixinDeclaration() || this._parseRuleset(true) || this._parseSupports(true) || this._parseLayer() || this._parsePropertyAtRule() || this._parseContainer(true) || this._parseRuleSetDeclarationAtStatement(); } return this._parseVariableDeclaration() || this._tryParseRuleset(true) || this._parseDeclaration(); } _parseDeclaration(stopTokens) { const custonProperty = this._tryParseCustomPropertyDeclaration(stopTokens); if (custonProperty) { return custonProperty; } const node = this.create(Declaration); if (!node.setProperty(this._parseProperty())) { return null; } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected, [TokenType.Colon], stopTokens || [TokenType.SemiColon]); } if (this.prevToken) { node.colonPosition = this.prevToken.offset; } let hasContent = false; if (node.setValue(this._parseExpr())) { hasContent = true; node.addChild(this._parsePrio()); } if (this.peek(TokenType.CurlyL)) { node.setNestedProperties(this._parseNestedProperties()); } else { if (!hasContent) { return this.finish(node, ParseError.PropertyValueExpected); } } if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); } _parseNestedProperties() { const node = this.create(NestedProperties); return this._parseBody(node, this._parseDeclaration.bind(this)); } _parseExtends() { if (this.peekKeyword("@extend")) { const node = this.create(ExtendsReference); this.consumeToken(); if (!node.getSelectors().addChild(this._parseSimpleSelector())) { return this.finish(node, ParseError.SelectorExpected); } while (this.accept(TokenType.Comma)) { node.getSelectors().addChild(this._parseSimpleSelector()); } if (this.accept(TokenType.Exclamation)) { if (!this.acceptIdent("optional")) { return this.finish(node, ParseError.UnknownKeyword); } } return this.finish(node); } return null; } _parseSimpleSelectorBody() { return this._parseSelectorPlaceholder() || super._parseSimpleSelectorBody(); } _parseNestingSelector() { if (this.peekDelim("&")) { const node = this.createNode(NodeType.SelectorCombinator); this.consumeToken(); while (!this.hasWhitespace() && (this.acceptDelim("-") || this.accept(TokenType.Num) || this.accept(TokenType.Dimension) || node.addChild(this._parseIdent()) || this.acceptDelim("&"))) { } return this.finish(node); } return null; } _parseSelectorPlaceholder() { if (this.peekDelim("%")) { const node = this.createNode(NodeType.SelectorPlaceholder); this.consumeToken(); this._parseIdent(); return this.finish(node); } else if (this.peekKeyword("@at-root")) { const node = this.createNode(NodeType.SelectorPlaceholder); this.consumeToken(); if (this.accept(TokenType.ParenthesisL)) { if (!this.acceptIdent("with") && !this.acceptIdent("without")) { return this.finish(node, ParseError.IdentifierExpected); } if (!this.accept(TokenType.Colon)) { return this.finish(node, ParseError.ColonExpected); } if (!node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.CurlyR]); } } return this.finish(node); } return null; } _parseElementName() { const pos = this.mark(); const node = super._parseElementName(); if (node && !this.hasWhitespace() && this.peek(TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } return node; } _tryParsePseudoIdentifier() { return this._parseInterpolation() || super._tryParsePseudoIdentifier(); } _parseWarnAndDebug() { if (!this.peekKeyword("@debug") && !this.peekKeyword("@warn") && !this.peekKeyword("@error")) { return null; } const node = this.createNode(NodeType.Debug); this.consumeToken(); node.addChild(this._parseExpr()); return this.finish(node); } _parseControlStatement(parseStatement = this._parseRuleSetDeclaration.bind(this)) { if (!this.peek(TokenType.AtKeyword)) { return null; } return this._parseIfStatement(parseStatement) || this._parseForStatement(parseStatement) || this._parseEachStatement(parseStatement) || this._parseWhileStatement(parseStatement); } _parseIfStatement(parseStatement) { if (!this.peekKeyword("@if")) { return null; } return this._internalParseIfStatement(parseStatement); } _internalParseIfStatement(parseStatement) { const node = this.create(IfStatement); this.consumeToken(); if (!node.setExpression(this._parseExpr(true))) { return this.finish(node, ParseError.ExpressionExpected); } this._parseBody(node, parseStatement); if (this.acceptKeyword("@else")) { if (this.peekIdent("if")) { node.setElseClause(this._internalParseIfStatement(parseStatement)); } else if (this.peek(TokenType.CurlyL)) { const elseNode = this.create(ElseStatement); this._parseBody(elseNode, parseStatement); node.setElseClause(elseNode); } } return this.finish(node); } _parseForStatement(parseStatement) { if (!this.peekKeyword("@for")) { return null; } const node = this.create(ForStatement); this.consumeToken(); if (!node.setVariable(this._parseVariable())) { return this.finish(node, ParseError.VariableNameExpected, [TokenType.CurlyR]); } if (!this.acceptIdent("from")) { return this.finish(node, SCSSParseError.FromExpected, [TokenType.CurlyR]); } if (!node.addChild(this._parseBinaryExpr())) { return this.finish(node, ParseError.ExpressionExpected, [TokenType.CurlyR]); } if (!this.acceptIdent("to") && !this.acceptIdent("through")) { return this.finish(node, SCSSParseError.ThroughOrToExpected, [TokenType.CurlyR]); } if (!node.addChild(this._parseBinaryExpr())) { return this.finish(node, ParseError.ExpressionExpected, [TokenType.CurlyR]); } return this._parseBody(node, parseStatement); } _parseEachStatement(parseStatement) { if (!this.peekKeyword("@each")) { return null; } const node = this.create(EachStatement); this.consumeToken(); const variables = node.getVariables(); if (!variables.addChild(this._parseVariable())) { return this.finish(node, ParseError.VariableNameExpected, [TokenType.CurlyR]); } while (this.accept(TokenType.Comma)) { if (!variables.addChild(this._parseVariable())) { return this.finish(node, ParseError.VariableNameExpected, [TokenType.CurlyR]); } } this.finish(variables); if (!this.acceptIdent("in")) { return this.finish(node, SCSSParseError.InExpected, [TokenType.CurlyR]); } if (!node.addChild(this._parseExpr())) { return this.finish(node, ParseError.ExpressionExpected, [TokenType.CurlyR]); } return this._parseBody(node, parseStatement); } _parseWhileStatement(parseStatement) { if (!this.peekKeyword("@while")) { return null; } const node = this.create(WhileStatement); this.consumeToken(); if (!node.addChild(this._parseBinaryExpr())) { return this.finish(node, ParseError.ExpressionExpected, [TokenType.CurlyR]); } return this._parseBody(node, parseStatement); } _parseFunctionBodyDeclaration() { return this._parseVariableDeclaration() || this._parseReturnStatement() || this._parseWarnAndDebug() || this._parseControlStatement(this._parseFunctionBodyDeclaration.bind(this)); } _parseFunctionDeclaration() { if (!this.peekKeyword("@function")) { return null; } const node = this.create(FunctionDeclaration); this.consumeToken(); if (!node.setIdentifier(this._parseIdent([ReferenceType.Function]))) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.CurlyR]); } if (node.getParameters().addChild(this._parseParameterDeclaration())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseParameterDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.CurlyR]); } return this._parseBody(node, this._parseFunctionBodyDeclaration.bind(this)); } _parseReturnStatement() { if (!this.peekKeyword("@return")) { return null; } const node = this.createNode(NodeType.ReturnStatement); this.consumeToken(); if (!node.addChild(this._parseExpr())) { return this.finish(node, ParseError.ExpressionExpected); } return this.finish(node); } _parseMixinDeclaration() { if (!this.peekKeyword("@mixin")) { return null; } const node = this.create(MixinDeclaration); this.consumeToken(); if (!node.setIdentifier(this._parseIdent([ReferenceType.Mixin]))) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } if (this.accept(TokenType.ParenthesisL)) { if (node.getParameters().addChild(this._parseParameterDeclaration())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseParameterDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.CurlyR]); } } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); } _parseParameterDeclaration() { const node = this.create(FunctionParameter); if (!node.setIdentifier(this._parseVariable())) { return null; } if (this.accept(Ellipsis)) { } if (this.accept(TokenType.Colon)) { if (!node.setDefaultValue(this._parseExpr(true))) { return this.finish(node, ParseError.VariableValueExpected, [], [TokenType.Comma, TokenType.ParenthesisR]); } } return this.finish(node); } _parseMixinContent() { if (!this.peekKeyword("@content")) { return null; } const node = this.create(MixinContentReference); this.consumeToken(); if (this.accept(TokenType.ParenthesisL)) { if (node.getArguments().addChild(this._parseFunctionArgument())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseFunctionArgument())) { return this.finish(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } return this.finish(node); } _parseMixinReference() { if (!this.peekKeyword("@include")) { return null; } const node = this.create(MixinReference); this.consumeToken(); const firstIdent = this._parseIdent([ReferenceType.Mixin]); if (!node.setIdentifier(firstIdent)) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } if (!this.hasWhitespace() && this.acceptDelim(".") && !this.hasWhitespace()) { const secondIdent = this._parseIdent([ReferenceType.Mixin]); if (!secondIdent) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]); } const moduleToken = this.create(Module); firstIdent.referenceTypes = [ReferenceType.Module]; moduleToken.setIdentifier(firstIdent); node.setIdentifier(secondIdent); node.addChild(moduleToken); } if (this.accept(TokenType.ParenthesisL)) { if (node.getArguments().addChild(this._parseFunctionArgument())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseFunctionArgument())) { return this.finish(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } if (this.peekIdent("using") || this.peek(TokenType.CurlyL)) { node.setContent(this._parseMixinContentDeclaration()); } return this.finish(node); } _parseMixinContentDeclaration() { const node = this.create(MixinContentDeclaration); if (this.acceptIdent("using")) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.CurlyL]); } if (node.getParameters().addChild(this._parseParameterDeclaration())) { while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseParameterDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.CurlyL]); } } if (this.peek(TokenType.CurlyL)) { this._parseBody(node, this._parseMixinReferenceBodyStatement.bind(this)); } return this.finish(node); } _parseMixinReferenceBodyStatement() { return this._tryParseKeyframeSelector() || this._parseRuleSetDeclaration(); } _parseFunctionArgument() { const node = this.create(FunctionArgument); const pos = this.mark(); const argument = this._parseVariable(); if (argument) { if (!this.accept(TokenType.Colon)) { if (this.accept(Ellipsis)) { node.setValue(argument); return this.finish(node); } else { this.restoreAtMark(pos); } } else { node.setIdentifier(argument); } } if (node.setValue(this._parseExpr(true))) { this.accept(Ellipsis); node.addChild(this._parsePrio()); return this.finish(node); } else if (node.setValue(this._tryParsePrio())) { return this.finish(node); } return null; } _parseURLArgument() { const pos = this.mark(); const node = super._parseURLArgument(); if (!node || !this.peek(TokenType.ParenthesisR)) { this.restoreAtMark(pos); const node2 = this.create(Node); node2.addChild(this._parseBinaryExpr()); return this.finish(node2); } return node; } _parseOperation() { if (!this.peek(TokenType.ParenthesisL)) { return null; } const node = this.create(Node); this.consumeToken(); while (node.addChild(this._parseListElement())) { this.accept(TokenType.Comma); } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); } _parseListElement() { const node = this.create(ListEntry); const child = this._parseBinaryExpr(); if (!child) { return null; } if (this.accept(TokenType.Colon)) { node.setKey(child); if (!node.setValue(this._parseBinaryExpr())) { return this.finish(node, ParseError.ExpressionExpected); } } else { node.setValue(child); } return this.finish(node); } _parseUse() { if (!this.peekKeyword("@use")) { return null; } const node = this.create(Use); this.consumeToken(); if (!node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.StringLiteralExpected); } if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { if (!this.peekRegExp(TokenType.Ident, /as|with/)) { return this.finish(node, ParseError.UnknownKeyword); } if (this.acceptIdent("as") && (!node.setIdentifier(this._parseIdent([ReferenceType.Module])) && !this.acceptDelim("*"))) { return this.finish(node, ParseError.IdentifierOrWildcardExpected); } if (this.acceptIdent("with")) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.ParenthesisR]); } if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } } if (!this.accept(TokenType.SemiColon) && !this.accept(TokenType.EOF)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); } _parseModuleConfigDeclaration() { const node = this.create(ModuleConfiguration); if (!node.setIdentifier(this._parseVariable())) { return null; } if (!this.accept(TokenType.Colon) || !node.setValue(this._parseExpr(true))) { return this.finish(node, ParseError.VariableValueExpected, [], [TokenType.Comma, TokenType.ParenthesisR]); } if (this.accept(TokenType.Exclamation)) { if (this.hasWhitespace() || !this.acceptIdent("default")) { return this.finish(node, ParseError.UnknownKeyword); } } return this.finish(node); } _parseForward() { if (!this.peekKeyword("@forward")) { return null; } const node = this.create(Forward); this.consumeToken(); if (!node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.StringLiteralExpected); } if (this.acceptIdent("as")) { const identifier = this._parseIdent([ReferenceType.Forward]); if (!node.setIdentifier(identifier)) { return this.finish(node, ParseError.IdentifierExpected); } if (this.hasWhitespace() || !this.acceptDelim("*")) { return this.finish(node, ParseError.WildcardExpected); } } if (this.acceptIdent("with")) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.ParenthesisR]); } if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } while (this.accept(TokenType.Comma)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { return this.finish(node, ParseError.VariableNameExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } } else if (this.peekIdent("hide") || this.peekIdent("show")) { if (!node.addChild(this._parseForwardVisibility())) { return this.finish(node, ParseError.IdentifierOrVariableExpected); } } if (!this.accept(TokenType.SemiColon) && !this.accept(TokenType.EOF)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); } _parseForwardVisibility() { const node = this.create(ForwardVisibility); node.setIdentifier(this._parseIdent()); while (node.addChild(this._parseVariable() || this._parseIdent())) { this.accept(TokenType.Comma); } return node.getChildren().length > 1 ? node : null; } _parseSupportsCondition() { return this._parseInterpolation() || super._parseSupportsCondition(); } }; // node_modules/vscode-css-languageservice/lib/esm/services/scssCompletion.js var sassDocumentationName = t("Sass documentation"); var SCSSCompletion = class _SCSSCompletion extends CSSCompletion { constructor(lsServiceOptions, cssDataManager) { super("$", lsServiceOptions, cssDataManager); addReferencesToDocumentation(_SCSSCompletion.scssModuleLoaders); addReferencesToDocumentation(_SCSSCompletion.scssModuleBuiltIns); } isImportPathParent(type) { return type === NodeType.Forward || type === NodeType.Use || super.isImportPathParent(type); } getCompletionForImportPath(importPathNode, result) { const parentType = importPathNode.getParent().type; if (parentType === NodeType.Forward || parentType === NodeType.Use) { for (let p of _SCSSCompletion.scssModuleBuiltIns) { const item = { label: p.label, documentation: p.documentation, textEdit: TextEdit.replace(this.getCompletionRange(importPathNode), `'${p.label}'`), kind: CompletionItemKind.Module }; result.items.push(item); } } return super.getCompletionForImportPath(importPathNode, result); } createReplaceFunction() { let tabStopCounter = 1; return (_match, p1) => { return "\\" + p1 + ": ${" + tabStopCounter++ + ":" + (_SCSSCompletion.variableDefaults[p1] || "") + "}"; }; } createFunctionProposals(proposals, existingNode, sortToEnd, result) { for (const p of proposals) { const insertText = p.func.replace(/\[?(\$\w+)\]?/g, this.createReplaceFunction()); const label = p.func.substr(0, p.func.indexOf("(")); const item = { label, detail: p.func, documentation: p.desc, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), insertText), insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Function }; if (sortToEnd) { item.sortText = "z"; } result.items.push(item); } return result; } getCompletionsForSelector(ruleSet, isNested, result) { this.createFunctionProposals(_SCSSCompletion.selectorFuncs, null, true, result); return super.getCompletionsForSelector(ruleSet, isNested, result); } getTermProposals(entry, existingNode, result) { let functions = _SCSSCompletion.builtInFuncs; if (entry) { functions = functions.filter((f2) => !f2.type || !entry.restrictions || entry.restrictions.indexOf(f2.type) !== -1); } this.createFunctionProposals(functions, existingNode, true, result); return super.getTermProposals(entry, existingNode, result); } getColorProposals(entry, existingNode, result) { this.createFunctionProposals(_SCSSCompletion.colorProposals, existingNode, false, result); return super.getColorProposals(entry, existingNode, result); } getCompletionsForDeclarationProperty(declaration, result) { this.getCompletionForAtDirectives(result); this.getCompletionsForSelector(null, true, result); return super.getCompletionsForDeclarationProperty(declaration, result); } getCompletionsForExtendsReference(_extendsRef, existingNode, result) { const symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, ReferenceType.Rule); for (const symbol of symbols) { const suggest = { label: symbol.name, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), symbol.name), kind: CompletionItemKind.Function }; result.items.push(suggest); } return result; } getCompletionForAtDirectives(result) { result.items.push(..._SCSSCompletion.scssAtDirectives); return result; } getCompletionForTopLevel(result) { this.getCompletionForAtDirectives(result); this.getCompletionForModuleLoaders(result); super.getCompletionForTopLevel(result); return result; } getCompletionForModuleLoaders(result) { result.items.push(..._SCSSCompletion.scssModuleLoaders); return result; } }; SCSSCompletion.variableDefaults = { "$red": "1", "$green": "2", "$blue": "3", "$alpha": "1.0", "$color": "#000000", "$weight": "0.5", "$hue": "0", "$saturation": "0%", "$lightness": "0%", "$degrees": "0", "$amount": "0", "$string": '""', "$substring": '"s"', "$number": "0", "$limit": "1" }; SCSSCompletion.colorProposals = [ { func: "red($color)", desc: t("Gets the red component of a color.") }, { func: "green($color)", desc: t("Gets the green component of a color.") }, { func: "blue($color)", desc: t("Gets the blue component of a color.") }, { func: "mix($color, $color, [$weight])", desc: t("Mixes two colors together.") }, { func: "hue($color)", desc: t("Gets the hue component of a color.") }, { func: "saturation($color)", desc: t("Gets the saturation component of a color.") }, { func: "lightness($color)", desc: t("Gets the lightness component of a color.") }, { func: "adjust-hue($color, $degrees)", desc: t("Changes the hue of a color.") }, { func: "lighten($color, $amount)", desc: t("Makes a color lighter.") }, { func: "darken($color, $amount)", desc: t("Makes a color darker.") }, { func: "saturate($color, $amount)", desc: t("Makes a color more saturated.") }, { func: "desaturate($color, $amount)", desc: t("Makes a color less saturated.") }, { func: "grayscale($color)", desc: t("Converts a color to grayscale.") }, { func: "complement($color)", desc: t("Returns the complement of a color.") }, { func: "invert($color)", desc: t("Returns the inverse of a color.") }, { func: "alpha($color)", desc: t("Gets the opacity component of a color.") }, { func: "opacity($color)", desc: "Gets the alpha component (opacity) of a color." }, { func: "rgba($color, $alpha)", desc: t("Changes the alpha component for a color.") }, { func: "opacify($color, $amount)", desc: t("Makes a color more opaque.") }, { func: "fade-in($color, $amount)", desc: t("Makes a color more opaque.") }, { func: "transparentize($color, $amount)", desc: t("Makes a color more transparent.") }, { func: "fade-out($color, $amount)", desc: t("Makes a color more transparent.") }, { func: "adjust-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])", desc: t("Increases or decreases one or more components of a color.") }, { func: "scale-color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])", desc: t("Fluidly scales one or more properties of a color.") }, { func: "change-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])", desc: t("Changes one or more properties of a color.") }, { func: "ie-hex-str($color)", desc: t("Converts a color into the format understood by IE filters.") } ]; SCSSCompletion.selectorFuncs = [ { func: "selector-nest($selectors\u2026)", desc: t("Nests selector beneath one another like they would be nested in the stylesheet.") }, { func: "selector-append($selectors\u2026)", desc: t("Appends selectors to one another without spaces in between.") }, { func: "selector-extend($selector, $extendee, $extender)", desc: t("Extends $extendee with $extender within $selector.") }, { func: "selector-replace($selector, $original, $replacement)", desc: t("Replaces $original with $replacement within $selector.") }, { func: "selector-unify($selector1, $selector2)", desc: t("Unifies two selectors to produce a selector that matches elements matched by both.") }, { func: "is-superselector($super, $sub)", desc: t("Returns whether $super matches all the elements $sub does, and possibly more.") }, { func: "simple-selectors($selector)", desc: t("Returns the simple selectors that comprise a compound selector.") }, { func: "selector-parse($selector)", desc: t("Parses a selector into the format returned by &.") } ]; SCSSCompletion.builtInFuncs = [ { func: "unquote($string)", desc: t("Removes quotes from a string.") }, { func: "quote($string)", desc: t("Adds quotes to a string.") }, { func: "str-length($string)", desc: t("Returns the number of characters in a string.") }, { func: "str-insert($string, $insert, $index)", desc: t("Inserts $insert into $string at $index.") }, { func: "str-index($string, $substring)", desc: t("Returns the index of the first occurance of $substring in $string.") }, { func: "str-slice($string, $start-at, [$end-at])", desc: t("Extracts a substring from $string.") }, { func: "to-upper-case($string)", desc: t("Converts a string to upper case.") }, { func: "to-lower-case($string)", desc: t("Converts a string to lower case.") }, { func: "percentage($number)", desc: t("Converts a unitless number to a percentage."), type: "percentage" }, { func: "round($number)", desc: t("Rounds a number to the nearest whole number.") }, { func: "ceil($number)", desc: t("Rounds a number up to the next whole number.") }, { func: "floor($number)", desc: t("Rounds a number down to the previous whole number.") }, { func: "abs($number)", desc: t("Returns the absolute value of a number.") }, { func: "min($numbers)", desc: t("Finds the minimum of several numbers.") }, { func: "max($numbers)", desc: t("Finds the maximum of several numbers.") }, { func: "random([$limit])", desc: t("Returns a random number.") }, { func: "length($list)", desc: t("Returns the length of a list.") }, { func: "nth($list, $n)", desc: t("Returns a specific item in a list.") }, { func: "set-nth($list, $n, $value)", desc: t("Replaces the nth item in a list.") }, { func: "join($list1, $list2, [$separator])", desc: t("Joins together two lists into one.") }, { func: "append($list1, $val, [$separator])", desc: t("Appends a single value onto the end of a list.") }, { func: "zip($lists)", desc: t("Combines several lists into a single multidimensional list.") }, { func: "index($list, $value)", desc: t("Returns the position of a value within a list.") }, { func: "list-separator(#list)", desc: t("Returns the separator of a list.") }, { func: "map-get($map, $key)", desc: t("Returns the value in a map associated with a given key.") }, { func: "map-merge($map1, $map2)", desc: t("Merges two maps together into a new map.") }, { func: "map-remove($map, $keys)", desc: t("Returns a new map with keys removed.") }, { func: "map-keys($map)", desc: t("Returns a list of all keys in a map.") }, { func: "map-values($map)", desc: t("Returns a list of all values in a map.") }, { func: "map-has-key($map, $key)", desc: t("Returns whether a map has a value associated with a given key.") }, { func: "keywords($args)", desc: t("Returns the keywords passed to a function that takes variable arguments.") }, { func: "feature-exists($feature)", desc: t("Returns whether a feature exists in the current Sass runtime.") }, { func: "variable-exists($name)", desc: t("Returns whether a variable with the given name exists in the current scope.") }, { func: "global-variable-exists($name)", desc: t("Returns whether a variable with the given name exists in the global scope.") }, { func: "function-exists($name)", desc: t("Returns whether a function with the given name exists.") }, { func: "mixin-exists($name)", desc: t("Returns whether a mixin with the given name exists.") }, { func: "inspect($value)", desc: t("Returns the string representation of a value as it would be represented in Sass.") }, { func: "type-of($value)", desc: t("Returns the type of a value.") }, { func: "unit($number)", desc: t("Returns the unit(s) associated with a number.") }, { func: "unitless($number)", desc: t("Returns whether a number has units.") }, { func: "comparable($number1, $number2)", desc: t("Returns whether two numbers can be added, subtracted, or compared.") }, { func: "call($name, $args\u2026)", desc: t("Dynamically calls a Sass function.") } ]; SCSSCompletion.scssAtDirectives = [ { label: "@extend", documentation: t("Inherits the styles of another selector."), kind: CompletionItemKind.Keyword }, { label: "@at-root", documentation: t("Causes one or more rules to be emitted at the root of the document."), kind: CompletionItemKind.Keyword }, { label: "@debug", documentation: t("Prints the value of an expression to the standard error output stream. Useful for debugging complicated Sass files."), kind: CompletionItemKind.Keyword }, { label: "@warn", documentation: t("Prints the value of an expression to the standard error output stream. Useful for libraries that need to warn users of deprecations or recovering from minor mixin usage mistakes. Warnings can be turned off with the `--quiet` command-line option or the `:quiet` Sass option."), kind: CompletionItemKind.Keyword }, { label: "@error", documentation: t("Throws the value of an expression as a fatal error with stack trace. Useful for validating arguments to mixins and functions."), kind: CompletionItemKind.Keyword }, { label: "@if", documentation: t("Includes the body if the expression does not evaluate to `false` or `null`."), insertText: "@if ${1:expr} {\n $0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@for", documentation: t("For loop that repeatedly outputs a set of styles for each `$var` in the `from/through` or `from/to` clause."), insertText: "@for \\$${1:var} from ${2:start} ${3|to,through|} ${4:end} {\n $0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@each", documentation: t("Each loop that sets `$var` to each item in the list or map, then outputs the styles it contains using that value of `$var`."), insertText: "@each \\$${1:var} in ${2:list} {\n $0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@while", documentation: t("While loop that takes an expression and repeatedly outputs the nested styles until the statement evaluates to `false`."), insertText: "@while ${1:condition} {\n $0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@mixin", documentation: t("Defines styles that can be re-used throughout the stylesheet with `@include`."), insertText: "@mixin ${1:name} {\n $0\n}", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@include", documentation: t("Includes the styles defined by another mixin into the current rule."), kind: CompletionItemKind.Keyword }, { label: "@function", documentation: t("Defines complex operations that can be re-used throughout stylesheets."), kind: CompletionItemKind.Keyword } ]; SCSSCompletion.scssModuleLoaders = [ { label: "@use", documentation: t("Loads mixins, functions, and variables from other Sass stylesheets as 'modules', and combines CSS from multiple stylesheets together."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/at-rules/use" }], insertText: "@use $0;", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword }, { label: "@forward", documentation: t("Loads a Sass stylesheet and makes its mixins, functions, and variables available when this stylesheet is loaded with the @use rule."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/at-rules/forward" }], insertText: "@forward $0;", insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Keyword } ]; SCSSCompletion.scssModuleBuiltIns = [ { label: "sass:math", documentation: t("Provides functions that operate on numbers."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/modules/math" }] }, { label: "sass:string", documentation: t("Makes it easy to combine, search, or split apart strings."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/modules/string" }] }, { label: "sass:color", documentation: t("Generates new colors based on existing ones, making it easy to build color themes."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/modules/color" }] }, { label: "sass:list", documentation: t("Lets you access and modify values in lists."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/modules/list" }] }, { label: "sass:map", documentation: t("Makes it possible to look up the value associated with a key in a map, and much more."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/modules/map" }] }, { label: "sass:selector", documentation: t("Provides access to Sass\u2019s powerful selector engine."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/modules/selector" }] }, { label: "sass:meta", documentation: t("Exposes the details of Sass\u2019s inner workings."), references: [{ name: sassDocumentationName, url: "https://sass-lang.com/documentation/modules/meta" }] } ]; function addReferencesToDocumentation(items) { items.forEach((i) => { if (i.documentation && i.references && i.references.length > 0) { const markdownDoc = typeof i.documentation === "string" ? { kind: "markdown", value: i.documentation } : { kind: "markdown", value: i.documentation.value }; markdownDoc.value += "\n\n"; markdownDoc.value += i.references.map((r) => { return `[${r.name}](${r.url})`; }).join(" | "); i.documentation = markdownDoc; } }); } // node_modules/vscode-css-languageservice/lib/esm/parser/lessScanner.js var _FSL3 = "/".charCodeAt(0); var _NWL3 = "\n".charCodeAt(0); var _CAR3 = "\r".charCodeAt(0); var _LFD3 = "\f".charCodeAt(0); var _TIC = "`".charCodeAt(0); var _DOT3 = ".".charCodeAt(0); var customTokenValue2 = TokenType.CustomToken; var Ellipsis2 = customTokenValue2++; var LESSScanner = class extends Scanner { scanNext(offset) { const tokenType = this.escapedJavaScript(); if (tokenType !== null) { return this.finishToken(offset, tokenType); } if (this.stream.advanceIfChars([_DOT3, _DOT3, _DOT3])) { return this.finishToken(offset, Ellipsis2); } return super.scanNext(offset); } comment() { if (super.comment()) { return true; } if (!this.inURL && this.stream.advanceIfChars([_FSL3, _FSL3])) { this.stream.advanceWhileChar((ch) => { switch (ch) { case _NWL3: case _CAR3: case _LFD3: return false; default: return true; } }); return true; } else { return false; } } escapedJavaScript() { const ch = this.stream.peekChar(); if (ch === _TIC) { this.stream.advance(1); this.stream.advanceWhileChar((ch2) => { return ch2 !== _TIC; }); return this.stream.advanceIfChar(_TIC) ? TokenType.EscapedJavaScript : TokenType.BadEscapedJavaScript; } return null; } }; // node_modules/vscode-css-languageservice/lib/esm/parser/lessParser.js var LESSParser = class extends Parser { constructor() { super(new LESSScanner()); } _parseStylesheetStatement(isNested = false) { if (this.peek(TokenType.AtKeyword)) { return this._parseVariableDeclaration() || this._parsePlugin() || super._parseStylesheetAtStatement(isNested); } return this._tryParseMixinDeclaration() || this._tryParseMixinReference() || this._parseFunction() || this._parseRuleset(true); } _parseImport() { if (!this.peekKeyword("@import") && !this.peekKeyword("@import-once")) { return null; } const node = this.create(Import); this.consumeToken(); if (this.accept(TokenType.ParenthesisL)) { if (!this.accept(TokenType.Ident)) { return this.finish(node, ParseError.IdentifierExpected, [TokenType.SemiColon]); } do { if (!this.accept(TokenType.Comma)) { break; } } while (this.accept(TokenType.Ident)); if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected, [TokenType.SemiColon]); } } if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.URIOrStringExpected, [TokenType.SemiColon]); } if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { node.setMedialist(this._parseMediaQueryList()); } return this._completeParseImport(node); } _parsePlugin() { if (!this.peekKeyword("@plugin")) { return null; } const node = this.createNode(NodeType.Plugin); this.consumeToken(); if (!node.addChild(this._parseStringLiteral())) { return this.finish(node, ParseError.StringLiteralExpected); } if (!this.accept(TokenType.SemiColon)) { return this.finish(node, ParseError.SemiColonExpected); } return this.finish(node); } _parseMediaQuery() { const node = super._parseMediaQuery(); if (!node) { const node2 = this.create(MediaQuery); if (node2.addChild(this._parseVariable())) { return this.finish(node2); } return null; } return node; } _parseMediaDeclaration(isNested = false) { return this._tryParseRuleset(isNested) || this._tryToParseDeclaration() || this._tryParseMixinDeclaration() || this._tryParseMixinReference() || this._parseDetachedRuleSetMixin() || this._parseStylesheetStatement(isNested); } _parseMediaFeatureName() { return this._parseIdent() || this._parseVariable(); } _parseVariableDeclaration(panic = []) { const node = this.create(VariableDeclaration); const mark = this.mark(); if (!node.setVariable(this._parseVariable(true))) { return null; } if (this.accept(TokenType.Colon)) { if (this.prevToken) { node.colonPosition = this.prevToken.offset; } if (node.setValue(this._parseDetachedRuleSet())) { node.needsSemicolon = false; } else if (!node.setValue(this._parseExpr())) { return this.finish(node, ParseError.VariableValueExpected, [], panic); } node.addChild(this._parsePrio()); } else { this.restoreAtMark(mark); return null; } if (this.peek(TokenType.SemiColon)) { node.semicolonPosition = this.token.offset; } return this.finish(node); } _parseDetachedRuleSet() { let mark = this.mark(); if (this.peekDelim("#") || this.peekDelim(".")) { this.consumeToken(); if (!this.hasWhitespace() && this.accept(TokenType.ParenthesisL)) { let node = this.create(MixinDeclaration); if (node.getParameters().addChild(this._parseMixinParameter())) { while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseMixinParameter())) { this.markError(node, ParseError.IdentifierExpected, [], [TokenType.ParenthesisR]); } } } if (!this.accept(TokenType.ParenthesisR)) { this.restoreAtMark(mark); return null; } } else { this.restoreAtMark(mark); return null; } } if (!this.peek(TokenType.CurlyL)) { return null; } const content = this.create(BodyDeclaration); this._parseBody(content, this._parseDetachedRuleSetBody.bind(this)); return this.finish(content); } _parseDetachedRuleSetBody() { return this._tryParseKeyframeSelector() || this._parseRuleSetDeclaration(); } _addLookupChildren(node) { if (!node.addChild(this._parseLookupValue())) { return false; } let expectsValue = false; while (true) { if (this.peek(TokenType.BracketL)) { expectsValue = true; } if (!node.addChild(this._parseLookupValue())) { break; } expectsValue = false; } return !expectsValue; } _parseLookupValue() { const node = this.create(Node); const mark = this.mark(); if (!this.accept(TokenType.BracketL)) { this.restoreAtMark(mark); return null; } if ((node.addChild(this._parseVariable(false, true)) || node.addChild(this._parsePropertyIdentifier())) && this.accept(TokenType.BracketR) || this.accept(TokenType.BracketR)) { return node; } this.restoreAtMark(mark); return null; } _parseVariable(declaration = false, insideLookup = false) { const isPropertyReference = !declaration && this.peekDelim("$"); if (!this.peekDelim("@") && !isPropertyReference && !this.peek(TokenType.AtKeyword)) { return null; } const node = this.create(Variable); const mark = this.mark(); while (this.acceptDelim("@") || !declaration && this.acceptDelim("$")) { if (this.hasWhitespace()) { this.restoreAtMark(mark); return null; } } if (!this.accept(TokenType.AtKeyword) && !this.accept(TokenType.Ident)) { this.restoreAtMark(mark); return null; } if (!insideLookup && this.peek(TokenType.BracketL)) { if (!this._addLookupChildren(node)) { this.restoreAtMark(mark); return null; } } return node; } _parseTermExpression() { return this._parseVariable() || this._parseEscaped() || super._parseTermExpression() || // preference for colors before mixin references this._tryParseMixinReference(false); } _parseEscaped() { if (this.peek(TokenType.EscapedJavaScript) || this.peek(TokenType.BadEscapedJavaScript)) { const node = this.createNode(NodeType.EscapedValue); this.consumeToken(); return this.finish(node); } if (this.peekDelim("~")) { const node = this.createNode(NodeType.EscapedValue); this.consumeToken(); if (this.accept(TokenType.String) || this.accept(TokenType.EscapedJavaScript)) { return this.finish(node); } else { return this.finish(node, ParseError.TermExpected); } } return null; } _parseOperator() { const node = this._parseGuardOperator(); if (node) { return node; } else { return super._parseOperator(); } } _parseGuardOperator() { if (this.peekDelim(">")) { const node = this.createNode(NodeType.Operator); this.consumeToken(); this.acceptDelim("="); return node; } else if (this.peekDelim("=")) { const node = this.createNode(NodeType.Operator); this.consumeToken(); this.acceptDelim("<"); return node; } else if (this.peekDelim("<")) { const node = this.createNode(NodeType.Operator); this.consumeToken(); this.acceptDelim("="); return node; } return null; } _parseRuleSetDeclaration() { if (this.peek(TokenType.AtKeyword)) { return this._parseKeyframe() || this._parseMedia(true) || this._parseImport() || this._parseSupports(true) || this._parseLayer() || this._parsePropertyAtRule() || this._parseContainer(true) || this._parseDetachedRuleSetMixin() || this._parseVariableDeclaration() || this._parseRuleSetDeclarationAtStatement(); } return this._tryParseMixinDeclaration() || this._tryParseRuleset(true) || this._tryParseMixinReference() || this._parseFunction() || this._parseExtend() || this._parseDeclaration(); } _parseKeyframeIdent() { return this._parseIdent([ReferenceType.Keyframe]) || this._parseVariable(); } _parseKeyframeSelector() { return this._parseDetachedRuleSetMixin() || super._parseKeyframeSelector(); } // public _parseSimpleSelectorBody(): nodes.Node | null { // return this._parseNestingSelector() || super._parseSimpleSelectorBody(); // } _parseSelector(isNested) { const node = this.create(Selector); let hasContent = false; if (isNested) { hasContent = node.addChild(this._parseCombinator()); } while (node.addChild(this._parseSimpleSelector())) { hasContent = true; const mark = this.mark(); if (node.addChild(this._parseGuard()) && this.peek(TokenType.CurlyL)) { break; } this.restoreAtMark(mark); node.addChild(this._parseCombinator()); } return hasContent ? this.finish(node) : null; } _parseNestingSelector() { if (this.peekDelim("&")) { const node = this.createNode(NodeType.SelectorCombinator); this.consumeToken(); while (!this.hasWhitespace() && (this.acceptDelim("-") || this.accept(TokenType.Num) || this.accept(TokenType.Dimension) || node.addChild(this._parseIdent()) || this.acceptDelim("&"))) { } return this.finish(node); } return null; } _parseSelectorIdent() { if (!this.peekInterpolatedIdent()) { return null; } const node = this.createNode(NodeType.SelectorInterpolation); const hasContent = this._acceptInterpolatedIdent(node); return hasContent ? this.finish(node) : null; } _parsePropertyIdentifier(inLookup = false) { const propertyRegex = /^[\w-]+/; if (!this.peekInterpolatedIdent() && !this.peekRegExp(this.token.type, propertyRegex)) { return null; } const mark = this.mark(); const node = this.create(Identifier); node.isCustomProperty = this.acceptDelim("-") && this.acceptDelim("-"); let childAdded = false; if (!inLookup) { if (node.isCustomProperty) { childAdded = this._acceptInterpolatedIdent(node); } else { childAdded = this._acceptInterpolatedIdent(node, propertyRegex); } } else { if (node.isCustomProperty) { childAdded = node.addChild(this._parseIdent()); } else { childAdded = node.addChild(this._parseRegexp(propertyRegex)); } } if (!childAdded) { this.restoreAtMark(mark); return null; } if (!inLookup && !this.hasWhitespace()) { this.acceptDelim("+"); if (!this.hasWhitespace()) { this.acceptIdent("_"); } } return this.finish(node); } peekInterpolatedIdent() { return this.peek(TokenType.Ident) || this.peekDelim("@") || this.peekDelim("$") || this.peekDelim("-"); } _acceptInterpolatedIdent(node, identRegex) { let hasContent = false; const indentInterpolation = () => { const pos = this.mark(); if (this.acceptDelim("-")) { if (!this.hasWhitespace()) { this.acceptDelim("-"); } if (this.hasWhitespace()) { this.restoreAtMark(pos); return null; } } return this._parseInterpolation(); }; const accept = identRegex ? () => this.acceptRegexp(identRegex) : () => this.accept(TokenType.Ident); while (accept() || node.addChild(this._parseInterpolation() || this.try(indentInterpolation))) { hasContent = true; if (this.hasWhitespace()) { break; } } return hasContent; } _parseInterpolation() { const mark = this.mark(); if (this.peekDelim("@") || this.peekDelim("$")) { const node = this.createNode(NodeType.Interpolation); this.consumeToken(); if (this.hasWhitespace() || !this.accept(TokenType.CurlyL)) { this.restoreAtMark(mark); return null; } if (!node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); } if (!this.accept(TokenType.CurlyR)) { return this.finish(node, ParseError.RightCurlyExpected); } return this.finish(node); } return null; } _tryParseMixinDeclaration() { const mark = this.mark(); const node = this.create(MixinDeclaration); if (!node.setIdentifier(this._parseMixinDeclarationIdentifier()) || !this.accept(TokenType.ParenthesisL)) { this.restoreAtMark(mark); return null; } if (node.getParameters().addChild(this._parseMixinParameter())) { while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getParameters().addChild(this._parseMixinParameter())) { this.markError(node, ParseError.IdentifierExpected, [], [TokenType.ParenthesisR]); } } } if (!this.accept(TokenType.ParenthesisR)) { this.restoreAtMark(mark); return null; } node.setGuard(this._parseGuard()); if (!this.peek(TokenType.CurlyL)) { this.restoreAtMark(mark); return null; } return this._parseBody(node, this._parseMixInBodyDeclaration.bind(this)); } _parseMixInBodyDeclaration() { return this._parseFontFace() || this._parseRuleSetDeclaration(); } _parseMixinDeclarationIdentifier() { let identifier; if (this.peekDelim("#") || this.peekDelim(".")) { identifier = this.create(Identifier); this.consumeToken(); if (this.hasWhitespace() || !identifier.addChild(this._parseIdent())) { return null; } } else if (this.peek(TokenType.Hash)) { identifier = this.create(Identifier); this.consumeToken(); } else { return null; } identifier.referenceTypes = [ReferenceType.Mixin]; return this.finish(identifier); } _parsePseudo() { if (!this.peek(TokenType.Colon)) { return null; } const mark = this.mark(); const node = this.create(ExtendsReference); this.consumeToken(); if (this.acceptIdent("extend")) { return this._completeExtends(node); } this.restoreAtMark(mark); return super._parsePseudo(); } _parseExtend() { if (!this.peekDelim("&")) { return null; } const mark = this.mark(); const node = this.create(ExtendsReference); this.consumeToken(); if (this.hasWhitespace() || !this.accept(TokenType.Colon) || !this.acceptIdent("extend")) { this.restoreAtMark(mark); return null; } return this._completeExtends(node); } _completeExtends(node) { if (!this.accept(TokenType.ParenthesisL)) { return this.finish(node, ParseError.LeftParenthesisExpected); } const selectors = node.getSelectors(); if (!selectors.addChild(this._parseSelector(true))) { return this.finish(node, ParseError.SelectorExpected); } while (this.accept(TokenType.Comma)) { if (!selectors.addChild(this._parseSelector(true))) { return this.finish(node, ParseError.SelectorExpected); } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); } _parseDetachedRuleSetMixin() { if (!this.peek(TokenType.AtKeyword)) { return null; } const mark = this.mark(); const node = this.create(MixinReference); if (node.addChild(this._parseVariable(true)) && (this.hasWhitespace() || !this.accept(TokenType.ParenthesisL))) { this.restoreAtMark(mark); return null; } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); } _tryParseMixinReference(atRoot = true) { const mark = this.mark(); const node = this.create(MixinReference); let identifier = this._parseMixinDeclarationIdentifier(); while (identifier) { this.acceptDelim(">"); const nextId = this._parseMixinDeclarationIdentifier(); if (nextId) { node.getNamespaces().addChild(identifier); identifier = nextId; } else { break; } } if (!node.setIdentifier(identifier)) { this.restoreAtMark(mark); return null; } let hasArguments = false; if (this.accept(TokenType.ParenthesisL)) { hasArguments = true; if (node.getArguments().addChild(this._parseMixinArgument())) { while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseMixinArgument())) { return this.finish(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } identifier.referenceTypes = [ReferenceType.Mixin]; } else { identifier.referenceTypes = [ReferenceType.Mixin, ReferenceType.Rule]; } if (this.peek(TokenType.BracketL)) { if (!atRoot) { this._addLookupChildren(node); } } else { node.addChild(this._parsePrio()); } if (!hasArguments && !this.peek(TokenType.SemiColon) && !this.peek(TokenType.CurlyR) && !this.peek(TokenType.EOF)) { this.restoreAtMark(mark); return null; } return this.finish(node); } _parseMixinArgument() { const node = this.create(FunctionArgument); const pos = this.mark(); const argument = this._parseVariable(); if (argument) { if (!this.accept(TokenType.Colon)) { this.restoreAtMark(pos); } else { node.setIdentifier(argument); } } if (node.setValue(this._parseDetachedRuleSet() || this._parseExpr(true))) { return this.finish(node); } this.restoreAtMark(pos); return null; } _parseMixinParameter() { const node = this.create(FunctionParameter); if (this.peekKeyword("@rest")) { const restNode = this.create(Node); this.consumeToken(); if (!this.accept(Ellipsis2)) { return this.finish(node, ParseError.DotExpected, [], [TokenType.Comma, TokenType.ParenthesisR]); } node.setIdentifier(this.finish(restNode)); return this.finish(node); } if (this.peek(Ellipsis2)) { const varargsNode = this.create(Node); this.consumeToken(); node.setIdentifier(this.finish(varargsNode)); return this.finish(node); } let hasContent = false; if (node.setIdentifier(this._parseVariable())) { this.accept(TokenType.Colon); hasContent = true; } if (!node.setDefaultValue(this._parseDetachedRuleSet() || this._parseExpr(true)) && !hasContent) { return null; } return this.finish(node); } _parseGuard() { if (!this.peekIdent("when")) { return null; } const node = this.create(LessGuard); this.consumeToken(); if (!node.getConditions().addChild(this._parseGuardCondition())) { return this.finish(node, ParseError.ConditionExpected); } while (this.acceptIdent("and") || this.accept(TokenType.Comma)) { if (!node.getConditions().addChild(this._parseGuardCondition())) { return this.finish(node, ParseError.ConditionExpected); } } return this.finish(node); } _parseGuardCondition() { const node = this.create(GuardCondition); node.isNegated = this.acceptIdent("not"); if (!this.accept(TokenType.ParenthesisL)) { if (node.isNegated) { return this.finish(node, ParseError.LeftParenthesisExpected); } return null; } if (!node.addChild(this._parseExpr())) { } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); } _parseFunction() { const pos = this.mark(); const node = this.create(Function); if (!node.setIdentifier(this._parseFunctionIdentifier())) { return null; } if (this.hasWhitespace() || !this.accept(TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } if (node.getArguments().addChild(this._parseMixinArgument())) { while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) { if (this.peek(TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseMixinArgument())) { return this.finish(node, ParseError.ExpressionExpected); } } } if (!this.accept(TokenType.ParenthesisR)) { return this.finish(node, ParseError.RightParenthesisExpected); } return this.finish(node); } _parseFunctionIdentifier() { if (this.peekDelim("%")) { const node = this.create(Identifier); node.referenceTypes = [ReferenceType.Function]; this.consumeToken(); return this.finish(node); } return super._parseFunctionIdentifier(); } _parseURLArgument() { const pos = this.mark(); const node = super._parseURLArgument(); if (!node || !this.peek(TokenType.ParenthesisR)) { this.restoreAtMark(pos); const node2 = this.create(Node); node2.addChild(this._parseBinaryExpr()); return this.finish(node2); } return node; } }; // node_modules/vscode-css-languageservice/lib/esm/services/lessCompletion.js var LESSCompletion = class _LESSCompletion extends CSSCompletion { constructor(lsOptions, cssDataManager) { super("@", lsOptions, cssDataManager); } createFunctionProposals(proposals, existingNode, sortToEnd, result) { for (const p of proposals) { const item = { label: p.name, detail: p.example, documentation: p.description, textEdit: TextEdit.replace(this.getCompletionRange(existingNode), p.name + "($0)"), insertTextFormat: InsertTextFormat.Snippet, kind: CompletionItemKind.Function }; if (sortToEnd) { item.sortText = "z"; } result.items.push(item); } return result; } getTermProposals(entry, existingNode, result) { let functions = _LESSCompletion.builtInProposals; if (entry) { functions = functions.filter((f2) => !f2.type || !entry.restrictions || entry.restrictions.indexOf(f2.type) !== -1); } this.createFunctionProposals(functions, existingNode, true, result); return super.getTermProposals(entry, existingNode, result); } getColorProposals(entry, existingNode, result) { this.createFunctionProposals(_LESSCompletion.colorProposals, existingNode, false, result); return super.getColorProposals(entry, existingNode, result); } getCompletionsForDeclarationProperty(declaration, result) { this.getCompletionsForSelector(null, true, result); return super.getCompletionsForDeclarationProperty(declaration, result); } }; LESSCompletion.builtInProposals = [ // Boolean functions { "name": "if", "example": "if(condition, trueValue [, falseValue]);", "description": t("returns one of two values depending on a condition.") }, { "name": "boolean", "example": "boolean(condition);", "description": t('"store" a boolean test for later evaluation in a guard or if().') }, // List functions { "name": "length", "example": "length(@list);", "description": t("returns the number of elements in a value list") }, { "name": "extract", "example": "extract(@list, index);", "description": t("returns a value at the specified position in the list") }, { "name": "range", "example": "range([start, ] end [, step]);", "description": t("generate a list spanning a range of values") }, { "name": "each", "example": "each(@list, ruleset);", "description": t("bind the evaluation of a ruleset to each member of a list.") }, // Other built-ins { "name": "escape", "example": "escape(@string);", "description": t("URL encodes a string") }, { "name": "e", "example": "e(@string);", "description": t("escape string content") }, { "name": "replace", "example": "replace(@string, @pattern, @replacement[, @flags]);", "description": t("string replace") }, { "name": "unit", "example": "unit(@dimension, [@unit: '']);", "description": t("remove or change the unit of a dimension") }, { "name": "color", "example": "color(@string);", "description": t("parses a string to a color"), "type": "color" }, { "name": "convert", "example": "convert(@value, unit);", "description": t("converts numbers from one type into another") }, { "name": "data-uri", "example": "data-uri([mimetype,] url);", "description": t("inlines a resource and falls back to `url()`"), "type": "url" }, { "name": "abs", "description": t("absolute value of a number"), "example": "abs(number);" }, { "name": "acos", "description": t("arccosine - inverse of cosine function"), "example": "acos(number);" }, { "name": "asin", "description": t("arcsine - inverse of sine function"), "example": "asin(number);" }, { "name": "ceil", "example": "ceil(@number);", "description": t("rounds up to an integer") }, { "name": "cos", "description": t("cosine function"), "example": "cos(number);" }, { "name": "floor", "description": t("rounds down to an integer"), "example": "floor(@number);" }, { "name": "percentage", "description": t("converts to a %, e.g. 0.5 > 50%"), "example": "percentage(@number);", "type": "percentage" }, { "name": "round", "description": t("rounds a number to a number of places"), "example": "round(number, [places: 0]);" }, { "name": "sqrt", "description": t("calculates square root of a number"), "example": "sqrt(number);" }, { "name": "sin", "description": t("sine function"), "example": "sin(number);" }, { "name": "tan", "description": t("tangent function"), "example": "tan(number);" }, { "name": "atan", "description": t("arctangent - inverse of tangent function"), "example": "atan(number);" }, { "name": "pi", "description": t("returns pi"), "example": "pi();" }, { "name": "pow", "description": t("first argument raised to the power of the second argument"), "example": "pow(@base, @exponent);" }, { "name": "mod", "description": t("first argument modulus second argument"), "example": "mod(number, number);" }, { "name": "min", "description": t("returns the lowest of one or more values"), "example": "min(@x, @y);" }, { "name": "max", "description": t("returns the lowest of one or more values"), "example": "max(@x, @y);" } ]; LESSCompletion.colorProposals = [ { "name": "argb", "example": "argb(@color);", "description": t("creates a #AARRGGBB") }, { "name": "hsl", "example": "hsl(@hue, @saturation, @lightness);", "description": t("creates a color") }, { "name": "hsla", "example": "hsla(@hue, @saturation, @lightness, @alpha);", "description": t("creates a color") }, { "name": "hsv", "example": "hsv(@hue, @saturation, @value);", "description": t("creates a color") }, { "name": "hsva", "example": "hsva(@hue, @saturation, @value, @alpha);", "description": t("creates a color") }, { "name": "hue", "example": "hue(@color);", "description": t("returns the `hue` channel of `@color` in the HSL space") }, { "name": "saturation", "example": "saturation(@color);", "description": t("returns the `saturation` channel of `@color` in the HSL space") }, { "name": "lightness", "example": "lightness(@color);", "description": t("returns the `lightness` channel of `@color` in the HSL space") }, { "name": "hsvhue", "example": "hsvhue(@color);", "description": t("returns the `hue` channel of `@color` in the HSV space") }, { "name": "hsvsaturation", "example": "hsvsaturation(@color);", "description": t("returns the `saturation` channel of `@color` in the HSV space") }, { "name": "hsvvalue", "example": "hsvvalue(@color);", "description": t("returns the `value` channel of `@color` in the HSV space") }, { "name": "red", "example": "red(@color);", "description": t("returns the `red` channel of `@color`") }, { "name": "green", "example": "green(@color);", "description": t("returns the `green` channel of `@color`") }, { "name": "blue", "example": "blue(@color);", "description": t("returns the `blue` channel of `@color`") }, { "name": "alpha", "example": "alpha(@color);", "description": t("returns the `alpha` channel of `@color`") }, { "name": "luma", "example": "luma(@color);", "description": t("returns the `luma` value (perceptual brightness) of `@color`") }, { "name": "saturate", "example": "saturate(@color, 10%);", "description": t("return `@color` 10% points more saturated") }, { "name": "desaturate", "example": "desaturate(@color, 10%);", "description": t("return `@color` 10% points less saturated") }, { "name": "lighten", "example": "lighten(@color, 10%);", "description": t("return `@color` 10% points lighter") }, { "name": "darken", "example": "darken(@color, 10%);", "description": t("return `@color` 10% points darker") }, { "name": "fadein", "example": "fadein(@color, 10%);", "description": t("return `@color` 10% points less transparent") }, { "name": "fadeout", "example": "fadeout(@color, 10%);", "description": t("return `@color` 10% points more transparent") }, { "name": "fade", "example": "fade(@color, 50%);", "description": t("return `@color` with 50% transparency") }, { "name": "spin", "example": "spin(@color, 10);", "description": t("return `@color` with a 10 degree larger in hue") }, { "name": "mix", "example": "mix(@color1, @color2, [@weight: 50%]);", "description": t("return a mix of `@color1` and `@color2`") }, { "name": "greyscale", "example": "greyscale(@color);", "description": t("returns a grey, 100% desaturated color") }, { "name": "contrast", "example": "contrast(@color1, [@darkcolor: black], [@lightcolor: white], [@threshold: 43%]);", "description": t("return `@darkcolor` if `@color1 is> 43% luma` otherwise return `@lightcolor`, see notes") }, { "name": "multiply", "example": "multiply(@color1, @color2);" }, { "name": "screen", "example": "screen(@color1, @color2);" }, { "name": "overlay", "example": "overlay(@color1, @color2);" }, { "name": "softlight", "example": "softlight(@color1, @color2);" }, { "name": "hardlight", "example": "hardlight(@color1, @color2);" }, { "name": "difference", "example": "difference(@color1, @color2);" }, { "name": "exclusion", "example": "exclusion(@color1, @color2);" }, { "name": "average", "example": "average(@color1, @color2);" }, { "name": "negation", "example": "negation(@color1, @color2);" } ]; // node_modules/vscode-css-languageservice/lib/esm/services/cssFolding.js function getFoldingRanges(document, context) { const ranges = computeFoldingRanges(document); return limitFoldingRanges(ranges, context); } function computeFoldingRanges(document) { function getStartLine(t2) { return document.positionAt(t2.offset).line; } function getEndLine(t2) { return document.positionAt(t2.offset + t2.len).line; } function getScanner() { switch (document.languageId) { case "scss": return new SCSSScanner(); case "less": return new LESSScanner(); default: return new Scanner(); } } function tokenToRange(t2, kind) { const startLine = getStartLine(t2); const endLine = getEndLine(t2); if (startLine !== endLine) { return { startLine, endLine, kind }; } else { return null; } } const ranges = []; const delimiterStack = []; const scanner = getScanner(); scanner.ignoreComment = false; scanner.setSource(document.getText()); let token = scanner.scan(); let prevToken = null; while (token.type !== TokenType.EOF) { switch (token.type) { case TokenType.CurlyL: case InterpolationFunction: { delimiterStack.push({ line: getStartLine(token), type: "brace", isStart: true }); break; } case TokenType.CurlyR: { if (delimiterStack.length !== 0) { const prevDelimiter = popPrevStartDelimiterOfType(delimiterStack, "brace"); if (!prevDelimiter) { break; } let endLine = getEndLine(token); if (prevDelimiter.type === "brace") { if (prevToken && getEndLine(prevToken) !== endLine) { endLine--; } if (prevDelimiter.line !== endLine) { ranges.push({ startLine: prevDelimiter.line, endLine, kind: void 0 }); } } } break; } case TokenType.Comment: { const commentRegionMarkerToDelimiter = (marker) => { if (marker === "#region") { return { line: getStartLine(token), type: "comment", isStart: true }; } else { return { line: getEndLine(token), type: "comment", isStart: false }; } }; const getCurrDelimiter = (token2) => { const matches2 = token2.text.match(/^\s*\/\*\s*(#region|#endregion)\b\s*(.*?)\s*\*\//); if (matches2) { return commentRegionMarkerToDelimiter(matches2[1]); } else if (document.languageId === "scss" || document.languageId === "less") { const matches3 = token2.text.match(/^\s*\/\/\s*(#region|#endregion)\b\s*(.*?)\s*/); if (matches3) { return commentRegionMarkerToDelimiter(matches3[1]); } } return null; }; const currDelimiter = getCurrDelimiter(token); if (currDelimiter) { if (currDelimiter.isStart) { delimiterStack.push(currDelimiter); } else { const prevDelimiter = popPrevStartDelimiterOfType(delimiterStack, "comment"); if (!prevDelimiter) { break; } if (prevDelimiter.type === "comment") { if (prevDelimiter.line !== currDelimiter.line) { ranges.push({ startLine: prevDelimiter.line, endLine: currDelimiter.line, kind: "region" }); } } } } else { const range = tokenToRange(token, "comment"); if (range) { ranges.push(range); } } break; } } prevToken = token; token = scanner.scan(); } return ranges; } function popPrevStartDelimiterOfType(stack, type) { if (stack.length === 0) { return null; } for (let i = stack.length - 1; i >= 0; i--) { if (stack[i].type === type && stack[i].isStart) { return stack.splice(i, 1)[0]; } } return null; } function limitFoldingRanges(ranges, context) { const maxRanges = context && context.rangeLimit || Number.MAX_VALUE; const sortedRanges = ranges.sort((r1, r2) => { let diff = r1.startLine - r2.startLine; if (diff === 0) { diff = r1.endLine - r2.endLine; } return diff; }); const validRanges = []; let prevEndLine = -1; sortedRanges.forEach((r) => { if (!(r.startLine < prevEndLine && prevEndLine < r.endLine)) { validRanges.push(r); prevEndLine = r.endLine; } }); if (validRanges.length < maxRanges) { return validRanges; } else { return validRanges.slice(0, maxRanges); } } // node_modules/vscode-css-languageservice/lib/esm/beautify/beautify-css.js var legacy_beautify_css; (function() { "use strict"; var __webpack_modules__ = [ , , /* 2 */ /***/ function(module) { function OutputLine(parent) { this.__parent = parent; this.__character_count = 0; this.__indent_count = -1; this.__alignment_count = 0; this.__wrap_point_index = 0; this.__wrap_point_character_count = 0; this.__wrap_point_indent_count = -1; this.__wrap_point_alignment_count = 0; this.__items = []; } OutputLine.prototype.clone_empty = function() { var line = new OutputLine(this.__parent); line.set_indent(this.__indent_count, this.__alignment_count); return line; }; OutputLine.prototype.item = function(index) { if (index < 0) { return this.__items[this.__items.length + index]; } else { return this.__items[index]; } }; OutputLine.prototype.has_match = function(pattern) { for (var lastCheckedOutput = this.__items.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) { if (this.__items[lastCheckedOutput].match(pattern)) { return true; } } return false; }; OutputLine.prototype.set_indent = function(indent, alignment) { if (this.is_empty()) { this.__indent_count = indent || 0; this.__alignment_count = alignment || 0; this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count); } }; OutputLine.prototype._set_wrap_point = function() { if (this.__parent.wrap_line_length) { this.__wrap_point_index = this.__items.length; this.__wrap_point_character_count = this.__character_count; this.__wrap_point_indent_count = this.__parent.next_line.__indent_count; this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count; } }; OutputLine.prototype._should_wrap = function() { return this.__wrap_point_index && this.__character_count > this.__parent.wrap_line_length && this.__wrap_point_character_count > this.__parent.next_line.__character_count; }; OutputLine.prototype._allow_wrap = function() { if (this._should_wrap()) { this.__parent.add_new_line(); var next = this.__parent.current_line; next.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count); next.__items = this.__items.slice(this.__wrap_point_index); this.__items = this.__items.slice(0, this.__wrap_point_index); next.__character_count += this.__character_count - this.__wrap_point_character_count; this.__character_count = this.__wrap_point_character_count; if (next.__items[0] === " ") { next.__items.splice(0, 1); next.__character_count -= 1; } return true; } return false; }; OutputLine.prototype.is_empty = function() { return this.__items.length === 0; }; OutputLine.prototype.last = function() { if (!this.is_empty()) { return this.__items[this.__items.length - 1]; } else { return null; } }; OutputLine.prototype.push = function(item) { this.__items.push(item); var last_newline_index = item.lastIndexOf("\n"); if (last_newline_index !== -1) { this.__character_count = item.length - last_newline_index; } else { this.__character_count += item.length; } }; OutputLine.prototype.pop = function() { var item = null; if (!this.is_empty()) { item = this.__items.pop(); this.__character_count -= item.length; } return item; }; OutputLine.prototype._remove_indent = function() { if (this.__indent_count > 0) { this.__indent_count -= 1; this.__character_count -= this.__parent.indent_size; } }; OutputLine.prototype._remove_wrap_indent = function() { if (this.__wrap_point_indent_count > 0) { this.__wrap_point_indent_count -= 1; } }; OutputLine.prototype.trim = function() { while (this.last() === " ") { this.__items.pop(); this.__character_count -= 1; } }; OutputLine.prototype.toString = function() { var result = ""; if (this.is_empty()) { if (this.__parent.indent_empty_lines) { result = this.__parent.get_indent_string(this.__indent_count); } } else { result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count); result += this.__items.join(""); } return result; }; function IndentStringCache(options, baseIndentString) { this.__cache = [""]; this.__indent_size = options.indent_size; this.__indent_string = options.indent_char; if (!options.indent_with_tabs) { this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char); } baseIndentString = baseIndentString || ""; if (options.indent_level > 0) { baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string); } this.__base_string = baseIndentString; this.__base_string_length = baseIndentString.length; } IndentStringCache.prototype.get_indent_size = function(indent, column) { var result = this.__base_string_length; column = column || 0; if (indent < 0) { result = 0; } result += indent * this.__indent_size; result += column; return result; }; IndentStringCache.prototype.get_indent_string = function(indent_level, column) { var result = this.__base_string; column = column || 0; if (indent_level < 0) { indent_level = 0; result = ""; } column += indent_level * this.__indent_size; this.__ensure_cache(column); result += this.__cache[column]; return result; }; IndentStringCache.prototype.__ensure_cache = function(column) { while (column >= this.__cache.length) { this.__add_column(); } }; IndentStringCache.prototype.__add_column = function() { var column = this.__cache.length; var indent = 0; var result = ""; if (this.__indent_size && column >= this.__indent_size) { indent = Math.floor(column / this.__indent_size); column -= indent * this.__indent_size; result = new Array(indent + 1).join(this.__indent_string); } if (column) { result += new Array(column + 1).join(" "); } this.__cache.push(result); }; function Output(options, baseIndentString) { this.__indent_cache = new IndentStringCache(options, baseIndentString); this.raw = false; this._end_with_newline = options.end_with_newline; this.indent_size = options.indent_size; this.wrap_line_length = options.wrap_line_length; this.indent_empty_lines = options.indent_empty_lines; this.__lines = []; this.previous_line = null; this.current_line = null; this.next_line = new OutputLine(this); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = false; this.__add_outputline(); } Output.prototype.__add_outputline = function() { this.previous_line = this.current_line; this.current_line = this.next_line.clone_empty(); this.__lines.push(this.current_line); }; Output.prototype.get_line_number = function() { return this.__lines.length; }; Output.prototype.get_indent_string = function(indent, column) { return this.__indent_cache.get_indent_string(indent, column); }; Output.prototype.get_indent_size = function(indent, column) { return this.__indent_cache.get_indent_size(indent, column); }; Output.prototype.is_empty = function() { return !this.previous_line && this.current_line.is_empty(); }; Output.prototype.add_new_line = function(force_newline) { if (this.is_empty() || !force_newline && this.just_added_newline()) { return false; } if (!this.raw) { this.__add_outputline(); } return true; }; Output.prototype.get_code = function(eol) { this.trim(true); var last_item = this.current_line.pop(); if (last_item) { if (last_item[last_item.length - 1] === "\n") { last_item = last_item.replace(/\n+$/g, ""); } this.current_line.push(last_item); } if (this._end_with_newline) { this.__add_outputline(); } var sweet_code = this.__lines.join("\n"); if (eol !== "\n") { sweet_code = sweet_code.replace(/[\n]/g, eol); } return sweet_code; }; Output.prototype.set_wrap_point = function() { this.current_line._set_wrap_point(); }; Output.prototype.set_indent = function(indent, alignment) { indent = indent || 0; alignment = alignment || 0; this.next_line.set_indent(indent, alignment); if (this.__lines.length > 1) { this.current_line.set_indent(indent, alignment); return true; } this.current_line.set_indent(); return false; }; Output.prototype.add_raw_token = function(token) { for (var x = 0; x < token.newlines; x++) { this.__add_outputline(); } this.current_line.set_indent(-1); this.current_line.push(token.whitespace_before); this.current_line.push(token.text); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = false; }; Output.prototype.add_token = function(printable_token) { this.__add_space_before_token(); this.current_line.push(printable_token); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = this.current_line._allow_wrap(); }; Output.prototype.__add_space_before_token = function() { if (this.space_before_token && !this.just_added_newline()) { if (!this.non_breaking_space) { this.set_wrap_point(); } this.current_line.push(" "); } }; Output.prototype.remove_indent = function(index) { var output_length = this.__lines.length; while (index < output_length) { this.__lines[index]._remove_indent(); index++; } this.current_line._remove_wrap_indent(); }; Output.prototype.trim = function(eat_newlines) { eat_newlines = eat_newlines === void 0 ? false : eat_newlines; this.current_line.trim(); while (eat_newlines && this.__lines.length > 1 && this.current_line.is_empty()) { this.__lines.pop(); this.current_line = this.__lines[this.__lines.length - 1]; this.current_line.trim(); } this.previous_line = this.__lines.length > 1 ? this.__lines[this.__lines.length - 2] : null; }; Output.prototype.just_added_newline = function() { return this.current_line.is_empty(); }; Output.prototype.just_added_blankline = function() { return this.is_empty() || this.current_line.is_empty() && this.previous_line.is_empty(); }; Output.prototype.ensure_empty_line_above = function(starts_with, ends_with) { var index = this.__lines.length - 2; while (index >= 0) { var potentialEmptyLine = this.__lines[index]; if (potentialEmptyLine.is_empty()) { break; } else if (potentialEmptyLine.item(0).indexOf(starts_with) !== 0 && potentialEmptyLine.item(-1) !== ends_with) { this.__lines.splice(index + 1, 0, new OutputLine(this)); this.previous_line = this.__lines[this.__lines.length - 2]; break; } index--; } }; module.exports.Output = Output; }, , , , /* 6 */ /***/ function(module) { function Options(options, merge_child_field) { this.raw_options = _mergeOpts(options, merge_child_field); this.disabled = this._get_boolean("disabled"); this.eol = this._get_characters("eol", "auto"); this.end_with_newline = this._get_boolean("end_with_newline"); this.indent_size = this._get_number("indent_size", 4); this.indent_char = this._get_characters("indent_char", " "); this.indent_level = this._get_number("indent_level"); this.preserve_newlines = this._get_boolean("preserve_newlines", true); this.max_preserve_newlines = this._get_number("max_preserve_newlines", 32786); if (!this.preserve_newlines) { this.max_preserve_newlines = 0; } this.indent_with_tabs = this._get_boolean("indent_with_tabs", this.indent_char === " "); if (this.indent_with_tabs) { this.indent_char = " "; if (this.indent_size === 1) { this.indent_size = 4; } } this.wrap_line_length = this._get_number("wrap_line_length", this._get_number("max_char")); this.indent_empty_lines = this._get_boolean("indent_empty_lines"); this.templating = this._get_selection_list("templating", ["auto", "none", "angular", "django", "erb", "handlebars", "php", "smarty"], ["auto"]); } Options.prototype._get_array = function(name, default_value) { var option_value = this.raw_options[name]; var result = default_value || []; if (typeof option_value === "object") { if (option_value !== null && typeof option_value.concat === "function") { result = option_value.concat(); } } else if (typeof option_value === "string") { result = option_value.split(/[^a-zA-Z0-9_\/\-]+/); } return result; }; Options.prototype._get_boolean = function(name, default_value) { var option_value = this.raw_options[name]; var result = option_value === void 0 ? !!default_value : !!option_value; return result; }; Options.prototype._get_characters = function(name, default_value) { var option_value = this.raw_options[name]; var result = default_value || ""; if (typeof option_value === "string") { result = option_value.replace(/\\r/, "\r").replace(/\\n/, "\n").replace(/\\t/, " "); } return result; }; Options.prototype._get_number = function(name, default_value) { var option_value = this.raw_options[name]; default_value = parseInt(default_value, 10); if (isNaN(default_value)) { default_value = 0; } var result = parseInt(option_value, 10); if (isNaN(result)) { result = default_value; } return result; }; Options.prototype._get_selection = function(name, selection_list, default_value) { var result = this._get_selection_list(name, selection_list, default_value); if (result.length !== 1) { throw new Error( "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" + selection_list + "\nYou passed in: '" + this.raw_options[name] + "'" ); } return result[0]; }; Options.prototype._get_selection_list = function(name, selection_list, default_value) { if (!selection_list || selection_list.length === 0) { throw new Error("Selection list cannot be empty."); } default_value = default_value || [selection_list[0]]; if (!this._is_valid_selection(default_value, selection_list)) { throw new Error("Invalid Default Value!"); } var result = this._get_array(name, default_value); if (!this._is_valid_selection(result, selection_list)) { throw new Error( "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" + selection_list + "\nYou passed in: '" + this.raw_options[name] + "'" ); } return result; }; Options.prototype._is_valid_selection = function(result, selection_list) { return result.length && selection_list.length && !result.some(function(item) { return selection_list.indexOf(item) === -1; }); }; function _mergeOpts(allOptions, childFieldName) { var finalOpts = {}; allOptions = _normalizeOpts(allOptions); var name; for (name in allOptions) { if (name !== childFieldName) { finalOpts[name] = allOptions[name]; } } if (childFieldName && allOptions[childFieldName]) { for (name in allOptions[childFieldName]) { finalOpts[name] = allOptions[childFieldName][name]; } } return finalOpts; } function _normalizeOpts(options) { var convertedOpts = {}; var key; for (key in options) { var newKey = key.replace(/-/g, "_"); convertedOpts[newKey] = options[key]; } return convertedOpts; } module.exports.Options = Options; module.exports.normalizeOpts = _normalizeOpts; module.exports.mergeOpts = _mergeOpts; }, , /* 8 */ /***/ function(module) { var regexp_has_sticky = RegExp.prototype.hasOwnProperty("sticky"); function InputScanner(input_string) { this.__input = input_string || ""; this.__input_length = this.__input.length; this.__position = 0; } InputScanner.prototype.restart = function() { this.__position = 0; }; InputScanner.prototype.back = function() { if (this.__position > 0) { this.__position -= 1; } }; InputScanner.prototype.hasNext = function() { return this.__position < this.__input_length; }; InputScanner.prototype.next = function() { var val = null; if (this.hasNext()) { val = this.__input.charAt(this.__position); this.__position += 1; } return val; }; InputScanner.prototype.peek = function(index) { var val = null; index = index || 0; index += this.__position; if (index >= 0 && index < this.__input_length) { val = this.__input.charAt(index); } return val; }; InputScanner.prototype.__match = function(pattern, index) { pattern.lastIndex = index; var pattern_match = pattern.exec(this.__input); if (pattern_match && !(regexp_has_sticky && pattern.sticky)) { if (pattern_match.index !== index) { pattern_match = null; } } return pattern_match; }; InputScanner.prototype.test = function(pattern, index) { index = index || 0; index += this.__position; if (index >= 0 && index < this.__input_length) { return !!this.__match(pattern, index); } else { return false; } }; InputScanner.prototype.testChar = function(pattern, index) { var val = this.peek(index); pattern.lastIndex = 0; return val !== null && pattern.test(val); }; InputScanner.prototype.match = function(pattern) { var pattern_match = this.__match(pattern, this.__position); if (pattern_match) { this.__position += pattern_match[0].length; } else { pattern_match = null; } return pattern_match; }; InputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) { var val = ""; var match; if (starting_pattern) { match = this.match(starting_pattern); if (match) { val += match[0]; } } if (until_pattern && (match || !starting_pattern)) { val += this.readUntil(until_pattern, until_after); } return val; }; InputScanner.prototype.readUntil = function(pattern, until_after) { var val = ""; var match_index = this.__position; pattern.lastIndex = this.__position; var pattern_match = pattern.exec(this.__input); if (pattern_match) { match_index = pattern_match.index; if (until_after) { match_index += pattern_match[0].length; } } else { match_index = this.__input_length; } val = this.__input.substring(this.__position, match_index); this.__position = match_index; return val; }; InputScanner.prototype.readUntilAfter = function(pattern) { return this.readUntil(pattern, true); }; InputScanner.prototype.get_regexp = function(pattern, match_from) { var result = null; var flags = "g"; if (match_from && regexp_has_sticky) { flags = "y"; } if (typeof pattern === "string" && pattern !== "") { result = new RegExp(pattern, flags); } else if (pattern) { result = new RegExp(pattern.source, flags); } return result; }; InputScanner.prototype.get_literal_regexp = function(literal_string) { return RegExp(literal_string.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")); }; InputScanner.prototype.peekUntilAfter = function(pattern) { var start = this.__position; var val = this.readUntilAfter(pattern); this.__position = start; return val; }; InputScanner.prototype.lookBack = function(testVal) { var start = this.__position - 1; return start >= testVal.length && this.__input.substring(start - testVal.length, start).toLowerCase() === testVal; }; module.exports.InputScanner = InputScanner; }, , , , , /* 13 */ /***/ function(module) { function Directives(start_block_pattern, end_block_pattern) { start_block_pattern = typeof start_block_pattern === "string" ? start_block_pattern : start_block_pattern.source; end_block_pattern = typeof end_block_pattern === "string" ? end_block_pattern : end_block_pattern.source; this.__directives_block_pattern = new RegExp(start_block_pattern + / beautify( \w+[:]\w+)+ /.source + end_block_pattern, "g"); this.__directive_pattern = / (\w+)[:](\w+)/g; this.__directives_end_ignore_pattern = new RegExp(start_block_pattern + /\sbeautify\signore:end\s/.source + end_block_pattern, "g"); } Directives.prototype.get_directives = function(text) { if (!text.match(this.__directives_block_pattern)) { return null; } var directives = {}; this.__directive_pattern.lastIndex = 0; var directive_match = this.__directive_pattern.exec(text); while (directive_match) { directives[directive_match[1]] = directive_match[2]; directive_match = this.__directive_pattern.exec(text); } return directives; }; Directives.prototype.readIgnored = function(input) { return input.readUntilAfter(this.__directives_end_ignore_pattern); }; module.exports.Directives = Directives; }, , /* 15 */ /***/ function(module, __unused_webpack_exports, __webpack_require__2) { var Beautifier = __webpack_require__2(16).Beautifier, Options = __webpack_require__2(17).Options; function css_beautify2(source_text, options) { var beautifier = new Beautifier(source_text, options); return beautifier.beautify(); } module.exports = css_beautify2; module.exports.defaultOptions = function() { return new Options(); }; }, /* 16 */ /***/ function(module, __unused_webpack_exports, __webpack_require__2) { var Options = __webpack_require__2(17).Options; var Output = __webpack_require__2(2).Output; var InputScanner = __webpack_require__2(8).InputScanner; var Directives = __webpack_require__2(13).Directives; var directives_core = new Directives(/\/\*/, /\*\//); var lineBreak = /\r\n|[\r\n]/; var allLineBreaks = /\r\n|[\r\n]/g; var whitespaceChar = /\s/; var whitespacePattern = /(?:\s|\n)+/g; var block_comment_pattern = /\/\*(?:[\s\S]*?)((?:\*\/)|$)/g; var comment_pattern = /\/\/(?:[^\n\r\u2028\u2029]*)/g; function Beautifier(source_text, options) { this._source_text = source_text || ""; this._options = new Options(options); this._ch = null; this._input = null; this.NESTED_AT_RULE = { "page": true, "font-face": true, "keyframes": true, // also in CONDITIONAL_GROUP_RULE below "media": true, "supports": true, "document": true }; this.CONDITIONAL_GROUP_RULE = { "media": true, "supports": true, "document": true }; this.NON_SEMICOLON_NEWLINE_PROPERTY = [ "grid-template-areas", "grid-template" ]; } Beautifier.prototype.eatString = function(endChars) { var result = ""; this._ch = this._input.next(); while (this._ch) { result += this._ch; if (this._ch === "\\") { result += this._input.next(); } else if (endChars.indexOf(this._ch) !== -1 || this._ch === "\n") { break; } this._ch = this._input.next(); } return result; }; Beautifier.prototype.eatWhitespace = function(allowAtLeastOneNewLine) { var result = whitespaceChar.test(this._input.peek()); var newline_count = 0; while (whitespaceChar.test(this._input.peek())) { this._ch = this._input.next(); if (allowAtLeastOneNewLine && this._ch === "\n") { if (newline_count === 0 || newline_count < this._options.max_preserve_newlines) { newline_count++; this._output.add_new_line(true); } } } return result; }; Beautifier.prototype.foundNestedPseudoClass = function() { var openParen = 0; var i = 1; var ch = this._input.peek(i); while (ch) { if (ch === "{") { return true; } else if (ch === "(") { openParen += 1; } else if (ch === ")") { if (openParen === 0) { return false; } openParen -= 1; } else if (ch === ";" || ch === "}") { return false; } i++; ch = this._input.peek(i); } return false; }; Beautifier.prototype.print_string = function(output_string) { this._output.set_indent(this._indentLevel); this._output.non_breaking_space = true; this._output.add_token(output_string); }; Beautifier.prototype.preserveSingleSpace = function(isAfterSpace) { if (isAfterSpace) { this._output.space_before_token = true; } }; Beautifier.prototype.indent = function() { this._indentLevel++; }; Beautifier.prototype.outdent = function() { if (this._indentLevel > 0) { this._indentLevel--; } }; Beautifier.prototype.beautify = function() { if (this._options.disabled) { return this._source_text; } var source_text = this._source_text; var eol = this._options.eol; if (eol === "auto") { eol = "\n"; if (source_text && lineBreak.test(source_text || "")) { eol = source_text.match(lineBreak)[0]; } } source_text = source_text.replace(allLineBreaks, "\n"); var baseIndentString = source_text.match(/^[\t ]*/)[0]; this._output = new Output(this._options, baseIndentString); this._input = new InputScanner(source_text); this._indentLevel = 0; this._nestedLevel = 0; this._ch = null; var parenLevel = 0; var insideRule = false; var insidePropertyValue = false; var enteringConditionalGroup = false; var insideNonNestedAtRule = false; var insideScssMap = false; var topCharacter = this._ch; var insideNonSemiColonValues = false; var whitespace; var isAfterSpace; var previous_ch; while (true) { whitespace = this._input.read(whitespacePattern); isAfterSpace = whitespace !== ""; previous_ch = topCharacter; this._ch = this._input.next(); if (this._ch === "\\" && this._input.hasNext()) { this._ch += this._input.next(); } topCharacter = this._ch; if (!this._ch) { break; } else if (this._ch === "/" && this._input.peek() === "*") { this._output.add_new_line(); this._input.back(); var comment = this._input.read(block_comment_pattern); var directives = directives_core.get_directives(comment); if (directives && directives.ignore === "start") { comment += directives_core.readIgnored(this._input); } this.print_string(comment); this.eatWhitespace(true); this._output.add_new_line(); } else if (this._ch === "/" && this._input.peek() === "/") { this._output.space_before_token = true; this._input.back(); this.print_string(this._input.read(comment_pattern)); this.eatWhitespace(true); } else if (this._ch === "$") { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch); var variable = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g); if (variable.match(/[ :]$/)) { variable = this.eatString(": ").replace(/\s+$/, ""); this.print_string(variable); this._output.space_before_token = true; } if (parenLevel === 0 && variable.indexOf(":") !== -1) { insidePropertyValue = true; this.indent(); } } else if (this._ch === "@") { this.preserveSingleSpace(isAfterSpace); if (this._input.peek() === "{") { this.print_string(this._ch + this.eatString("}")); } else { this.print_string(this._ch); var variableOrRule = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g); if (variableOrRule.match(/[ :]$/)) { variableOrRule = this.eatString(": ").replace(/\s+$/, ""); this.print_string(variableOrRule); this._output.space_before_token = true; } if (parenLevel === 0 && variableOrRule.indexOf(":") !== -1) { insidePropertyValue = true; this.indent(); } else if (variableOrRule in this.NESTED_AT_RULE) { this._nestedLevel += 1; if (variableOrRule in this.CONDITIONAL_GROUP_RULE) { enteringConditionalGroup = true; } } else if (parenLevel === 0 && !insidePropertyValue) { insideNonNestedAtRule = true; } } } else if (this._ch === "#" && this._input.peek() === "{") { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch + this.eatString("}")); } else if (this._ch === "{") { if (insidePropertyValue) { insidePropertyValue = false; this.outdent(); } insideNonNestedAtRule = false; if (enteringConditionalGroup) { enteringConditionalGroup = false; insideRule = this._indentLevel >= this._nestedLevel; } else { insideRule = this._indentLevel >= this._nestedLevel - 1; } if (this._options.newline_between_rules && insideRule) { if (this._output.previous_line && this._output.previous_line.item(-1) !== "{") { this._output.ensure_empty_line_above("/", ","); } } this._output.space_before_token = true; if (this._options.brace_style === "expand") { this._output.add_new_line(); this.print_string(this._ch); this.indent(); this._output.set_indent(this._indentLevel); } else { if (previous_ch === "(") { this._output.space_before_token = false; } else if (previous_ch !== ",") { this.indent(); } this.print_string(this._ch); } this.eatWhitespace(true); this._output.add_new_line(); } else if (this._ch === "}") { this.outdent(); this._output.add_new_line(); if (previous_ch === "{") { this._output.trim(true); } if (insidePropertyValue) { this.outdent(); insidePropertyValue = false; } this.print_string(this._ch); insideRule = false; if (this._nestedLevel) { this._nestedLevel--; } this.eatWhitespace(true); this._output.add_new_line(); if (this._options.newline_between_rules && !this._output.just_added_blankline()) { if (this._input.peek() !== "}") { this._output.add_new_line(true); } } if (this._input.peek() === ")") { this._output.trim(true); if (this._options.brace_style === "expand") { this._output.add_new_line(true); } } } else if (this._ch === ":") { for (var i = 0; i < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; i++) { if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[i])) { insideNonSemiColonValues = true; break; } } if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideNonNestedAtRule && parenLevel === 0) { this.print_string(":"); if (!insidePropertyValue) { insidePropertyValue = true; this._output.space_before_token = true; this.eatWhitespace(true); this.indent(); } } else { if (this._input.lookBack(" ")) { this._output.space_before_token = true; } if (this._input.peek() === ":") { this._ch = this._input.next(); this.print_string("::"); } else { this.print_string(":"); } } } else if (this._ch === '"' || this._ch === "'") { var preserveQuoteSpace = previous_ch === '"' || previous_ch === "'"; this.preserveSingleSpace(preserveQuoteSpace || isAfterSpace); this.print_string(this._ch + this.eatString(this._ch)); this.eatWhitespace(true); } else if (this._ch === ";") { insideNonSemiColonValues = false; if (parenLevel === 0) { if (insidePropertyValue) { this.outdent(); insidePropertyValue = false; } insideNonNestedAtRule = false; this.print_string(this._ch); this.eatWhitespace(true); if (this._input.peek() !== "/") { this._output.add_new_line(); } } else { this.print_string(this._ch); this.eatWhitespace(true); this._output.space_before_token = true; } } else if (this._ch === "(") { if (this._input.lookBack("url")) { this.print_string(this._ch); this.eatWhitespace(); parenLevel++; this.indent(); this._ch = this._input.next(); if (this._ch === ")" || this._ch === '"' || this._ch === "'") { this._input.back(); } else if (this._ch) { this.print_string(this._ch + this.eatString(")")); if (parenLevel) { parenLevel--; this.outdent(); } } } else { var space_needed = false; if (this._input.lookBack("with")) { space_needed = true; } this.preserveSingleSpace(isAfterSpace || space_needed); this.print_string(this._ch); if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) { this._output.add_new_line(); insideScssMap = true; } else { this.eatWhitespace(); parenLevel++; this.indent(); } } } else if (this._ch === ")") { if (parenLevel) { parenLevel--; this.outdent(); } if (insideScssMap && this._input.peek() === ";" && this._options.selector_separator_newline) { insideScssMap = false; this.outdent(); this._output.add_new_line(); } this.print_string(this._ch); } else if (this._ch === ",") { this.print_string(this._ch); this.eatWhitespace(true); if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideNonNestedAtRule) { this._output.add_new_line(); } else { this._output.space_before_token = true; } } else if ((this._ch === ">" || this._ch === "+" || this._ch === "~") && !insidePropertyValue && parenLevel === 0) { if (this._options.space_around_combinator) { this._output.space_before_token = true; this.print_string(this._ch); this._output.space_before_token = true; } else { this.print_string(this._ch); this.eatWhitespace(); if (this._ch && whitespaceChar.test(this._ch)) { this._ch = ""; } } } else if (this._ch === "]") { this.print_string(this._ch); } else if (this._ch === "[") { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch); } else if (this._ch === "=") { this.eatWhitespace(); this.print_string("="); if (whitespaceChar.test(this._ch)) { this._ch = ""; } } else if (this._ch === "!" && !this._input.lookBack("\\")) { this._output.space_before_token = true; this.print_string(this._ch); } else { var preserveAfterSpace = previous_ch === '"' || previous_ch === "'"; this.preserveSingleSpace(preserveAfterSpace || isAfterSpace); this.print_string(this._ch); if (!this._output.just_added_newline() && this._input.peek() === "\n" && insideNonSemiColonValues) { this._output.add_new_line(); } } } var sweetCode = this._output.get_code(eol); return sweetCode; }; module.exports.Beautifier = Beautifier; }, /* 17 */ /***/ function(module, __unused_webpack_exports, __webpack_require__2) { var BaseOptions = __webpack_require__2(6).Options; function Options(options) { BaseOptions.call(this, options, "css"); this.selector_separator_newline = this._get_boolean("selector_separator_newline", true); this.newline_between_rules = this._get_boolean("newline_between_rules", true); var space_around_selector_separator = this._get_boolean("space_around_selector_separator"); this.space_around_combinator = this._get_boolean("space_around_combinator") || space_around_selector_separator; var brace_style_split = this._get_selection_list("brace_style", ["collapse", "expand", "end-expand", "none", "preserve-inline"]); this.brace_style = "collapse"; for (var bs = 0; bs < brace_style_split.length; bs++) { if (brace_style_split[bs] !== "expand") { this.brace_style = "collapse"; } else { this.brace_style = brace_style_split[bs]; } } } Options.prototype = new BaseOptions(); module.exports.Options = Options; } /******/ ]; var __webpack_module_cache__ = {}; function __webpack_require__(moduleId) { var cachedModule = __webpack_module_cache__[moduleId]; if (cachedModule !== void 0) { return cachedModule.exports; } var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; __webpack_modules__[moduleId](module, module.exports, __webpack_require__); return module.exports; } var __webpack_exports__ = __webpack_require__(15); legacy_beautify_css = __webpack_exports__; })(); var css_beautify = legacy_beautify_css; // node_modules/vscode-css-languageservice/lib/esm/services/cssFormatter.js function format2(document, range, options) { let value = document.getText(); let includesEnd = true; let initialIndentLevel = 0; let inRule = false; const tabSize = options.tabSize || 4; if (range) { let startOffset = document.offsetAt(range.start); let extendedStart = startOffset; while (extendedStart > 0 && isWhitespace(value, extendedStart - 1)) { extendedStart--; } if (extendedStart === 0 || isEOL(value, extendedStart - 1)) { startOffset = extendedStart; } else { if (extendedStart < startOffset) { startOffset = extendedStart + 1; } } let endOffset = document.offsetAt(range.end); let extendedEnd = endOffset; while (extendedEnd < value.length && isWhitespace(value, extendedEnd)) { extendedEnd++; } if (extendedEnd === value.length || isEOL(value, extendedEnd)) { endOffset = extendedEnd; } range = Range.create(document.positionAt(startOffset), document.positionAt(endOffset)); inRule = isInRule(value, startOffset); includesEnd = endOffset === value.length; value = value.substring(startOffset, endOffset); if (startOffset !== 0) { const startOfLineOffset = document.offsetAt(Position.create(range.start.line, 0)); initialIndentLevel = computeIndentLevel(document.getText(), startOfLineOffset, options); } if (inRule) { value = `{ ${trimLeft(value)}`; } } else { range = Range.create(Position.create(0, 0), document.positionAt(value.length)); } const cssOptions = { indent_size: tabSize, indent_char: options.insertSpaces ? " " : " ", end_with_newline: includesEnd && getFormatOption(options, "insertFinalNewline", false), selector_separator_newline: getFormatOption(options, "newlineBetweenSelectors", true), newline_between_rules: getFormatOption(options, "newlineBetweenRules", true), space_around_selector_separator: getFormatOption(options, "spaceAroundSelectorSeparator", false), brace_style: getFormatOption(options, "braceStyle", "collapse"), indent_empty_lines: getFormatOption(options, "indentEmptyLines", false), max_preserve_newlines: getFormatOption(options, "maxPreserveNewLines", void 0), preserve_newlines: getFormatOption(options, "preserveNewLines", true), wrap_line_length: getFormatOption(options, "wrapLineLength", void 0), eol: "\n" }; let result = css_beautify(value, cssOptions); if (inRule) { result = trimLeft(result.substring(2)); } if (initialIndentLevel > 0) { const indent = options.insertSpaces ? repeat(" ", tabSize * initialIndentLevel) : repeat(" ", initialIndentLevel); result = result.split("\n").join("\n" + indent); if (range.start.character === 0) { result = indent + result; } } return [{ range, newText: result }]; } function trimLeft(str) { return str.replace(/^\s+/, ""); } var _CUL3 = "{".charCodeAt(0); var _CUR2 = "}".charCodeAt(0); function isInRule(str, offset) { while (offset >= 0) { const ch = str.charCodeAt(offset); if (ch === _CUL3) { return true; } else if (ch === _CUR2) { return false; } offset--; } return false; } function getFormatOption(options, key, dflt) { if (options && options.hasOwnProperty(key)) { const value = options[key]; if (value !== null) { return value; } } return dflt; } function computeIndentLevel(content, offset, options) { let i = offset; let nChars = 0; const tabSize = options.tabSize || 4; while (i < content.length) { const ch = content.charAt(i); if (ch === " ") { nChars++; } else if (ch === " ") { nChars += tabSize; } else { break; } i++; } return Math.floor(nChars / tabSize); } function isEOL(text, offset) { return "\r\n".indexOf(text.charAt(offset)) !== -1; } function isWhitespace(text, offset) { return " ".indexOf(text.charAt(offset)) !== -1; } // node_modules/vscode-css-languageservice/lib/esm/data/webCustomData.js var cssData = { "version": 1.1, "properties": [ { "name": "additive-symbols", "browsers": [ "FF33" ], "atRule": "@counter-style", "syntax": "[ && ]#", "relevance": 50, "description": "@counter-style descriptor. Specifies the symbols used by the marker-construction algorithm specified by the system descriptor. Needs to be specified if the counter system is 'additive'.", "restrictions": [ "integer", "string", "image", "identifier" ] }, { "name": "align-content", "browsers": [ "E12", "FF28", "S9", "C29", "IE11", "O16" ], "values": [ { "name": "center", "description": "Lines are packed toward the center of the flex container." }, { "name": "flex-end", "description": "Lines are packed toward the end of the flex container." }, { "name": "flex-start", "description": "Lines are packed toward the start of the flex container." }, { "name": "space-around", "description": "Lines are evenly distributed in the flex container, with half-size spaces on either end." }, { "name": "space-between", "description": "Lines are evenly distributed in the flex container." }, { "name": "stretch", "description": "Lines stretch to take up the remaining space." }, { "name": "start" }, { "name": "end" }, { "name": "normal" }, { "name": "baseline" }, { "name": "first baseline" }, { "name": "last baseline" }, { "name": "space-around" }, { "name": "space-between" }, { "name": "space-evenly" }, { "name": "stretch" }, { "name": "safe" }, { "name": "unsafe" } ], "syntax": "normal | | | ? ", "relevance": 66, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/align-content" } ], "description": "Aligns a flex container's lines within the flex container when there is extra space in the cross-axis, similar to how 'justify-content' aligns individual items within the main-axis.", "restrictions": [ "enum" ] }, { "name": "align-items", "browsers": [ "E12", "FF20", "S9", "C29", "IE11", "O16" ], "values": [ { "name": "baseline", "description": "If the flex item's inline axis is the same as the cross axis, this value is identical to 'flex-start'. Otherwise, it participates in baseline alignment." }, { "name": "center", "description": "The flex item's margin box is centered in the cross axis within the line." }, { "name": "flex-end", "description": "The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line." }, { "name": "flex-start", "description": "The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line." }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." }, { "name": "normal" }, { "name": "start" }, { "name": "end" }, { "name": "self-start" }, { "name": "self-end" }, { "name": "first baseline" }, { "name": "last baseline" }, { "name": "stretch" }, { "name": "safe" }, { "name": "unsafe" } ], "syntax": "normal | stretch | | [ ? ]", "relevance": 87, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/align-items" } ], "description": "Aligns flex items along the cross axis of the current line of the flex container.", "restrictions": [ "enum" ] }, { "name": "justify-items", "browsers": [ "E12", "FF20", "S9", "C52", "IE11", "O12.1" ], "values": [ { "name": "auto" }, { "name": "normal" }, { "name": "end" }, { "name": "start" }, { "name": "flex-end", "description": '"Flex items are packed toward the end of the line."' }, { "name": "flex-start", "description": '"Flex items are packed toward the start of the line."' }, { "name": "self-end", "description": "The item is packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis." }, { "name": "self-start", "description": "The item is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis.." }, { "name": "center", "description": "The items are packed flush to each other toward the center of the of the alignment container." }, { "name": "left" }, { "name": "right" }, { "name": "baseline" }, { "name": "first baseline" }, { "name": "last baseline" }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." }, { "name": "safe" }, { "name": "unsafe" }, { "name": "legacy" } ], "syntax": "normal | stretch | | ? [ | left | right ] | legacy | legacy && [ left | right | center ]", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/justify-items" } ], "description": "Defines the default justify-self for all items of the box, giving them the default way of justifying each box along the appropriate axis", "restrictions": [ "enum" ] }, { "name": "justify-self", "browsers": [ "E16", "FF45", "S10.1", "C57", "IE10", "O44" ], "values": [ { "name": "auto" }, { "name": "normal" }, { "name": "end" }, { "name": "start" }, { "name": "flex-end", "description": '"Flex items are packed toward the end of the line."' }, { "name": "flex-start", "description": '"Flex items are packed toward the start of the line."' }, { "name": "self-end", "description": "The item is packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis." }, { "name": "self-start", "description": "The item is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis.." }, { "name": "center", "description": "The items are packed flush to each other toward the center of the of the alignment container." }, { "name": "left" }, { "name": "right" }, { "name": "baseline" }, { "name": "first baseline" }, { "name": "last baseline" }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." }, { "name": "save" }, { "name": "unsave" } ], "syntax": "auto | normal | stretch | | ? [ | left | right ]", "relevance": 55, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/justify-self" } ], "description": "Defines the way of justifying a box inside its container along the appropriate axis.", "restrictions": [ "enum" ] }, { "name": "align-self", "browsers": [ "E12", "FF20", "S9", "C29", "IE10", "O12.1" ], "values": [ { "name": "auto", "description": "Computes to the value of 'align-items' on the element's parent, or 'stretch' if the element has no parent. On absolutely positioned elements, it computes to itself." }, { "name": "normal" }, { "name": "self-end" }, { "name": "self-start" }, { "name": "baseline", "description": "If the flex item's inline axis is the same as the cross axis, this value is identical to 'flex-start'. Otherwise, it participates in baseline alignment." }, { "name": "center", "description": "The flex item's margin box is centered in the cross axis within the line." }, { "name": "flex-end", "description": "The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line." }, { "name": "flex-start", "description": "The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line." }, { "name": "stretch", "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." }, { "name": "baseline" }, { "name": "first baseline" }, { "name": "last baseline" }, { "name": "safe" }, { "name": "unsafe" } ], "syntax": "auto | normal | stretch | | ? ", "relevance": 73, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/align-self" } ], "description": "Allows the default alignment along the cross axis to be overridden for individual flex items.", "restrictions": [ "enum" ] }, { "name": "all", "browsers": [ "E79", "FF27", "S9.1", "C37", "O24" ], "values": [], "syntax": "initial | inherit | unset | revert | revert-layer", "relevance": 53, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/all" } ], "description": "Shorthand that resets all properties except 'direction' and 'unicode-bidi'.", "restrictions": [ "enum" ] }, { "name": "alt", "browsers": [ "S9" ], "values": [], "relevance": 50, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/alt" } ], "description": "Provides alternative text for assistive technology to replace the generated content of a ::before or ::after element.", "restrictions": [ "string", "enum" ] }, { "name": "animation", "browsers": [ "E12", "FF16", "S9", "C43", "IE10", "O30" ], "values": [ { "name": "alternate", "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." }, { "name": "alternate-reverse", "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." }, { "name": "backwards", "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." }, { "name": "both", "description": "Both forwards and backwards fill modes are applied." }, { "name": "forwards", "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." }, { "name": "infinite", "description": "Causes the animation to repeat forever." }, { "name": "none", "description": "No animation is performed" }, { "name": "normal", "description": "Normal playback." }, { "name": "reverse", "description": "All iterations of the animation are played in the reverse direction from the way they were specified." } ], "syntax": "#", "relevance": 82, "references": [ { "name": "MDN Reference", "url": "https://developer.mozilla.org/docs/Web/CSS/animation" } ], "description": "Shorthand property combines six of the animation properties into a single property.", "restrictions": [ "time", "timing-function", "enum", "identifier", "number" ] }, { "name": "animation-delay", "browsers": [ "E12", "FF16", "S9", "C43", "IE10", "O30" ], "syntax": "