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AAK,OAAO,KAAK,YAClD,IAAI,CAAC,KAAK;IAEd;AACF;IAEA,2CAAe;;;ID1bf,2CAAe,CACb,MACA;IAEA,MAAM,WAAW,IAAI,CAAA,GAAA,wCAAO,EAAE,WAAW,CAAC;IAC1C,OAAO,SAAS,QAAQ;AAC1B;;;;;;ALPO,MAAM,4CAAQ,CAAA,GAAA,wCAAM;AACpB,MAAM,4CAAY,CAAA,GAAA,wCAAU;IAInC,2CAAe;WAAC;eAAO;AAAS","sources":["src/index.ts","src/parse/index.ts","src/CssParseError.ts","src/CssPosition.ts","src/type.ts","src/stringify/index.ts","src/stringify/compiler.ts"],"sourcesContent":["import {default as parseFn} from './parse';\nimport {default as stringifyFn} from './stringify';\nexport const parse = parseFn;\nexport const stringify = stringifyFn;\nexport * from './type';\nexport * from './CssParseError';\nexport * from './CssPosition';\nexport default {parse, stringify};\n","import CssParseError from '../CssParseError';\nimport Position from '../CssPosition';\nimport {\n CssAtRuleAST,\n CssCharsetAST,\n CssCommentAST,\n CssCommonPositionAST,\n CssContainerAST,\n CssCustomMediaAST,\n CssDeclarationAST,\n CssDocumentAST,\n CssFontFaceAST,\n CssHostAST,\n CssImportAST,\n CssKeyframeAST,\n CssKeyframesAST,\n CssLayerAST,\n CssMediaAST,\n CssNamespaceAST,\n CssPageAST,\n CssRuleAST,\n CssStylesheetAST,\n CssSupportsAST,\n CssTypes,\n} from '../type';\n\n// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\n// New rule => https://www.w3.org/TR/CSS22/syndata.html#comments\n// [^] is equivalent to [.\\n\\r]\nconst commentre = /\\/\\*[^]*?(?:\\*\\/|$)/g;\n\nexport const parse = (\n css: string,\n options?: {source?: string; silent?: boolean}\n): CssStylesheetAST => {\n options = options || {};\n\n /**\n * Positional.\n */\n let lineno = 1;\n let column = 1;\n\n /**\n * Update lineno and column based on `str`.\n */\n function updatePosition(str: string) {\n const lines = str.match(/\\n/g);\n if (lines) lineno += lines.length;\n const i = str.lastIndexOf('\\n');\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n */\n function position() {\n const start = {line: lineno, column: column};\n return function <T1 extends CssCommonPositionAST>(\n node: Omit<T1, 'position'>\n ): T1 {\n (node as T1).position = new Position(\n start,\n {line: lineno, column: column},\n options?.source || ''\n );\n whitespace();\n return node as T1;\n };\n }\n\n /**\n * Error `msg`.\n */\n const errorsList: Array<CssParseError> = [];\n\n function error(msg: string) {\n const err = new CssParseError(\n options?.source || '',\n msg,\n lineno,\n column,\n css\n );\n\n if (options?.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Parse stylesheet.\n */\n function stylesheet(): CssStylesheetAST {\n const rulesList = rules();\n\n const result: CssStylesheetAST = {\n type: CssTypes.stylesheet,\n stylesheet: {\n source: options?.source,\n rules: rulesList,\n parsingErrors: errorsList,\n },\n };\n\n return result;\n }\n\n /**\n * Opening brace.\n */\n function open() {\n return match(/^{\\s*/);\n }\n\n /**\n * Closing brace.\n */\n function close() {\n return match(/^}/);\n }\n\n /**\n * Parse ruleset.\n */\n function rules() {\n let node: CssRuleAST | CssAtRuleAST | void;\n const rules: Array<CssRuleAST | CssAtRuleAST> = [];\n whitespace();\n comments(rules);\n while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) {\n if (node) {\n rules.push(node);\n comments(rules);\n }\n }\n return rules;\n }\n\n /**\n * Match `re` and return captures.\n */\n function match(re: RegExp) {\n const m = re.exec(css);\n if (!m) {\n return;\n }\n const str = m[0];\n updatePosition(str);\n css = css.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(/^\\s*/);\n }\n\n /**\n * Parse comments;\n */\n function comments<T1 extends CssCommonPositionAST>(\n rules?: Array<T1 | CssCommentAST>\n ) {\n let c;\n rules = rules || [];\n while ((c = comment())) {\n if (c) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n */\n function comment(): CssCommentAST | void {\n const pos = position();\n if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) {\n return;\n }\n\n const m = match(/^\\/\\*[^]*?\\*\\//);\n if (!m) {\n return error('End of comment missing');\n }\n\n return pos<CssCommentAST>({\n type: CssTypes.comment,\n comment: m[0].slice(2, -2),\n });\n }\n\n /**\n * Parse selector.\n */\n function selector() {\n const m = match(/^([^{]+)/);\n if (!m) {\n return;\n }\n\n // remove comment in selector;\n const res = trim(m[0]).replace(commentre, '');\n\n // Optimisation: If there is no ',' no need to split or post-process (this is less costly)\n if (res.indexOf(',') === -1) {\n return [res];\n }\n\n return (\n res\n /**\n * replace ',' by \\u200C for data selector (div[data-lang=\"fr,de,us\"])\n * replace ',' by \\u200C for nthChild and other selector (div:nth-child(2,3,4))\n *\n * Examples:\n * div[data-lang=\"fr,\\\"de,us\"]\n * div[data-lang='fr,\\'de,us']\n * div:matches(.toto, .titi:matches(.toto, .titi))\n *\n * Regex logic:\n * (\"|')(?:\\\\\\1|.)*?\\1 => Handle the \" and '\n * \\(.*?\\) => Handle the ()\n *\n * Optimization 1:\n * No greedy capture (see docs about the difference between .* and .*?)\n *\n * Optimization 2:\n * (\"|')(?:\\\\\\1|.)*?\\1 this use reference to capture group, it work faster.\n */\n .replace(/(\"|')(?:\\\\\\1|.)*?\\1|\\(.*?\\)/g, m => m.replace(/,/g, '\\u200C'))\n // Split the selector by ','\n .split(',')\n // Replace back \\u200C by ','\n .map(s => {\n return trim(s.replace(/\\u200C/g, ','));\n })\n );\n }\n\n /**\n * Parse declaration.\n */\n function declaration(): CssDeclarationAST | void {\n const pos = position();\n\n // prop\n const propMatch = match(/^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/);\n if (!propMatch) {\n return;\n }\n const propValue = trim(propMatch[0]);\n\n // :\n if (!match(/^:\\s*/)) {\n return error(\"property missing ':'\");\n }\n\n // val\n const val = match(/^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/);\n\n const ret = pos<CssDeclarationAST>({\n type: CssTypes.declaration,\n property: propValue.replace(commentre, ''),\n value: val ? trim(val[0]).replace(commentre, '') : '',\n });\n\n // ;\n match(/^[;\\s]*/);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n */\n function declarations() {\n const decls: Array<CssDeclarationAST | CssCommentAST> = [];\n\n if (!open()) {\n return error(\"missing '{'\");\n }\n comments(decls);\n\n // declarations\n let decl;\n while ((decl = declaration())) {\n if (decl) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n if (!close()) {\n return error(\"missing '}'\");\n }\n return decls;\n }\n\n /**\n * Parse keyframe.\n */\n function keyframe() {\n let m;\n const vals = [];\n const pos = position();\n\n while ((m = match(/^((\\d+\\.\\d+|\\.\\d+|\\d+)%?|[a-z]+)\\s*/))) {\n vals.push(m[1]);\n match(/^,\\s*/);\n }\n\n if (!vals.length) {\n return;\n }\n\n return pos<CssKeyframeAST>({\n type: CssTypes.keyframe,\n values: vals,\n declarations: declarations() || [],\n });\n }\n\n /**\n * Parse keyframes.\n */\n function atkeyframes(): CssKeyframesAST | void {\n const pos = position();\n const m1 = match(/^@([-\\w]+)?keyframes\\s*/);\n\n if (!m1) {\n return;\n }\n const vendor = m1[1];\n\n // identifier\n const m2 = match(/^([-\\w]+)\\s*/);\n if (!m2) {\n return error('@keyframes missing name');\n }\n const name = m2[1];\n\n if (!open()) {\n return error(\"@keyframes missing '{'\");\n }\n\n let frame;\n let frames: Array<CssKeyframeAST | CssCommentAST> = comments();\n while ((frame = keyframe())) {\n frames.push(frame);\n frames = frames.concat(comments());\n }\n\n if (!close()) {\n return error(\"@keyframes missing '}'\");\n }\n\n return pos<CssKeyframesAST>({\n type: CssTypes.keyframes,\n name: name,\n vendor: vendor,\n keyframes: frames,\n });\n }\n\n /**\n * Parse supports.\n */\n function atsupports(): CssSupportsAST | void {\n const pos = position();\n const m = match(/^@supports *([^{]+)/);\n\n if (!m) {\n return;\n }\n const supports = trim(m[1]);\n\n if (!open()) {\n return error(\"@supports missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@supports missing '}'\");\n }\n\n return pos<CssSupportsAST>({\n type: CssTypes.supports,\n supports: supports,\n rules: style,\n });\n }\n\n /**\n * Parse host.\n */\n function athost() {\n const pos = position();\n const m = match(/^@host\\s*/);\n\n if (!m) {\n return;\n }\n\n if (!open()) {\n return error(\"@host missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@host missing '}'\");\n }\n\n return pos<CssHostAST>({\n type: CssTypes.host,\n rules: style,\n });\n }\n\n /**\n * Parse container.\n */\n function atcontainer(): CssContainerAST | void {\n const pos = position();\n const m = match(/^@container *([^{]+)/);\n\n if (!m) {\n return;\n }\n const container = trim(m[1]);\n\n if (!open()) {\n return error(\"@container missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@container missing '}'\");\n }\n\n return pos<CssContainerAST>({\n type: CssTypes.container,\n container: container,\n rules: style,\n });\n }\n\n /**\n * Parse container.\n */\n function atlayer(): CssLayerAST | void {\n const pos = position();\n const m = match(/^@layer *([^{;@]+)/);\n\n if (!m) {\n return;\n }\n const layer = trim(m[1]);\n\n if (!open()) {\n match(/^[;\\s]*/);\n return pos<CssLayerAST>({\n type: CssTypes.layer,\n layer: layer,\n });\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@layer missing '}'\");\n }\n\n return pos<CssLayerAST>({\n type: CssTypes.layer,\n layer: layer,\n rules: style,\n });\n }\n\n /**\n * Parse media.\n */\n function atmedia(): CssMediaAST | void {\n const pos = position();\n const m = match(/^@media *([^{]+)/);\n\n if (!m) {\n return;\n }\n const media = trim(m[1]);\n\n if (!open()) {\n return error(\"@media missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@media missing '}'\");\n }\n\n return pos<CssMediaAST>({\n type: CssTypes.media,\n media: media,\n rules: style,\n });\n }\n\n /**\n * Parse custom-media.\n */\n function atcustommedia(): CssCustomMediaAST | void {\n const pos = position();\n const m = match(/^@custom-media\\s+(--[^\\s]+)\\s*([^{;]+);/);\n if (!m) {\n return;\n }\n\n return pos<CssCustomMediaAST>({\n type: CssTypes.customMedia,\n name: trim(m[1]),\n media: trim(m[2]),\n });\n }\n\n /**\n * Parse paged media.\n */\n function atpage(): CssPageAST | void {\n const pos = position();\n const m = match(/^@page */);\n if (!m) {\n return;\n }\n\n const sel = selector() || [];\n\n if (!open()) {\n return error(\"@page missing '{'\");\n }\n let decls = comments<CssDeclarationAST>();\n\n // declarations\n let decl;\n while ((decl = declaration())) {\n decls.push(decl);\n decls = decls.concat(comments());\n }\n\n if (!close()) {\n return error(\"@page missing '}'\");\n }\n\n return pos<CssPageAST>({\n type: CssTypes.page,\n selectors: sel,\n declarations: decls,\n });\n }\n\n /**\n * Parse document.\n */\n function atdocument(): CssDocumentAST | void {\n const pos = position();\n const m = match(/^@([-\\w]+)?document *([^{]+)/);\n if (!m) {\n return;\n }\n\n const vendor = trim(m[1]);\n const doc = trim(m[2]);\n\n if (!open()) {\n return error(\"@document missing '{'\");\n }\n\n const style = comments<CssAtRuleAST>().concat(rules());\n\n if (!close()) {\n return error(\"@document missing '}'\");\n }\n\n return pos<CssDocumentAST>({\n type: CssTypes.document,\n document: doc,\n vendor: vendor,\n rules: style,\n });\n }\n\n /**\n * Parse font-face.\n */\n function atfontface(): CssFontFaceAST | void {\n const pos = position();\n const m = match(/^@font-face\\s*/);\n if (!m) {\n return;\n }\n\n if (!open()) {\n return error(\"@font-face missing '{'\");\n }\n let decls = comments<CssDeclarationAST>();\n\n // declarations\n let decl;\n while ((decl = declaration())) {\n decls.push(decl);\n decls = decls.concat(comments());\n }\n\n if (!close()) {\n return error(\"@font-face missing '}'\");\n }\n\n return pos<CssFontFaceAST>({\n type: CssTypes.fontFace,\n declarations: decls,\n });\n }\n\n /**\n * Parse import\n */\n const atimport = _compileAtrule<CssImportAST>('import');\n\n /**\n * Parse charset\n */\n const atcharset = _compileAtrule<CssCharsetAST>('charset');\n\n /**\n * Parse namespace\n */\n const atnamespace = _compileAtrule<CssNamespaceAST>('namespace');\n\n /**\n * Parse non-block at-rules\n */\n function _compileAtrule<T1 extends CssCommonPositionAST>(\n name: string\n ): () => T1 | void {\n const re = new RegExp(\n '^@' +\n name +\n '\\\\s*((?::?[^;\\'\"]|\"(?:\\\\\\\\\"|[^\"])*?\"|\\'(?:\\\\\\\\\\'|[^\\'])*?\\')+)(?:;|$)'\n );\n\n // ^@import\\s*([^;\"']|(\"|')(?:\\\\\\2|.)*?\\2)+(;|$)\n\n return function (): T1 | void {\n const pos = position();\n const m = match(re);\n if (!m) {\n return;\n }\n const ret: Record<string, string> = {type: name};\n ret[name] = m[1].trim();\n return pos<T1>(ret as unknown as T1) as T1;\n };\n }\n\n /**\n * Parse at rule.\n */\n function atrule(): CssAtRuleAST | void {\n if (css[0] !== '@') {\n return;\n }\n\n return (\n atkeyframes() ||\n atmedia() ||\n atcustommedia() ||\n atsupports() ||\n atimport() ||\n atcharset() ||\n atnamespace() ||\n atdocument() ||\n atpage() ||\n athost() ||\n atfontface() ||\n atcontainer() ||\n atlayer()\n );\n }\n\n /**\n * Parse rule.\n */\n function rule() {\n const pos = position();\n const sel = selector();\n\n if (!sel) {\n return error('selector missing');\n }\n comments();\n\n return pos<CssRuleAST>({\n type: CssTypes.rule,\n selectors: sel,\n declarations: declarations() || [],\n });\n }\n\n return addParent(stylesheet());\n};\n\n/**\n * Trim `str`.\n */\nfunction trim(str: string) {\n return str ? str.trim() : '';\n}\n\n/**\n * Adds non-enumerable parent node reference to each node.\n */\nfunction addParent<T1 extends {type?: string}>(obj: T1, parent?: unknown): T1 {\n const isNode = obj && typeof obj.type === 'string';\n const childParent = isNode ? obj : parent;\n\n for (const k in obj) {\n const value = obj[k];\n if (Array.isArray(value)) {\n value.forEach(v => {\n addParent(v, childParent);\n });\n } else if (value && typeof value === 'object') {\n addParent(value, childParent);\n }\n }\n\n if (isNode) {\n Object.defineProperty(obj, 'parent', {\n configurable: true,\n writable: true,\n enumerable: false,\n value: parent || null,\n });\n }\n\n return obj;\n}\n\nexport default parse;\n","export default class CssParseError extends Error {\n readonly reason: string;\n readonly filename?: string;\n readonly line: number;\n readonly column: number;\n readonly source: string;\n\n constructor(\n filename: string,\n msg: string,\n lineno: number,\n column: number,\n css: string\n ) {\n super(filename + ':' + lineno + ':' + column + ': ' + msg);\n this.reason = msg;\n this.filename = filename;\n this.line = lineno;\n this.column = column;\n this.source = css;\n }\n}\n","/**\n * Store position information for a node\n */\nexport default class Position {\n start: {line: number; column: number};\n end: {line: number; column: number};\n source?: string;\n\n constructor(\n start: {line: number; column: number},\n end: {line: number; column: number},\n source: string\n ) {\n this.start = start;\n this.end = end;\n this.source = source;\n }\n}\n","import CssParseError from './CssParseError';\nimport Position from './CssPosition';\n\nexport enum CssTypes {\n stylesheet = 'stylesheet',\n rule = 'rule',\n declaration = 'declaration',\n comment = 'comment',\n container = 'container',\n charset = 'charset',\n document = 'document',\n customMedia = 'custom-media',\n fontFace = 'font-face',\n host = 'host',\n import = 'import',\n keyframes = 'keyframes',\n keyframe = 'keyframe',\n layer = 'layer',\n media = 'media',\n namespace = 'namespace',\n page = 'page',\n supports = 'supports',\n}\n\nexport type CssCommonAST = {\n type: CssTypes;\n};\n\nexport type CssCommonPositionAST = CssCommonAST & {\n position?: Position;\n parent?: unknown;\n};\n\nexport type CssStylesheetAST = CssCommonAST & {\n type: CssTypes.stylesheet;\n stylesheet: {\n source?: string;\n rules: Array<CssAtRuleAST>;\n parsingErrors?: Array<CssParseError>;\n };\n};\n\nexport type CssRuleAST = CssCommonPositionAST & {\n type: CssTypes.rule;\n selectors: Array<string>;\n declarations: Array<CssDeclarationAST | CssCommentAST>;\n};\n\nexport type CssDeclarationAST = CssCommonPositionAST & {\n type: CssTypes.declaration;\n property: string;\n value: string;\n};\n\nexport type CssCommentAST = CssCommonPositionAST & {\n type: CssTypes.comment;\n comment: string;\n};\nexport type CssContainerAST = CssCommonPositionAST & {\n type: CssTypes.container;\n container: string;\n rules: Array<CssAtRuleAST>;\n};\n\nexport type CssCharsetAST = CssCommonPositionAST & {\n type: CssTypes.charset;\n charset: string;\n};\nexport type CssCustomMediaAST = CssCommonPositionAST & {\n type: CssTypes.customMedia;\n name: string;\n media: string;\n};\nexport type CssDocumentAST = CssCommonPositionAST & {\n type: CssTypes.document;\n document: string;\n vendor?: string;\n rules: Array<CssAtRuleAST>;\n};\nexport type CssFontFaceAST = CssCommonPositionAST & {\n type: CssTypes.fontFace;\n declarations: Array<CssDeclarationAST | CssCommentAST>;\n};\nexport type CssHostAST = CssCommonPositionAST & {\n type: CssTypes.host;\n rules: Array<CssAtRuleAST>;\n};\nexport type CssImportAST = CssCommonPositionAST & {\n type: CssTypes.import;\n import: string;\n};\nexport type CssKeyframesAST = CssCommonPositionAST & {\n type: CssTypes.keyframes;\n name: string;\n vendor?: string;\n keyframes: Array<CssKeyframeAST | CssCommentAST>;\n};\nexport type CssKeyframeAST = CssCommonPositionAST & {\n type: CssTypes.keyframe;\n values: Array<string>;\n declarations: Array<CssDeclarationAST | CssCommentAST>;\n};\nexport type CssLayerAST = CssCommonPositionAST & {\n type: CssTypes.layer;\n layer: string;\n rules?: Array<CssAtRuleAST>;\n};\nexport type CssMediaAST = CssCommonPositionAST & {\n type: CssTypes.media;\n media: string;\n rules: Array<CssAtRuleAST>;\n};\nexport type CssNamespaceAST = CssCommonPositionAST & {\n type: CssTypes.namespace;\n namespace: string;\n};\nexport type CssPageAST = CssCommonPositionAST & {\n type: CssTypes.page;\n selectors: Array<string>;\n declarations: Array<CssDeclarationAST | CssCommentAST>;\n};\nexport type CssSupportsAST = CssCommonPositionAST & {\n type: CssTypes.supports;\n supports: string;\n rules: Array<CssAtRuleAST>;\n};\n\nexport type CssAtRuleAST =\n | CssRuleAST\n | CssCommentAST\n | CssContainerAST\n | CssCharsetAST\n | CssCustomMediaAST\n | CssDocumentAST\n | CssFontFaceAST\n | CssHostAST\n | CssImportAST\n | CssKeyframesAST\n | CssLayerAST\n | CssMediaAST\n | CssNamespaceAST\n | CssPageAST\n | CssSupportsAST;\n\nexport type CssAllNodesAST =\n | CssAtRuleAST\n | CssStylesheetAST\n | CssDeclarationAST\n | CssKeyframeAST;\n","import {CssStylesheetAST} from '../type';\nimport Compiler from './compiler';\n\nexport default (\n node: CssStylesheetAST,\n options?: ConstructorParameters<typeof Compiler>[0]\n) => {\n const compiler = new Compiler(options || {});\n return compiler.compile(node);\n};\n","import {\n CssAllNodesAST,\n CssCharsetAST,\n CssCommentAST,\n CssCommonPositionAST,\n CssContainerAST,\n CssCustomMediaAST,\n CssDeclarationAST,\n CssDocumentAST,\n CssFontFaceAST,\n CssHostAST,\n CssImportAST,\n CssKeyframeAST,\n CssKeyframesAST,\n CssLayerAST,\n CssMediaAST,\n CssNamespaceAST,\n CssPageAST,\n CssRuleAST,\n CssStylesheetAST,\n CssSupportsAST,\n CssTypes,\n} from '../type';\n\nclass Compiler {\n level = 0;\n indentation = ' ';\n compress = false;\n\n constructor(options?: {indent?: string; compress?: boolean}) {\n if (typeof options?.indent === 'string') {\n this.indentation = options?.indent;\n }\n if (options?.compress) {\n this.compress = true;\n }\n }\n\n // We disable no-unused-vars for _position. We keep position for potential reintroduction of source-map\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n emit(str: string, _position?: CssCommonPositionAST['position']) {\n return str;\n }\n\n /**\n * Increase, decrease or return current indentation.\n */\n indent(level?: number) {\n this.level = this.level || 1;\n\n if (level) {\n this.level += level;\n return '';\n }\n\n return Array(this.level).join(this.indentation);\n }\n\n visit(node: CssAllNodesAST): string {\n switch (node.type) {\n case CssTypes.stylesheet:\n return this.stylesheet(node);\n case CssTypes.rule:\n return this.rule(node);\n case CssTypes.declaration:\n return this.declaration(node);\n case CssTypes.comment:\n return this.comment(node);\n case CssTypes.container:\n return this.container(node);\n case CssTypes.charset:\n return this.charset(node);\n case CssTypes.document:\n return this.document(node);\n case CssTypes.customMedia:\n return this.customMedia(node);\n case CssTypes.fontFace:\n return this.fontFace(node);\n case CssTypes.host:\n return this.host(node);\n case CssTypes.import:\n return this.import(node);\n case CssTypes.keyframes:\n return this.keyframes(node);\n case CssTypes.keyframe:\n return this.keyframe(node);\n case CssTypes.layer:\n return this.layer(node);\n case CssTypes.media:\n return this.media(node);\n case CssTypes.namespace:\n return this.namespace(node);\n case CssTypes.page:\n return this.page(node);\n case CssTypes.supports:\n return this.supports(node);\n }\n }\n\n mapVisit(nodes: Array<CssAllNodesAST>, delim?: string) {\n let buf = '';\n delim = delim || '';\n\n for (let i = 0, length = nodes.length; i < length; i++) {\n buf += this.visit(nodes[i]);\n if (delim && i < length - 1) {\n buf += this.emit(delim);\n }\n }\n\n return buf;\n }\n\n compile(node: CssStylesheetAST) {\n if (this.compress) {\n return node.stylesheet.rules.map(this.visit, this).join('');\n }\n\n return this.stylesheet(node);\n }\n\n /**\n * Visit stylesheet node.\n */\n stylesheet(node: CssStylesheetAST) {\n return this.mapVisit(node.stylesheet.rules, '\\n\\n');\n }\n\n /**\n * Visit comment node.\n */\n comment(node: CssCommentAST) {\n if (this.compress) {\n return this.emit('', node.position);\n }\n return this.emit(this.indent() + '/*' + node.comment + '*/', node.position);\n }\n\n /**\n * Visit container node.\n */\n container(node: CssContainerAST) {\n if (this.compress) {\n return (\n this.emit('@container ' + node.container, node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit(this.indent() + '@container ' + node.container, node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit('\\n' + this.indent(-1) + this.indent() + '}')\n );\n }\n\n /**\n * Visit container node.\n */\n layer(node: CssLayerAST) {\n if (this.compress) {\n return (\n this.emit('@layer ' + node.layer, node.position) +\n (node.rules\n ? this.emit('{') +\n this.mapVisit(<CssAllNodesAST[]>node.rules) +\n this.emit('}')\n : ';')\n );\n }\n return (\n this.emit(this.indent() + '@layer ' + node.layer, node.position) +\n (node.rules\n ? this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(<CssAllNodesAST[]>node.rules, '\\n\\n') +\n this.emit('\\n' + this.indent(-1) + this.indent() + '}')\n : ';')\n );\n }\n\n /**\n * Visit import node.\n */\n import(node: CssImportAST) {\n return this.emit('@import ' + node.import + ';', node.position);\n }\n\n /**\n * Visit media node.\n */\n media(node: CssMediaAST) {\n if (this.compress) {\n return (\n this.emit('@media ' + node.media, node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit(this.indent() + '@media ' + node.media, node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit('\\n' + this.indent(-1) + this.indent() + '}')\n );\n }\n\n /**\n * Visit document node.\n */\n document(node: CssDocumentAST) {\n const doc = '@' + (node.vendor || '') + 'document ' + node.document;\n if (this.compress) {\n return (\n this.emit(doc, node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit(doc, node.position) +\n this.emit(' ' + ' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit(this.indent(-1) + '\\n}')\n );\n }\n\n /**\n * Visit charset node.\n */\n charset(node: CssCharsetAST) {\n return this.emit('@charset ' + node.charset + ';', node.position);\n }\n\n /**\n * Visit namespace node.\n */\n namespace(node: CssNamespaceAST) {\n return this.emit('@namespace ' + node.namespace + ';', node.position);\n }\n\n /**\n * Visit supports node.\n */\n supports(node: CssSupportsAST) {\n if (this.compress) {\n return (\n this.emit('@supports ' + node.supports, node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit(this.indent() + '@supports ' + node.supports, node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit('\\n' + this.indent(-1) + this.indent() + '}')\n );\n }\n\n /**\n * Visit keyframes node.\n */\n keyframes(node: CssKeyframesAST) {\n if (this.compress) {\n return (\n this.emit(\n '@' + (node.vendor || '') + 'keyframes ' + node.name,\n node.position\n ) +\n this.emit('{') +\n this.mapVisit(node.keyframes) +\n this.emit('}')\n );\n }\n return (\n this.emit(\n '@' + (node.vendor || '') + 'keyframes ' + node.name,\n node.position\n ) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.keyframes, '\\n') +\n this.emit(this.indent(-1) + '}')\n );\n }\n\n /**\n * Visit keyframe node.\n */\n keyframe(node: CssKeyframeAST) {\n const decls = node.declarations;\n if (this.compress) {\n return (\n this.emit(node.values.join(','), node.position) +\n this.emit('{') +\n this.mapVisit(decls) +\n this.emit('}')\n );\n }\n\n return (\n this.emit(this.indent()) +\n this.emit(node.values.join(', '), node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(decls, '\\n') +\n this.emit(this.indent(-1) + '\\n' + this.indent() + '}\\n')\n );\n }\n\n /**\n * Visit page node.\n */\n page(node: CssPageAST) {\n if (this.compress) {\n const sel = node.selectors.length ? node.selectors.join(', ') : '';\n\n return (\n this.emit('@page ' + sel, node.position) +\n this.emit('{') +\n this.mapVisit(node.declarations) +\n this.emit('}')\n );\n }\n const sel = node.selectors.length ? node.selectors.join(', ') + ' ' : '';\n\n return (\n this.emit('@page ' + sel, node.position) +\n this.emit('{\\n') +\n this.emit(this.indent(1)) +\n this.mapVisit(node.declarations, '\\n') +\n this.emit(this.indent(-1)) +\n this.emit('\\n}')\n );\n }\n\n /**\n * Visit font-face node.\n */\n fontFace(node: CssFontFaceAST) {\n if (this.compress) {\n return (\n this.emit('@font-face', node.position) +\n this.emit('{') +\n this.mapVisit(node.declarations) +\n this.emit('}')\n );\n }\n return (\n this.emit('@font-face ', node.position) +\n this.emit('{\\n') +\n this.emit(this.indent(1)) +\n this.mapVisit(node.declarations, '\\n') +\n this.emit(this.indent(-1)) +\n this.emit('\\n}')\n );\n }\n\n /**\n * Visit host node.\n */\n host(node: CssHostAST) {\n if (this.compress) {\n return (\n this.emit('@host', node.position) +\n this.emit('{') +\n this.mapVisit(node.rules) +\n this.emit('}')\n );\n }\n return (\n this.emit('@host', node.position) +\n this.emit(' {\\n' + this.indent(1)) +\n this.mapVisit(node.rules, '\\n\\n') +\n this.emit(this.indent(-1) + '\\n}')\n );\n }\n\n /**\n * Visit custom-media node.\n */\n customMedia(node: CssCustomMediaAST) {\n return this.emit(\n '@custom-media ' + node.name + ' ' + node.media + ';',\n node.position\n );\n }\n\n /**\n * Visit rule node.\n */\n rule(node: CssRuleAST) {\n const decls = node.declarations;\n if (!decls.length) {\n return '';\n }\n\n if (this.compress) {\n return (\n this.emit(node.selectors.join(','), node.position) +\n this.emit('{') +\n this.mapVisit(decls) +\n this.emit('}')\n );\n }\n const indent = this.indent();\n\n return (\n this.emit(\n node.selectors\n .map(s => {\n return indent + s;\n })\n .join(',\\n'),\n node.position\n ) +\n this.emit(' {\\n') +\n this.emit(this.indent(1)) +\n this.mapVisit(decls, '\\n') +\n this.emit(this.indent(-1)) +\n this.emit('\\n' + this.indent() + '}')\n );\n }\n\n /**\n * Visit declaration node.\n */\n declaration(node: CssDeclarationAST) {\n if (this.compress) {\n return (\n this.emit(node.property + ':' + node.value, node.position) +\n this.emit(';')\n );\n }\n return (\n this.emit(this.indent()) +\n this.emit(node.property + ': ' + node.value, node.position) +\n this.emit(';')\n );\n }\n}\n\nexport default Compiler;\n"],"names":[],"version":3,"file":"index.cjs.map"} |