You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
29 KiB

8 months ago
{"version":3,"file":"dep-e36486f6.js","sources":["../../../../../node_modules/postcss-value-parser/lib/parse.js","../../../../../node_modules/postcss-value-parser/lib/walk.js","../../../../../node_modules/postcss-value-parser/lib/stringify.js","../../../../../node_modules/postcss-value-parser/lib/unit.js","../../../../../node_modules/postcss-value-parser/lib/index.js"],"sourcesContent":["var openParentheses = \"(\".charCodeAt(0);\nvar closeParentheses = \")\".charCodeAt(0);\nvar singleQuote = \"'\".charCodeAt(0);\nvar doubleQuote = '\"'.charCodeAt(0);\nvar backslash = \"\\\\\".charCodeAt(0);\nvar slash = \"/\".charCodeAt(0);\nvar comma = \",\".charCodeAt(0);\nvar colon = \":\".charCodeAt(0);\nvar star = \"*\".charCodeAt(0);\nvar uLower = \"u\".charCodeAt(0);\nvar uUpper = \"U\".charCodeAt(0);\nvar plus = \"+\".charCodeAt(0);\nvar isUnicodeRange = /^[a-f0-9?-]+$/i;\n\nmodule.exports = function(input) {\n var tokens = [];\n var value = input;\n\n var next,\n quote,\n prev,\n token,\n escape,\n escapePos,\n whitespacePos,\n parenthesesOpenPos;\n var pos = 0;\n var code = value.charCodeAt(pos);\n var max = value.length;\n var stack = [{ nodes: tokens }];\n var balanced = 0;\n var parent;\n\n var name = \"\";\n var before = \"\";\n var after = \"\";\n\n while (pos < max) {\n // Whitespaces\n if (code <= 32) {\n next = pos;\n do {\n next += 1;\n code = value.charCodeAt(next);\n } while (code <= 32);\n token = value.slice(pos, next);\n\n prev = tokens[tokens.length - 1];\n if (code === closeParentheses && balanced) {\n after = token;\n } else if (prev && prev.type === \"div\") {\n prev.after = token;\n } else if (\n code === comma ||\n code === colon ||\n (code === slash &&\n value.charCodeAt(next + 1) !== star &&\n (!parent ||\n (parent && parent.type === \"function\" && parent.value !== \"calc\")))\n ) {\n before = token;\n } else {\n tokens.push({\n type: \"space\",\n sourceIndex: pos,\n value: token\n });\n }\n\n pos = next;\n\n // Quotes\n } else if (code === singleQuote || code === doubleQuote) {\n next = pos;\n quote = code === singleQuote ? \"'\" : '\"';\n token = {\n type: \"string\",\n sourceIndex: pos,\n quote: quote\n };\n do {\n escape = false;\n next = value.indexOf(quote, next + 1);\n if (~next) {\n escapePos = next;\n while (value.charCodeAt(escapePos - 1) === backslash) {\n escapePos -= 1;\n escape = !escape;\n }\n } else {\n value += quote;\n next = value.length - 1;\n token.unclosed = true;\n }\n } while (escape);\n token.value = value.slice(pos + 1, next);\n\n tokens.push(token);\n pos = next + 1;\n code = value.charCodeAt(pos);\n\n // Comments\n } else if (code === slash && value.charCodeAt(pos + 1) === star) {\n token = {\n type: \"comment\",\n sourceIndex: pos\n };\n\n next = value.indexOf(\"*/\", pos);\n if (next === -1) {\n token.unclosed = true;\n next = value.length;\n }\n\n token.value = value.slice(pos + 2, next);\n tokens.push(token);\n\n pos = next + 2;\n code = value.charCodeAt(pos);\n\n // Operation within calc\n } else if (\n (code === slash || code === star) &&\n parent &&\n parent.type === \"function\" &&\n parent.value === \"calc\"\n ) {\n token = value[pos];\n tokens.push({\n type: \"word\",\n sourceIndex: pos - before.length,\n value: token\n });\n pos += 1;\n code = value.charCodeAt(pos);\n\n // Dividers\n } else if (code === slash || code === comma || code === colon) {\n token = value[pos];\n\n tokens.push({\n type: \"div\",\n sourceIndex: pos - before.length,\n value: token,\n