{"version":3,"file":"styled-components-primitives.cjs.js","sources":["../../src/utils/generateAlphabeticName.js","../../src/utils/hash.js","../../src/utils/generateComponentId.js","../../src/utils/getComponentName.js","../../src/utils/isFunction.js","../../src/utils/isStatelessFunction.js","../../src/utils/isPlainObject.js","../../src/utils/isStyledComponent.js","../../src/constants.js","../../src/utils/empties.js","../../src/utils/errors.js","../../src/utils/error.js","../../src/sheet/GroupedTag.js","../../src/sheet/GroupIDAllocator.js","../../src/sheet/Rehydration.js","../../src/utils/nonce.js","../../src/sheet/dom.js","../../src/sheet/Tag.js","../../src/sheet/Sheet.js","../../src/utils/stylisPluginInsertRule.js","../../src/utils/stylis.js","../../src/models/StyleSheetManager.js","../../src/models/Keyframes.js","../../src/utils/hyphenateStyleName.js","../../src/utils/addUnitIfNeeded.js","../../src/utils/flatten.js","../../src/vendor/postcss/warn-once.js","../../src/vendor/postcss/tokenize.js","../../src/vendor/postcss/terminal-highlight.js","../../src/vendor/postcss/css-syntax-error.js","../../src/vendor/postcss/stringifier.js","../../src/vendor/postcss/stringify.js","../../src/vendor/postcss/node.js","../../src/vendor/postcss/declaration.js","../../src/vendor/postcss/comment.js","../../src/vendor/postcss/parser.js","../../src/vendor/postcss/parse.js","../../src/vendor/postcss/container.js","../../src/vendor/postcss/at-rule.js","../../src/vendor/postcss/list.js","../../src/vendor/postcss/rule.js","../../src/vendor/postcss/warning.js","../../src/vendor/postcss/result.js","../../src/vendor/postcss/lazy-result.js","../../src/vendor/postcss/processor.js","../../src/vendor/postcss/root.js","../../src/vendor/postcss/input.js","../../src/vendor/postcss-safe-parser/safe-parser.js","../../src/vendor/postcss-safe-parser/parse.js","../../src/models/InlineStyle.js","../../src/utils/mixinDeep.js","../../src/utils/determineTheme.js","../../src/utils/isTag.js","../../src/utils/generateDisplayName.js","../../src/models/ThemeProvider.js","../../src/models/StyledNativeComponent.js","../../src/utils/interleave.js","../../src/constructors/css.js","../../src/constructors/constructWithOptions.js","../../src/hoc/withTheme.js","../../src/hooks/useTheme.js","../../src/primitives/index.js"],"sourcesContent":["// @flow\n/* eslint-disable no-bitwise */\n\nconst AD_REPLACER_R = /(a)(d)/gi;\n\n/* This is the \"capacity\" of our alphabet i.e. 2x26 for all letters plus their capitalised\n * counterparts */\nconst charsLength = 52;\n\n/* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalised letters */\nconst getAlphabeticChar = (code: number): string =>\n String.fromCharCode(code + (code > 25 ? 39 : 97));\n\n/* input a number, usually a hash and convert it to base-52 */\nexport default function generateAlphabeticName(code: number): string {\n let name = '';\n let x;\n\n /* get a char and divide by alphabet-length */\n for (x = Math.abs(code); x > charsLength; x = (x / charsLength) | 0) {\n name = getAlphabeticChar(x % charsLength) + name;\n }\n\n return (getAlphabeticChar(x % charsLength) + name).replace(AD_REPLACER_R, '$1-$2');\n}\n","// @flow\n/* eslint-disable */\n\nexport const SEED = 5381;\n\n// When we have separate strings it's useful to run a progressive\n// version of djb2 where we pretend that we're still looping over\n// the same string\nexport const phash = (h: number, x: string): number => {\n let i = x.length;\n\n while (i) {\n h = (h * 33) ^ x.charCodeAt(--i);\n }\n\n return h;\n};\n\n// This is a djb2 hashing function\nexport const hash = (x: string): number => {\n return phash(SEED, x);\n};\n","// @flow\n/* eslint-disable */\nimport generateAlphabeticName from './generateAlphabeticName';\nimport { hash } from './hash';\n\nexport default (str: string): string => {\n return generateAlphabeticName(hash(str) >>> 0);\n};\n","// @flow\nimport type { IStyledComponent } from '../types';\n\nexport default function getComponentName(\n target: $PropertyType\n): string {\n return (\n (process.env.NODE_ENV !== 'production' ? typeof target === 'string' && target : false) ||\n // $FlowFixMe\n target.displayName ||\n // $FlowFixMe\n target.name ||\n 'Component'\n );\n}\n","// @flow\nexport default function isFunction(test: any): boolean %checks {\n return typeof test === 'function';\n}\n","// @flow\nexport default function isStatelessFunction(test: any): boolean {\n return (\n typeof test === 'function'\n && !(\n test.prototype\n && test.prototype.isReactComponent\n )\n );\n}\n","// @flow\nimport { typeOf } from 'react-is';\n\nexport default (x: any): boolean =>\n x !== null &&\n typeof x === 'object' &&\n (x.toString ? x.toString() : Object.prototype.toString.call(x)) === '[object Object]' &&\n !typeOf(x);\n","// @flow\nexport default function isStyledComponent(target: any): boolean %checks {\n return target && typeof target.styledComponentId === 'string';\n}\n","// @flow\n\ndeclare var SC_DISABLE_SPEEDY: ?boolean;\ndeclare var __VERSION__: string;\n\nexport const SC_ATTR: string =\n (typeof process !== 'undefined' &&\n typeof process.env !== 'undefined' &&\n (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||\n 'data-styled';\n\nexport const SC_ATTR_ACTIVE = 'active';\nexport const SC_ATTR_VERSION = 'data-styled-version';\nexport const SC_VERSION = __VERSION__;\nexport const SPLITTER = '/*!sc*/\\n';\n\nexport const IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;\n\nexport const DISABLE_SPEEDY = Boolean(\n typeof SC_DISABLE_SPEEDY === 'boolean'\n ? SC_DISABLE_SPEEDY\n : typeof process !== 'undefined' && typeof process.env !== 'undefined'\n ? typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&\n process.env.REACT_APP_SC_DISABLE_SPEEDY !== ''\n ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false'\n ? false\n : process.env.REACT_APP_SC_DISABLE_SPEEDY\n : typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' && process.env.SC_DISABLE_SPEEDY !== ''\n ? process.env.SC_DISABLE_SPEEDY === 'false'\n ? false\n : process.env.SC_DISABLE_SPEEDY\n : process.env.NODE_ENV !== 'production'\n : false\n);\n\n// Shared empty execution context when generating static styles\nexport const STATIC_EXECUTION_CONTEXT = {};\n","// @flow\nexport const EMPTY_ARRAY = Object.freeze([]);\nexport const EMPTY_OBJECT = Object.freeze({});\n","export default {\"1\":\"Cannot create styled-component for component: %s.\\n\\n\",\"2\":\"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\\n\\n- Are you trying to reuse it across renders?\\n- Are you accidentally calling collectStyles twice?\\n\\n\",\"3\":\"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\\n\\n\",\"4\":\"The `StyleSheetManager` expects a valid target or sheet prop!\\n\\n- Does this error occur on the client and is your target falsy?\\n- Does this error occur on the server and is the sheet falsy?\\n\\n\",\"5\":\"The clone method cannot be used on the client!\\n\\n- Are you running in a client-like environment on the server?\\n- Are you trying to run SSR on the client?\\n\\n\",\"6\":\"Trying to insert a new style tag, but the given Node is unmounted!\\n\\n- Are you using a custom target that isn't mounted?\\n- Does your document not have a valid head element?\\n- Have you accidentally removed a style tag manually?\\n\\n\",\"7\":\"ThemeProvider: Please return an object from your \\\"theme\\\" prop function, e.g.\\n\\n```js\\ntheme={() => ({})}\\n```\\n\\n\",\"8\":\"ThemeProvider: Please make your \\\"theme\\\" prop an object.\\n\\n\",\"9\":\"Missing document ``\\n\\n\",\"10\":\"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\\n\\n\",\"11\":\"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\\n\\n\",\"12\":\"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\\\`\\\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\\n\\n\",\"13\":\"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\\n\\n\",\"14\":\"ThemeProvider: \\\"theme\\\" prop is required.\\n\\n\",\"15\":\"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to ``, please make sure each plugin is uniquely-named, e.g.\\n\\n```js\\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\\n```\\n\\n\",\"16\":\"Reached the limit of how many styled components may be created at group %s.\\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\\nas for instance in your render method then you may be running into this limitation.\\n\\n\",\"17\":\"CSSStyleSheet could not be found on HTMLStyleElement.\\nHas styled-components' style tag been unmounted or altered by another script?\\n\"};","// @flow\nimport errorMap from './errors';\n\nconst ERRORS = process.env.NODE_ENV !== 'production' ? errorMap : {};\n\n/**\n * super basic version of sprintf\n */\nfunction format(...args) {\n let a = args[0];\n const b = [];\n\n for (let c = 1, len = args.length; c < len; c += 1) {\n b.push(args[c]);\n }\n\n b.forEach(d => {\n a = a.replace(/%[a-z]/, d);\n });\n\n return a;\n}\n\n/**\n * Create an error file out of errors.md for development and a simple web link to the full errors\n * in production mode.\n */\nexport default function throwStyledComponentsError(\n code: string | number,\n ...interpolations: Array\n) {\n if (process.env.NODE_ENV === 'production') {\n throw new Error(\n `An error occurred. See https://git.io/JUIaE#${code} for more information.${\n interpolations.length > 0 ? ` Args: ${interpolations.join(', ')}` : ''\n }`\n );\n } else {\n throw new Error(format(ERRORS[code], ...interpolations).trim());\n }\n}\n","// @flow\n/* eslint-disable no-use-before-define */\n\nimport type { GroupedTag, Tag } from './types';\nimport { SPLITTER } from '../constants';\nimport throwStyledError from '../utils/error';\n\n/** Create a GroupedTag with an underlying Tag implementation */\nexport const makeGroupedTag = (tag: Tag): GroupedTag => {\n return new DefaultGroupedTag(tag);\n};\n\nconst BASE_SIZE = 1 << 9;\n\nclass DefaultGroupedTag implements GroupedTag {\n groupSizes: Uint32Array;\n\n length: number;\n\n tag: Tag;\n\n constructor(tag: Tag) {\n this.groupSizes = new Uint32Array(BASE_SIZE);\n this.length = BASE_SIZE;\n this.tag = tag;\n }\n\n indexOfGroup(group: number): number {\n let index = 0;\n for (let i = 0; i < group; i++) {\n index += this.groupSizes[i];\n }\n\n return index;\n }\n\n insertRules(group: number, rules: string[]): void {\n if (group >= this.groupSizes.length) {\n const oldBuffer = this.groupSizes;\n const oldSize = oldBuffer.length;\n\n let newSize = oldSize;\n while (group >= newSize) {\n newSize <<= 1;\n if (newSize < 0) {\n throwStyledError(16, `${group}`);\n }\n }\n\n this.groupSizes = new Uint32Array(newSize);\n this.groupSizes.set(oldBuffer);\n this.length = newSize;\n\n for (let i = oldSize; i < newSize; i++) {\n this.groupSizes[i] = 0;\n }\n }\n\n let ruleIndex = this.indexOfGroup(group + 1);\n for (let i = 0, l = rules.length; i < l; i++) {\n if (this.tag.insertRule(ruleIndex, rules[i])) {\n this.groupSizes[group]++;\n ruleIndex++;\n }\n }\n }\n\n clearGroup(group: number): void {\n if (group < this.length) {\n const length = this.groupSizes[group];\n const startIndex = this.indexOfGroup(group);\n const endIndex = startIndex + length;\n\n this.groupSizes[group] = 0;\n\n for (let i = startIndex; i < endIndex; i++) {\n this.tag.deleteRule(startIndex);\n }\n }\n }\n\n getGroup(group: number): string {\n let css = '';\n if (group >= this.length || this.groupSizes[group] === 0) {\n return css;\n }\n\n const length = this.groupSizes[group];\n const startIndex = this.indexOfGroup(group);\n const endIndex = startIndex + length;\n\n for (let i = startIndex; i < endIndex; i++) {\n css += `${this.tag.getRule(i)}${SPLITTER}`;\n }\n\n return css;\n }\n}\n","// @flow\n\nimport throwStyledError from '../utils/error';\n\nconst MAX_SMI = 1 << 31 - 1;\n\nlet groupIDRegister: Map = new Map();\nlet reverseRegister: Map = new Map();\nlet nextFreeGroup = 1;\n\nexport const resetGroupIds = () => {\n groupIDRegister = new Map();\n reverseRegister = new Map();\n nextFreeGroup = 1;\n};\n\nexport const getGroupForId = (id: string): number => {\n if (groupIDRegister.has(id)) {\n return (groupIDRegister.get(id): any);\n }\n\n while (reverseRegister.has(nextFreeGroup)) {\n nextFreeGroup++;\n }\n\n const group = nextFreeGroup++;\n\n if (\n process.env.NODE_ENV !== 'production' &&\n ((group | 0) < 0 || group > MAX_SMI)\n ) {\n throwStyledError(16, `${group}`);\n }\n\n groupIDRegister.set(id, group);\n reverseRegister.set(group, id);\n return group;\n};\n\nexport const getIdForGroup = (group: number): void | string => {\n return reverseRegister.get(group);\n};\n\nexport const setGroupForId = (id: string, group: number) => {\n if (group >= nextFreeGroup) {\n nextFreeGroup = group + 1;\n }\n\n groupIDRegister.set(id, group);\n reverseRegister.set(group, id);\n};\n","// @flow\n\nimport { SPLITTER, SC_ATTR, SC_ATTR_ACTIVE, SC_ATTR_VERSION, SC_VERSION } from '../constants';\nimport { getIdForGroup, setGroupForId } from './GroupIDAllocator';\nimport type { Sheet } from './types';\n\nconst SELECTOR = `style[${SC_ATTR}][${SC_ATTR_VERSION}=\"${SC_VERSION}\"]`;\nconst MARKER_RE = new RegExp(`^${SC_ATTR}\\\\.g(\\\\d+)\\\\[id=\"([\\\\w\\\\d-]+)\"\\\\].*?\"([^\"]*)`);\n\nexport const outputSheet = (sheet: Sheet) => {\n const tag = sheet.getTag();\n const { length } = tag;\n\n let css = '';\n for (let group = 0; group < length; group++) {\n const id = getIdForGroup(group);\n if (id === undefined) continue;\n\n const names = sheet.names.get(id);\n const rules = tag.getGroup(group);\n if (!names || !rules || !names.size) continue;\n\n const selector = `${SC_ATTR}.g${group}[id=\"${id}\"]`;\n\n let content = '';\n if (names !== undefined) {\n names.forEach(name => {\n if (name.length > 0) {\n content += `${name},`;\n }\n });\n }\n\n // NOTE: It's easier to collect rules and have the marker\n // after the actual rules to simplify the rehydration\n css += `${rules}${selector}{content:\"${content}\"}${SPLITTER}`;\n }\n\n return css;\n};\n\nconst rehydrateNamesFromContent = (sheet: Sheet, id: string, content: string) => {\n const names = content.split(',');\n let name;\n\n for (let i = 0, l = names.length; i < l; i++) {\n // eslint-disable-next-line\n if ((name = names[i])) {\n sheet.registerName(id, name);\n }\n }\n};\n\nconst rehydrateSheetFromTag = (sheet: Sheet, style: HTMLStyleElement) => {\n const parts = (style.textContent || '').split(SPLITTER);\n const rules: string[] = [];\n\n for (let i = 0, l = parts.length; i < l; i++) {\n const part = parts[i].trim();\n if (!part) continue;\n\n const marker = part.match(MARKER_RE);\n\n if (marker) {\n const group = parseInt(marker[1], 10) | 0;\n const id = marker[2];\n\n if (group !== 0) {\n // Rehydrate componentId to group index mapping\n setGroupForId(id, group);\n // Rehydrate names and rules\n // looks like: data-styled.g11[id=\"idA\"]{content:\"nameA,\"}\n rehydrateNamesFromContent(sheet, id, marker[3]);\n sheet.getTag().insertRules(group, rules);\n }\n\n rules.length = 0;\n } else {\n rules.push(part);\n }\n }\n};\n\nexport const rehydrateSheet = (sheet: Sheet) => {\n const nodes = document.querySelectorAll(SELECTOR);\n\n for (let i = 0, l = nodes.length; i < l; i++) {\n const node = ((nodes[i]: any): HTMLStyleElement);\n if (node && node.getAttribute(SC_ATTR) !== SC_ATTR_ACTIVE) {\n rehydrateSheetFromTag(sheet, node);\n\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n }\n }\n};\n","// @flow\n/* eslint-disable camelcase, no-undef */\n\ndeclare var __webpack_nonce__: string;\n\nconst getNonce = () => {\n return typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n};\n\nexport default getNonce;\n","// @flow\n\nimport { SC_ATTR, SC_ATTR_ACTIVE, SC_ATTR_VERSION, SC_VERSION } from '../constants';\nimport getNonce from '../utils/nonce';\nimport throwStyledError from '../utils/error';\n\nconst ELEMENT_TYPE = 1; /* Node.ELEMENT_TYPE */\n\n/** Find last style element if any inside target */\nconst findLastStyleTag = (target: HTMLElement): void | HTMLStyleElement => {\n const { childNodes } = target;\n\n for (let i = childNodes.length; i >= 0; i--) {\n const child = ((childNodes[i]: any): ?HTMLElement);\n if (child && child.nodeType === ELEMENT_TYPE && child.hasAttribute(SC_ATTR)) {\n return ((child: any): HTMLStyleElement);\n }\n }\n\n return undefined;\n};\n\n/** Create a style element inside `target` or after the last */\nexport const makeStyleTag = (target?: HTMLElement): HTMLStyleElement => {\n const head = ((document.head: any): HTMLElement);\n const parent = target || head;\n const style = document.createElement('style');\n const prevStyle = findLastStyleTag(parent);\n const nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;\n\n style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);\n style.setAttribute(SC_ATTR_VERSION, SC_VERSION);\n\n const nonce = getNonce();\n\n if (nonce) style.setAttribute('nonce', nonce);\n\n parent.insertBefore(style, nextSibling);\n\n return style;\n};\n\n/** Get the CSSStyleSheet instance for a given style element */\nexport const getSheet = (tag: HTMLStyleElement): CSSStyleSheet => {\n if (tag.sheet) {\n return ((tag.sheet: any): CSSStyleSheet);\n }\n\n // Avoid Firefox quirk where the style element might not have a sheet property\n const { styleSheets } = document;\n for (let i = 0, l = styleSheets.length; i < l; i++) {\n const sheet = styleSheets[i];\n if (sheet.ownerNode === tag) {\n return ((sheet: any): CSSStyleSheet);\n }\n }\n\n throwStyledError(17);\n return (undefined: any);\n};\n","// @flow\n/* eslint-disable no-use-before-define */\n\nimport { makeStyleTag, getSheet } from './dom';\nimport type { SheetOptions, Tag } from './types';\n\n/** Create a CSSStyleSheet-like tag depending on the environment */\nexport const makeTag = ({ isServer, useCSSOMInjection, target }: SheetOptions): Tag => {\n if (isServer) {\n return new VirtualTag(target);\n } else if (useCSSOMInjection) {\n return new CSSOMTag(target);\n } else {\n return new TextTag(target);\n }\n};\n\nexport class CSSOMTag implements Tag {\n element: HTMLStyleElement;\n\n sheet: CSSStyleSheet;\n\n length: number;\n\n constructor(target?: HTMLElement) {\n const element = (this.element = makeStyleTag(target));\n\n // Avoid Edge bug where empty style elements don't create sheets\n element.appendChild(document.createTextNode(''));\n\n this.sheet = getSheet(element);\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n try {\n this.sheet.insertRule(rule, index);\n this.length++;\n return true;\n } catch (_error) {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.sheet.deleteRule(index);\n this.length--;\n }\n\n getRule(index: number): string {\n const rule = this.sheet.cssRules[index];\n // Avoid IE11 quirk where cssText is inaccessible on some invalid rules\n if (rule !== undefined && typeof rule.cssText === 'string') {\n return rule.cssText;\n } else {\n return '';\n }\n }\n}\n\n/** A Tag that emulates the CSSStyleSheet API but uses text nodes */\nexport class TextTag implements Tag {\n element: HTMLStyleElement;\n\n nodes: NodeList;\n\n length: number;\n\n constructor(target?: HTMLElement) {\n const element = (this.element = makeStyleTag(target));\n this.nodes = element.childNodes;\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n if (index <= this.length && index >= 0) {\n const node = document.createTextNode(rule);\n const refNode = this.nodes[index];\n this.element.insertBefore(node, refNode || null);\n this.length++;\n return true;\n } else {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.element.removeChild(this.nodes[index]);\n this.length--;\n }\n\n getRule(index: number): string {\n if (index < this.length) {\n return this.nodes[index].textContent;\n } else {\n return '';\n }\n }\n}\n\n/** A completely virtual (server-side) Tag that doesn't manipulate the DOM */\nexport class VirtualTag implements Tag {\n rules: string[];\n\n length: number;\n\n constructor(_target?: HTMLElement) {\n this.rules = [];\n this.length = 0;\n }\n\n insertRule(index: number, rule: string): boolean {\n if (index <= this.length) {\n this.rules.splice(index, 0, rule);\n this.length++;\n return true;\n } else {\n return false;\n }\n }\n\n deleteRule(index: number): void {\n this.rules.splice(index, 1);\n this.length--;\n }\n\n getRule(index: number): string {\n if (index < this.length) {\n return this.rules[index];\n } else {\n return '';\n }\n }\n}\n","// @flow\nimport { DISABLE_SPEEDY, IS_BROWSER } from '../constants';\nimport { EMPTY_OBJECT } from '../utils/empties';\nimport { makeGroupedTag } from './GroupedTag';\nimport { getGroupForId } from './GroupIDAllocator';\nimport { outputSheet, rehydrateSheet } from './Rehydration';\nimport { makeTag } from './Tag';\nimport type { GroupedTag, Sheet, SheetOptions } from './types';\n\nlet SHOULD_REHYDRATE = IS_BROWSER;\n\ntype SheetConstructorArgs = {\n isServer?: boolean,\n useCSSOMInjection?: boolean,\n target?: HTMLElement,\n};\n\ntype GlobalStylesAllocationMap = { [key: string]: number };\ntype NamesAllocationMap = Map>;\n\nconst defaultOptions: SheetOptions = {\n isServer: !IS_BROWSER,\n useCSSOMInjection: !DISABLE_SPEEDY,\n};\n\n/** Contains the main stylesheet logic for stringification and caching */\nexport default class StyleSheet implements Sheet {\n gs: GlobalStylesAllocationMap;\n\n names: NamesAllocationMap;\n\n options: SheetOptions;\n\n server: boolean;\n\n tag: void | GroupedTag;\n\n /** Register a group ID to give it an index */\n static registerId(id: string): number {\n return getGroupForId(id);\n }\n\n constructor(\n options: SheetConstructorArgs = EMPTY_OBJECT,\n globalStyles?: GlobalStylesAllocationMap = {},\n names?: NamesAllocationMap\n ) {\n this.options = {\n ...defaultOptions,\n ...options,\n };\n\n this.gs = globalStyles;\n this.names = new Map(names);\n this.server = !!options.isServer;\n\n // We rehydrate only once and use the sheet that is created first\n if (!this.server && IS_BROWSER && SHOULD_REHYDRATE) {\n SHOULD_REHYDRATE = false;\n rehydrateSheet(this);\n }\n }\n\n reconstructWithOptions(options: SheetConstructorArgs, withNames?: boolean = true) {\n return new StyleSheet(\n { ...this.options, ...options },\n this.gs,\n (withNames && this.names) || undefined\n );\n }\n\n allocateGSInstance(id: string) {\n return (this.gs[id] = (this.gs[id] || 0) + 1);\n }\n\n /** Lazily initialises a GroupedTag for when it's actually needed */\n getTag(): GroupedTag {\n return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));\n }\n\n /** Check whether a name is known for caching */\n hasNameForId(id: string, name: string): boolean {\n return this.names.has(id) && (this.names.get(id): any).has(name);\n }\n\n /** Mark a group's name as known for caching */\n registerName(id: string, name: string) {\n getGroupForId(id);\n\n if (!this.names.has(id)) {\n const groupNames = new Set();\n groupNames.add(name);\n this.names.set(id, groupNames);\n } else {\n (this.names.get(id): any).add(name);\n }\n }\n\n /** Insert new rules which also marks the name as known */\n insertRules(id: string, name: string, rules: string[]) {\n this.registerName(id, name);\n this.getTag().insertRules(getGroupForId(id), rules);\n }\n\n /** Clears all cached names for a given group ID */\n clearNames(id: string) {\n if (this.names.has(id)) {\n (this.names.get(id): any).clear();\n }\n }\n\n /** Clears all rules for a given group ID */\n clearRules(id: string) {\n this.getTag().clearGroup(getGroupForId(id));\n this.clearNames(id);\n }\n\n /** Clears the entire tag which deletes all rules but not its names */\n clearTag() {\n // NOTE: This does not clear the names, since it's only used during SSR\n // so that we can continuously output only new rules\n this.tag = undefined;\n }\n\n /** Outputs the current sheet as a CSS string with markers for SSR */\n toString(): string {\n return outputSheet(this);\n }\n}\n","/**\n * MIT License\n *\n * Copyright (c) 2016 Sultan Tarimo\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\n * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n/* eslint-disable */\n\nexport default function(insertRule) {\n const delimiter = '/*|*/';\n const needle = `${delimiter}}`;\n\n function toSheet(block) {\n if (block) {\n try {\n insertRule(`${block}}`);\n } catch (e) {}\n }\n }\n\n return function ruleSheet(\n context,\n content,\n selectors,\n parents,\n line,\n column,\n length,\n ns,\n depth,\n at\n ) {\n switch (context) {\n // property\n case 1:\n // @import\n if (depth === 0 && content.charCodeAt(0) === 64) return insertRule(`${content};`), '';\n break;\n // selector\n case 2:\n if (ns === 0) return content + delimiter;\n break;\n // at-rule\n case 3:\n switch (ns) {\n // @font-face, @page\n case 102:\n case 112:\n return insertRule(selectors[0] + content), '';\n default:\n return content + (at === 0 ? delimiter : '');\n }\n case -2:\n content.split(needle).forEach(toSheet);\n }\n };\n}\n","import Stylis from '@emotion/stylis';\nimport { type Stringifier } from '../types';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from './empties';\nimport throwStyledError from './error';\nimport { phash, SEED } from './hash';\nimport insertRulePlugin from './stylisPluginInsertRule';\n\nconst COMMENT_REGEX = /^\\s*\\/\\/.*$/gm;\nconst COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];\n\ntype StylisInstanceConstructorArgs = {\n options?: Object,\n plugins?: Array,\n};\n\nexport default function createStylisInstance({\n options = EMPTY_OBJECT,\n plugins = EMPTY_ARRAY,\n}: StylisInstanceConstructorArgs = EMPTY_OBJECT) {\n const stylis = new Stylis(options);\n\n // Wrap `insertRulePlugin to build a list of rules,\n // and then make our own plugin to return the rules. This\n // makes it easier to hook into the existing SSR architecture\n\n let parsingRules = [];\n\n // eslint-disable-next-line consistent-return\n const returnRulesPlugin = context => {\n if (context === -2) {\n const parsedRules = parsingRules;\n parsingRules = [];\n return parsedRules;\n }\n };\n\n const parseRulesPlugin = insertRulePlugin(rule => {\n parsingRules.push(rule);\n });\n\n let _componentId: string;\n let _selector: string;\n let _selectorRegexp: RegExp;\n let _consecutiveSelfRefRegExp: RegExp;\n\n const selfReferenceReplacer = (match, offset, string) => {\n if (\n // do not replace the first occurrence if it is complex (has a modifier)\n (offset === 0 ? COMPLEX_SELECTOR_PREFIX.indexOf(string[_selector.length]) === -1 : true) &&\n // no consecutive self refs (.b.b); that is a precedence boost and treated differently\n !string.match(_consecutiveSelfRefRegExp)\n ) {\n return `.${_componentId}`;\n }\n\n return match;\n };\n\n /**\n * When writing a style like\n *\n * & + & {\n * color: red;\n * }\n *\n * The second ampersand should be a reference to the static component class. stylis\n * has no knowledge of static class so we have to intelligently replace the base selector.\n *\n * https://github.com/thysultan/stylis.js/tree/v3.5.4#plugins <- more info about the context phase values\n * \"2\" means this plugin is taking effect at the very end after all other processing is complete\n */\n const selfReferenceReplacementPlugin = (context, _, selectors) => {\n if (context === 2 && selectors.length && selectors[0].lastIndexOf(_selector) > 0) {\n // eslint-disable-next-line no-param-reassign\n selectors[0] = selectors[0].replace(_selectorRegexp, selfReferenceReplacer);\n }\n };\n\n stylis.use([...plugins, selfReferenceReplacementPlugin, parseRulesPlugin, returnRulesPlugin]);\n\n function stringifyRules(css, selector, prefix, componentId = '&'): Stringifier {\n const flatCSS = css.replace(COMMENT_REGEX, '');\n const cssStr = selector && prefix ? `${prefix} ${selector} { ${flatCSS} }` : flatCSS;\n\n // stylis has no concept of state to be passed to plugins\n // but since JS is single-threaded, we can rely on that to ensure\n // these properties stay in sync with the current stylis run\n _componentId = componentId;\n _selector = selector;\n _selectorRegexp = new RegExp(`\\\\${_selector}\\\\b`, 'g');\n _consecutiveSelfRefRegExp = new RegExp(`(\\\\${_selector}\\\\b){2,}`);\n\n return stylis(prefix || !selector ? '' : selector, cssStr);\n }\n\n stringifyRules.hash = plugins.length\n ? plugins\n .reduce((acc, plugin) => {\n if (!plugin.name) {\n throwStyledError(15);\n }\n\n return phash(acc, plugin.name);\n }, SEED)\n .toString()\n : '';\n\n return stringifyRules;\n}\n","// @flow\nimport React, { type Context, type Node, useContext, useEffect, useMemo, useState } from 'react';\nimport shallowequal from 'shallowequal';\nimport StyleSheet from '../sheet';\nimport type { Stringifier } from '../types';\nimport createStylisInstance from '../utils/stylis';\n\ntype Props = {\n children?: Node,\n disableCSSOMInjection?: boolean,\n disableVendorPrefixes?: boolean,\n sheet?: StyleSheet,\n stylisPlugins?: Array,\n target?: HTMLElement,\n};\n\nexport const StyleSheetContext: Context = React.createContext();\nexport const StyleSheetConsumer = StyleSheetContext.Consumer;\nexport const StylisContext: Context = React.createContext();\nexport const StylisConsumer = StylisContext.Consumer;\n\nexport const masterSheet: StyleSheet = new StyleSheet();\nexport const masterStylis: Stringifier = createStylisInstance();\n\nexport function useStyleSheet(): StyleSheet {\n return useContext(StyleSheetContext) || masterSheet;\n}\n\nexport function useStylis(): Stringifier {\n return useContext(StylisContext) || masterStylis;\n}\n\nexport default function StyleSheetManager(props: Props) {\n const [plugins, setPlugins] = useState(props.stylisPlugins);\n const contextStyleSheet = useStyleSheet();\n\n const styleSheet = useMemo(() => {\n let sheet = contextStyleSheet;\n\n if (props.sheet) {\n // eslint-disable-next-line prefer-destructuring\n sheet = props.sheet;\n } else if (props.target) {\n sheet = sheet.reconstructWithOptions({ target: props.target }, false);\n }\n\n if (props.disableCSSOMInjection) {\n sheet = sheet.reconstructWithOptions({ useCSSOMInjection: false });\n }\n\n return sheet;\n }, [props.disableCSSOMInjection, props.sheet, props.target]);\n\n const stylis = useMemo(\n () =>\n createStylisInstance({\n options: { prefix: !props.disableVendorPrefixes },\n plugins,\n }),\n [props.disableVendorPrefixes, plugins]\n );\n\n useEffect(() => {\n if (!shallowequal(plugins, props.stylisPlugins)) setPlugins(props.stylisPlugins);\n }, [props.stylisPlugins]);\n\n return (\n \n \n {process.env.NODE_ENV !== 'production'\n ? React.Children.only(props.children)\n : props.children}\n \n \n );\n}\n","// @flow\nimport StyleSheet from '../sheet';\nimport { type Stringifier } from '../types';\nimport throwStyledError from '../utils/error';\nimport { masterStylis } from './StyleSheetManager';\n\nexport default class Keyframes {\n id: string;\n\n name: string;\n\n rules: string;\n\n constructor(name: string, rules: string) {\n this.name = name;\n this.id = `sc-keyframes-${name}`;\n this.rules = rules;\n }\n\n inject = (styleSheet: StyleSheet, stylisInstance: Stringifier = masterStylis) => {\n const resolvedName = this.name + stylisInstance.hash;\n\n if (!styleSheet.hasNameForId(this.id, resolvedName)) {\n styleSheet.insertRules(\n this.id,\n resolvedName,\n stylisInstance(this.rules, resolvedName, '@keyframes')\n );\n }\n };\n\n toString = () => {\n return throwStyledError(12, String(this.name));\n };\n\n getName(stylisInstance: Stringifier = masterStylis) {\n return this.name + stylisInstance.hash;\n }\n}\n","// @flow\n\n/**\n * inlined version of\n * https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js\n */\n\nconst uppercaseCheck = /([A-Z])/;\nconst uppercasePattern = /([A-Z])/g;\nconst msPattern = /^ms-/;\nconst prefixAndLowerCase = (char: string): string => `-${char.toLowerCase()}`;\n\n/**\n * Hyphenates a camelcased CSS property name, for example:\n *\n * > hyphenateStyleName('backgroundColor')\n * < \"background-color\"\n * > hyphenateStyleName('MozTransition')\n * < \"-moz-transition\"\n * > hyphenateStyleName('msTransition')\n * < \"-ms-transition\"\n *\n * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix\n * is converted to `-ms-`.\n *\n * @param {string} string\n * @return {string}\n */\nexport default function hyphenateStyleName(string: string): string {\n return uppercaseCheck.test(string)\n ? string\n .replace(uppercasePattern, prefixAndLowerCase)\n .replace(msPattern, '-ms-')\n : string;\n}\n","// @flow\nimport unitless from '@emotion/unitless';\n\n// Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js\nexport default function addUnitIfNeeded(name: string, value: any): any {\n // https://github.com/amilajack/eslint-plugin-flowtype-errors/issues/133\n // $FlowFixMe\n if (value == null || typeof value === 'boolean' || value === '') {\n return '';\n }\n\n if (typeof value === 'number' && value !== 0 && !(name in unitless) && !name.startsWith('--')) {\n return `${value}px`; // Presumes implicit 'px' suffix for unitless numbers except for CSS variables\n }\n\n return String(value).trim();\n}\n","// @flow\nimport { isElement } from 'react-is';\nimport getComponentName from './getComponentName';\nimport isFunction from './isFunction';\nimport isStatelessFunction from './isStatelessFunction';\nimport isPlainObject from './isPlainObject';\nimport isStyledComponent from './isStyledComponent';\nimport Keyframes from '../models/Keyframes';\nimport hyphenate from './hyphenateStyleName';\nimport addUnitIfNeeded from './addUnitIfNeeded';\nimport { type Stringifier } from '../types';\n\n/**\n * It's falsish not falsy because 0 is allowed.\n */\nconst isFalsish = chunk => chunk === undefined || chunk === null || chunk === false || chunk === '';\n\nexport const objToCssArray = (obj: Object, prevKey?: string): Array => {\n const rules = [];\n\n for (const key in obj) {\n if (!obj.hasOwnProperty(key) || isFalsish(obj[key])) continue;\n\n if ((Array.isArray(obj[key]) && obj[key].isCss) || isFunction(obj[key])) {\n rules.push(`${hyphenate(key)}:`, obj[key], ';');\n } else if (isPlainObject(obj[key])) {\n rules.push(...objToCssArray(obj[key], key));\n } else {\n rules.push(`${hyphenate(key)}: ${addUnitIfNeeded(key, obj[key])};`);\n }\n }\n\n return prevKey ? [`${prevKey} {`, ...rules, '}'] : rules;\n};\n\nexport default function flatten(\n chunk: any,\n executionContext: ?Object,\n styleSheet: ?Object,\n stylisInstance: ?Stringifier\n): any {\n if (Array.isArray(chunk)) {\n const ruleSet = [];\n\n for (let i = 0, len = chunk.length, result; i < len; i += 1) {\n result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);\n\n if (result === '') continue;\n else if (Array.isArray(result)) ruleSet.push(...result);\n else ruleSet.push(result);\n }\n\n return ruleSet;\n }\n\n if (isFalsish(chunk)) {\n return '';\n }\n\n /* Handle other components */\n if (isStyledComponent(chunk)) {\n return `.${chunk.styledComponentId}`;\n }\n\n /* Either execute or defer the function */\n if (isFunction(chunk)) {\n if (isStatelessFunction(chunk) && executionContext) {\n const result = chunk(executionContext);\n\n if (process.env.NODE_ENV !== 'production' && isElement(result)) {\n // eslint-disable-next-line no-console\n console.warn(\n `${getComponentName(\n chunk\n )} is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.`\n );\n }\n\n return flatten(result, executionContext, styleSheet, stylisInstance);\n } else return chunk;\n }\n\n if (chunk instanceof Keyframes) {\n if (styleSheet) {\n chunk.inject(styleSheet, stylisInstance);\n return chunk.getName(stylisInstance);\n } else return chunk;\n }\n\n /* Handle objects */\n return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();\n}\n","// @flow\nconst printed = {};\n\nexport default function warnOnce(message) {\n if (printed[message]) return;\n printed[message] = true;\n\n if (typeof console !== 'undefined' && console.warn) console.warn(message);\n}\n","// @flow\nconst SINGLE_QUOTE = \"'\".charCodeAt(0);\nconst DOUBLE_QUOTE = '\"'.charCodeAt(0);\nconst BACKSLASH = '\\\\'.charCodeAt(0);\nconst SLASH = '/'.charCodeAt(0);\nconst NEWLINE = '\\n'.charCodeAt(0);\nconst SPACE = ' '.charCodeAt(0);\nconst FEED = '\\f'.charCodeAt(0);\nconst TAB = '\\t'.charCodeAt(0);\nconst CR = '\\r'.charCodeAt(0);\nconst OPEN_SQUARE = '['.charCodeAt(0);\nconst CLOSE_SQUARE = ']'.charCodeAt(0);\nconst OPEN_PARENTHESES = '('.charCodeAt(0);\nconst CLOSE_PARENTHESES = ')'.charCodeAt(0);\nconst OPEN_CURLY = '{'.charCodeAt(0);\nconst CLOSE_CURLY = '}'.charCodeAt(0);\nconst SEMICOLON = ';'.charCodeAt(0);\nconst ASTERISK = '*'.charCodeAt(0);\nconst COLON = ':'.charCodeAt(0);\nconst AT = '@'.charCodeAt(0);\n\nconst RE_AT_END = /[ \\n\\t\\r\\f\\{\\(\\)'\"\\\\;/\\[\\]#]/g;\nconst RE_WORD_END = /[ \\n\\t\\r\\f\\(\\)\\{\\}:;@!'\"\\\\\\]\\[#]|\\/(?=\\*)/g;\nconst RE_BAD_BRACKET = /.[\\\\\\/\\(\"'\\n]/;\n\nexport default function tokenize(input, options = {}) {\n const tokens = [];\n const css = input.css.valueOf();\n\n const ignore = options.ignoreErrors;\n\n let code,\n next,\n quote,\n lines,\n last,\n content,\n escape,\n nextLine,\n nextOffset,\n escaped,\n escapePos,\n prev,\n n;\n\n const length = css.length;\n let offset = -1;\n let line = 1;\n let pos = 0;\n\n function unclosed(what) {\n throw input.error(`Unclosed ${what}`, line, pos - offset);\n }\n\n while (pos < length) {\n code = css.charCodeAt(pos);\n\n if (code === NEWLINE || code === FEED || (code === CR && css.charCodeAt(pos + 1) !== NEWLINE)) {\n offset = pos;\n line += 1;\n }\n\n switch (code) {\n case NEWLINE:\n case SPACE:\n case TAB:\n case CR:\n case FEED:\n next = pos;\n do {\n next += 1;\n code = css.charCodeAt(next);\n if (code === NEWLINE) {\n offset = next;\n line += 1;\n }\n } while (\n code === SPACE ||\n code === NEWLINE ||\n code === TAB ||\n code === CR ||\n code === FEED\n );\n\n tokens.push(['space', css.slice(pos, next)]);\n pos = next - 1;\n break;\n\n case OPEN_SQUARE:\n tokens.push(['[', '[', line, pos - offset]);\n break;\n\n case CLOSE_SQUARE:\n tokens.push([']', ']', line, pos - offset]);\n break;\n\n case OPEN_CURLY:\n tokens.push(['{', '{', line, pos - offset]);\n break;\n\n case CLOSE_CURLY:\n tokens.push(['}', '}', line, pos - offset]);\n break;\n\n case COLON:\n tokens.push([':', ':', line, pos - offset]);\n break;\n\n case SEMICOLON:\n tokens.push([';', ';', line, pos - offset]);\n break;\n\n case OPEN_PARENTHESES:\n prev = tokens.length ? tokens[tokens.length - 1][1] : '';\n n = css.charCodeAt(pos + 1);\n if (\n prev === 'url' &&\n n !== SINGLE_QUOTE &&\n n !== DOUBLE_QUOTE &&\n n !== SPACE &&\n n !== NEWLINE &&\n n !== TAB &&\n n !== FEED &&\n n !== CR\n ) {\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(')', next + 1);\n if (next === -1) {\n if (ignore) {\n next = pos;\n break;\n } else {\n unclosed('bracket');\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n\n tokens.push([\n 'brackets',\n css.slice(pos, next + 1),\n line,\n pos - offset,\n line,\n next - offset,\n ]);\n pos = next;\n } else {\n next = css.indexOf(')', pos + 1);\n content = css.slice(pos, next + 1);\n\n if (next === -1 || RE_BAD_BRACKET.test(content)) {\n tokens.push(['(', '(', line, pos - offset]);\n } else {\n tokens.push(['brackets', content, line, pos - offset, line, next - offset]);\n pos = next;\n }\n }\n\n break;\n\n case CLOSE_PARENTHESES:\n tokens.push([')', ')', line, pos - offset]);\n break;\n\n case SINGLE_QUOTE:\n case DOUBLE_QUOTE:\n quote = code === SINGLE_QUOTE ? \"'\" : '\"';\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(quote, next + 1);\n if (next === -1) {\n if (ignore) {\n next = pos + 1;\n break;\n } else {\n unclosed('quote');\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n\n content = css.slice(pos, next + 1);\n lines = content.split('\\n');\n last = lines.length - 1;\n\n if (last > 0) {\n nextLine = line + last;\n nextOffset = next - lines[last].length;\n } else {\n nextLine = line;\n nextOffset = offset;\n }\n\n tokens.push([\n 'string',\n css.slice(pos, next + 1),\n line,\n pos - offset,\n nextLine,\n next - nextOffset,\n ]);\n\n offset = nextOffset;\n line = nextLine;\n pos = next;\n break;\n\n case AT:\n RE_AT_END.lastIndex = pos + 1;\n RE_AT_END.test(css);\n if (RE_AT_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_AT_END.lastIndex - 2;\n }\n tokens.push(['at-word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);\n pos = next;\n break;\n\n case BACKSLASH:\n next = pos;\n escape = true;\n while (css.charCodeAt(next + 1) === BACKSLASH) {\n next += 1;\n escape = !escape;\n }\n code = css.charCodeAt(next + 1);\n if (\n escape &&\n (code !== SLASH &&\n code !== SPACE &&\n code !== NEWLINE &&\n code !== TAB &&\n code !== CR &&\n code !== FEED)\n ) {\n next += 1;\n }\n tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);\n pos = next;\n break;\n\n default:\n if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {\n next = css.indexOf('*/', pos + 2) + 1;\n if (next === 0) {\n if (ignore) {\n next = css.length;\n } else {\n unclosed('comment');\n }\n }\n\n content = css.slice(pos, next + 1);\n lines = content.split('\\n');\n last = lines.length - 1;\n\n if (last > 0) {\n nextLine = line + last;\n nextOffset = next - lines[last].length;\n } else {\n nextLine = line;\n nextOffset = offset;\n }\n\n tokens.push(['comment', content, line, pos - offset, nextLine, next - nextOffset]);\n\n offset = nextOffset;\n line = nextLine;\n pos = next;\n } else {\n RE_WORD_END.lastIndex = pos + 1;\n RE_WORD_END.test(css);\n if (RE_WORD_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_WORD_END.lastIndex - 2;\n }\n\n tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);\n pos = next;\n }\n\n break;\n }\n\n pos++;\n }\n\n return tokens;\n}\n","// @flow\nimport tokenize from './tokenize';\nimport Input from './input';\n\nconst HIGHLIGHT_THEME = {\n brackets: [36, 39], // cyan\n string: [31, 39], // red\n 'at-word': [31, 39], // red\n comment: [90, 39], // gray\n '{': [32, 39], // green\n '}': [32, 39], // green\n ':': [1, 22], // bold\n ';': [1, 22], // bold\n '(': [1, 22], // bold\n ')': [1, 22], // bold\n};\n\nfunction code(color) {\n return `\\u001b[${color}m`;\n}\n\nfunction terminalHighlight(css) {\n const tokens = tokenize(new Input(css), { ignoreErrors: true });\n const result = [];\n tokens.forEach(token => {\n const color = HIGHLIGHT_THEME[token[0]];\n if (color) {\n result.push(\n token[1]\n .split(/\\r?\\n/)\n .map(i => code(color[0]) + i + code(color[1]))\n .join('\\n')\n );\n } else {\n result.push(token[1]);\n }\n });\n return result.join('');\n}\n\nexport default terminalHighlight;\n","// @flow\nimport supportsColor from 'supports-color';\n\nimport terminalHighlight from './terminal-highlight';\nimport warnOnce from './warn-once';\n\n/**\n * The CSS parser throws this error for broken CSS.\n *\n * Custom parsers can throw this error for broken custom syntax using\n * the {@link Node#error} method.\n *\n * PostCSS will use the input source map to detect the original error location.\n * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,\n * PostCSS will show the original position in the Sass file.\n *\n * If you need the position in the PostCSS input\n * (e.g., to debug the previous compiler), use `error.input.file`.\n *\n * @example\n * // Catching and checking syntax error\n * try {\n * postcss.parse('a{')\n * } catch (error) {\n * if ( error.name === 'CssSyntaxError' ) {\n * error //=> CssSyntaxError\n * }\n * }\n *\n * @example\n * // Raising error from plugin\n * throw node.error('Unknown variable', { plugin: 'postcss-vars' });\n */\nclass CssSyntaxError {\n /**\n * @param {string} message - error message\n * @param {number} [line] - source line of the error\n * @param {number} [column] - source column of the error\n * @param {string} [source] - source code of the broken file\n * @param {string} [file] - absolute path to the broken file\n * @param {string} [plugin] - PostCSS plugin name, if error came from plugin\n */\n constructor(message, line, column, source, file, plugin) {\n /**\n * @member {string} - Always equal to `'CssSyntaxError'`. You should\n * always check error type\n * by `error.name === 'CssSyntaxError'` instead of\n * `error instanceof CssSyntaxError`, because\n * npm could have several PostCSS versions.\n *\n * @example\n * if ( error.name === 'CssSyntaxError' ) {\n * error //=> CssSyntaxError\n * }\n */\n this.name = 'CssSyntaxError';\n /**\n * @member {string} - Error message.\n *\n * @example\n * error.message //=> 'Unclosed block'\n */\n this.reason = message;\n\n if (file) {\n /**\n * @member {string} - Absolute path to the broken file.\n *\n * @example\n * error.file //=> 'a.sass'\n * error.input.file //=> 'a.css'\n */\n this.file = file;\n }\n if (source) {\n /**\n * @member {string} - Source code of the broken file.\n *\n * @example\n * error.source //=> 'a { b {} }'\n * error.input.column //=> 'a b { }'\n */\n this.source = source;\n }\n if (plugin) {\n /**\n * @member {string} - Plugin name, if error came from plugin.\n *\n * @example\n * error.plugin //=> 'postcss-vars'\n */\n this.plugin = plugin;\n }\n if (typeof line !== 'undefined' && typeof column !== 'undefined') {\n /**\n * @member {number} - Source line of the error.\n *\n * @example\n * error.line //=> 2\n * error.input.line //=> 4\n */\n this.line = line;\n /**\n * @member {number} - Source column of the error.\n *\n * @example\n * error.column //=> 1\n * error.input.column //=> 4\n */\n this.column = column;\n }\n\n this.setMessage();\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CssSyntaxError);\n }\n }\n\n setMessage() {\n /**\n * @member {string} - Full error text in the GNU error format\n * with plugin, file, line and column.\n *\n * @example\n * error.message //=> 'a.css:1:1: Unclosed block'\n */\n this.message = this.plugin ? `${this.plugin}: ` : '';\n this.message += this.file ? this.file : '';\n if (typeof this.line !== 'undefined') {\n this.message += `:${this.line}:${this.column}`;\n }\n this.message += `: ${this.reason}`;\n }\n\n /**\n * Returns a few lines of CSS source that caused the error.\n *\n * If the CSS has an input source map without `sourceContent`,\n * this method will return an empty string.\n *\n * @param {boolean} [color] whether arrow will be colored red by terminal\n * color codes. By default, PostCSS will detect\n * color support by `process.stdout.isTTY`\n * and `process.env.NODE_DISABLE_COLORS`.\n *\n * @example\n * error.showSourceCode() //=> \" 4 | }\n * // 5 | a {\n * // > 6 | bad\n * // | ^\n * // 7 | }\n * // 8 | b {\"\n *\n * @return {string} few lines of CSS source that caused the error\n */\n showSourceCode(color) {\n if (!this.source) return '';\n\n let css = this.source;\n if (typeof color === 'undefined') color = supportsColor;\n if (color) css = terminalHighlight(css);\n\n const lines = css.split(/\\r?\\n/);\n const start = Math.max(this.line - 3, 0);\n const end = Math.min(this.line + 2, lines.length);\n\n const maxWidth = String(end).length;\n\n return lines\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n const padded = ` ${number}`.slice(-maxWidth);\n const gutter = ` ${padded} | `;\n if (number === this.line) {\n const spacing =\n gutter.replace(/\\d/g, ' ') + line.slice(0, this.column - 1).replace(/[^\\t]/g, ' ');\n return `>${gutter}${line}\\n ${spacing}^`;\n } else {\n return ` ${gutter}${line}`;\n }\n })\n .join('\\n');\n }\n\n /**\n * Returns error position, message and source code of the broken part.\n *\n * @example\n * error.toString() //=> \"CssSyntaxError: app.css:1:1: Unclosed block\n * // > 1 | a {\n * // | ^\"\n *\n * @return {string} error position, message and source code\n */\n toString() {\n let code = this.showSourceCode();\n if (code) {\n code = `\\n\\n${code}\\n`;\n }\n return `${this.name}: ${this.message}${code}`;\n }\n\n get generated() {\n warnOnce('CssSyntaxError#generated is deprecated. Use input instead.');\n return this.input;\n }\n\n /**\n * @memberof CssSyntaxError#\n * @member {Input} input - Input object with PostCSS internal information\n * about input file. If input has source map\n * from previous tool, PostCSS will use origin\n * (for example, Sass) source. You can use this\n * object to get PostCSS input source.\n *\n * @example\n * error.input.file //=> 'a.css'\n * error.file //=> 'a.sass'\n */\n}\n\nexport default CssSyntaxError;\n","// @flow\n/* eslint-disable valid-jsdoc */\n\nconst defaultRaw = {\n colon: ': ',\n indent: ' ',\n beforeDecl: '\\n',\n beforeRule: '\\n',\n beforeOpen: ' ',\n beforeClose: '\\n',\n beforeComment: '\\n',\n after: '\\n',\n emptyBody: '',\n commentLeft: ' ',\n commentRight: ' ',\n};\n\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1);\n}\n\nclass Stringifier {\n constructor(builder) {\n this.builder = builder;\n }\n\n stringify(node, semicolon) {\n this[node.type](node, semicolon);\n }\n\n root(node) {\n this.body(node);\n if (node.raws.after) this.builder(node.raws.after);\n }\n\n comment(node) {\n const left = this.raw(node, 'left', 'commentLeft');\n const right = this.raw(node, 'right', 'commentRight');\n this.builder(`/*${left}${node.text}${right}*/`, node);\n }\n\n decl(node, semicolon) {\n const between = this.raw(node, 'between', 'colon');\n let string = node.prop + between + this.rawValue(node, 'value');\n\n if (node.important) {\n string += node.raws.important || ' !important';\n }\n\n if (semicolon) string += ';';\n this.builder(string, node);\n }\n\n rule(node) {\n this.block(node, this.rawValue(node, 'selector'));\n }\n\n atrule(node, semicolon) {\n let name = `@${node.name}`;\n const params = node.params ? this.rawValue(node, 'params') : '';\n\n if (typeof node.raws.afterName !== 'undefined') {\n name += node.raws.afterName;\n } else if (params) {\n name += ' ';\n }\n\n if (node.nodes) {\n this.block(node, name + params);\n } else {\n const end = (node.raws.between || '') + (semicolon ? ';' : '');\n this.builder(name + params + end, node);\n }\n }\n\n body(node) {\n let last = node.nodes.length - 1;\n while (last > 0) {\n if (node.nodes[last].type !== 'comment') break;\n last -= 1;\n }\n\n const semicolon = this.raw(node, 'semicolon');\n for (let i = 0; i < node.nodes.length; i++) {\n const child = node.nodes[i];\n const before = this.raw(child, 'before');\n if (before) this.builder(before);\n this.stringify(child, last !== i || semicolon);\n }\n }\n\n block(node, start) {\n const between = this.raw(node, 'between', 'beforeOpen');\n this.builder(`${start + between}{`, node, 'start');\n\n let after;\n if (node.nodes && node.nodes.length) {\n this.body(node);\n after = this.raw(node, 'after');\n } else {\n after = this.raw(node, 'after', 'emptyBody');\n }\n\n if (after) this.builder(after);\n this.builder('}', node, 'end');\n }\n\n raw(node, own, detect) {\n let value;\n if (!detect) detect = own;\n\n // Already had\n if (own) {\n value = node.raws[own];\n if (typeof value !== 'undefined') return value;\n }\n\n const parent = node.parent;\n\n // Hack for first rule in CSS\n if (detect === 'before') {\n if (!parent || (parent.type === 'root' && parent.first === node)) {\n return '';\n }\n }\n\n // Floating child without parent\n if (!parent) return defaultRaw[detect];\n\n // Detect style by other nodes\n const root = node.root();\n if (!root.rawCache) root.rawCache = {};\n if (typeof root.rawCache[detect] !== 'undefined') {\n return root.rawCache[detect];\n }\n\n if (detect === 'before' || detect === 'after') {\n return this.beforeAfter(node, detect);\n } else {\n const method = `raw${capitalize(detect)}`;\n if (this[method]) {\n value = this[method](root, node);\n } else {\n root.walk(i => {\n value = i.raws[own];\n if (typeof value !== 'undefined') return false;\n });\n }\n }\n\n if (typeof value === 'undefined') value = defaultRaw[detect];\n\n root.rawCache[detect] = value;\n return value;\n }\n\n rawSemicolon(root) {\n let value;\n root.walk(i => {\n if (i.nodes && i.nodes.length && i.last.type === 'decl') {\n value = i.raws.semicolon;\n if (typeof value !== 'undefined') return false;\n }\n });\n return value;\n }\n\n rawEmptyBody(root) {\n let value;\n root.walk(i => {\n if (i.nodes && i.nodes.length === 0) {\n value = i.raws.after;\n if (typeof value !== 'undefined') return false;\n }\n });\n return value;\n }\n\n rawIndent(root) {\n if (root.raws.indent) return root.raws.indent;\n let value;\n root.walk(i => {\n const p = i.parent;\n if (p && p !== root && p.parent && p.parent === root) {\n if (typeof i.raws.before !== 'undefined') {\n const parts = i.raws.before.split('\\n');\n value = parts[parts.length - 1];\n value = value.replace(/[^\\s]/g, '');\n return false;\n }\n }\n });\n return value;\n }\n\n rawBeforeComment(root, node) {\n let value;\n root.walkComments(i => {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before;\n if (value.indexOf('\\n') !== -1) {\n value = value.replace(/[^\\n]+$/, '');\n }\n return false;\n }\n });\n if (typeof value === 'undefined') {\n value = this.raw(node, null, 'beforeDecl');\n }\n return value;\n }\n\n rawBeforeDecl(root, node) {\n let value;\n root.walkDecls(i => {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before;\n if (value.indexOf('\\n') !== -1) {\n value = value.replace(/[^\\n]+$/, '');\n }\n return false;\n }\n });\n if (typeof value === 'undefined') {\n value = this.raw(node, null, 'beforeRule');\n }\n return value;\n }\n\n rawBeforeRule(root) {\n let value;\n root.walk(i => {\n if (i.nodes && (i.parent !== root || root.first !== i)) {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before;\n if (value.indexOf('\\n') !== -1) {\n value = value.replace(/[^\\n]+$/, '');\n }\n return false;\n }\n }\n });\n return value;\n }\n\n rawBeforeClose(root) {\n let value;\n root.walk(i => {\n if (i.nodes && i.nodes.length > 0) {\n if (typeof i.raws.after !== 'undefined') {\n value = i.raws.after;\n if (value.indexOf('\\n') !== -1) {\n value = value.replace(/[^\\n]+$/, '');\n }\n return false;\n }\n }\n });\n return value;\n }\n\n rawBeforeOpen(root) {\n let value;\n root.walk(i => {\n if (i.type !== 'decl') {\n value = i.raws.between;\n if (typeof value !== 'undefined') return false;\n }\n });\n return value;\n }\n\n rawColon(root) {\n let value;\n root.walkDecls(i => {\n if (typeof i.raws.between !== 'undefined') {\n value = i.raws.between.replace(/[^\\s:]/g, '');\n return false;\n }\n });\n return value;\n }\n\n beforeAfter(node, detect) {\n let value;\n if (node.type === 'decl') {\n value = this.raw(node, null, 'beforeDecl');\n } else if (node.type === 'comment') {\n value = this.raw(node, null, 'beforeComment');\n } else if (detect === 'before') {\n value = this.raw(node, null, 'beforeRule');\n } else {\n value = this.raw(node, null, 'beforeClose');\n }\n\n let buf = node.parent;\n let depth = 0;\n while (buf && buf.type !== 'root') {\n depth += 1;\n buf = buf.parent;\n }\n\n if (value.indexOf('\\n') !== -1) {\n const indent = this.raw(node, null, 'indent');\n if (indent.length) {\n for (let step = 0; step < depth; step++) value += indent;\n }\n }\n\n return value;\n }\n\n rawValue(node, prop) {\n const value = node[prop];\n const raw = node.raws[prop];\n if (raw && raw.value === value) {\n return raw.raw;\n } else {\n return value;\n }\n }\n}\n\nexport default Stringifier;\n","// @flow\nimport Stringifier from './stringifier';\n\nexport default function stringify(node, builder) {\n const str = new Stringifier(builder);\n str.stringify(node);\n}\n","// @flow\nimport CssSyntaxError from './css-syntax-error';\nimport Stringifier from './stringifier';\nimport stringify from './stringify';\nimport warnOnce from './warn-once';\n\n/**\n * @typedef {object} position\n * @property {number} line - source line in file\n * @property {number} column - source column in file\n */\n\n/**\n * @typedef {object} source\n * @property {Input} input - {@link Input} with input file\n * @property {position} start - The starting position of the node’s source\n * @property {position} end - The ending position of the node’s source\n */\n\nconst cloneNode = function(obj, parent) {\n const cloned = new obj.constructor();\n\n for (const i in obj) {\n if (!obj.hasOwnProperty(i)) continue;\n let value = obj[i];\n const type = typeof value;\n\n if (i === 'parent' && type === 'object') {\n if (parent) cloned[i] = parent;\n } else if (i === 'source') {\n cloned[i] = value;\n } else if (value instanceof Array) {\n cloned[i] = value.map(j => cloneNode(j, cloned));\n } else if (i !== 'before' && i !== 'after' && i !== 'between' && i !== 'semicolon') {\n if (type === 'object' && value !== null) value = cloneNode(value);\n cloned[i] = value;\n }\n }\n\n return cloned;\n};\n\n/**\n * All node classes inherit the following common methods.\n *\n * @abstract\n */\nclass Node {\n /**\n * @param {object} [defaults] - value for node properties\n */\n constructor(defaults = {}) {\n this.raws = {};\n for (const name in defaults) {\n this[name] = defaults[name];\n }\n }\n\n /**\n * Returns a CssSyntaxError instance containing the original position\n * of the node in the source, showing line and column numbers and also\n * a small excerpt to facilitate debugging.\n *\n * If present, an input source map will be used to get the original position\n * of the source, even from a previous compilation step\n * (e.g., from Sass compilation).\n *\n * This method produces very useful error messages.\n *\n * @param {string} message - error description\n * @param {object} [opts] - options\n * @param {string} opts.plugin - plugin name that created this error.\n * PostCSS will set it automatically.\n * @param {string} opts.word - a word inside a node’s string that should\n * be highlighted as the source of the error\n * @param {number} opts.index - an index inside a node’s string that should\n * be highlighted as the source of the error\n *\n * @return {CssSyntaxError} error object to throw it\n *\n * @example\n * if ( !variables[name] ) {\n * throw decl.error('Unknown variable ' + name, { word: name });\n * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black\n * // color: $black\n * // a\n * // ^\n * // background: white\n * }\n */\n error(message, opts = {}) {\n if (this.source) {\n const pos = this.positionBy(opts);\n return this.source.input.error(message, pos.line, pos.column, opts);\n } else {\n return new CssSyntaxError(message);\n }\n }\n\n /**\n * This method is provided as a convenience wrapper for {@link Result#warn}.\n *\n * @param {Result} result - the {@link Result} instance\n * that will receive the warning\n * @param {string} text - warning message\n * @param {object} [opts] - options\n * @param {string} opts.plugin - plugin name that created this warning.\n * PostCSS will set it automatically.\n * @param {string} opts.word - a word inside a node’s string that should\n * be highlighted as the source of the warning\n * @param {number} opts.index - an index inside a node’s string that should\n * be highlighted as the source of the warning\n *\n * @return {Warning} created warning object\n *\n * @example\n * const plugin = postcss.plugin('postcss-deprecated', () => {\n * return (root, result) => {\n * root.walkDecls('bad', decl => {\n * decl.warn(result, 'Deprecated property bad');\n * });\n * };\n * });\n */\n warn(result, text, opts) {\n const data = { node: this };\n for (const i in opts) data[i] = opts[i];\n return result.warn(text, data);\n }\n\n /**\n * Removes the node from its parent and cleans the parent properties\n * from the node and its children.\n *\n * @example\n * if ( decl.prop.match(/^-webkit-/) ) {\n * decl.remove();\n * }\n *\n * @return {Node} node to make calls chain\n */\n remove() {\n if (this.parent) {\n this.parent.removeChild(this);\n }\n this.parent = undefined;\n return this;\n }\n\n /**\n * Returns a CSS string representing the node.\n *\n * @param {stringifier|syntax} [stringifier] - a syntax to use\n * in string generation\n *\n * @return {string} CSS string of this node\n *\n * @example\n * postcss.rule({ selector: 'a' }).toString() //=> \"a {}\"\n */\n toString(stringifier = stringify) {\n if (stringifier.stringify) stringifier = stringifier.stringify;\n let result = '';\n stringifier(this, i => {\n result += i;\n });\n return result;\n }\n\n /**\n * Returns a clone of the node.\n *\n * The resulting cloned node and its (cloned) children will have\n * a clean parent and code style properties.\n *\n * @param {object} [overrides] - new properties to override in the clone.\n *\n * @example\n * const cloned = decl.clone({ prop: '-moz-' + decl.prop });\n * cloned.raws.before //=> undefined\n * cloned.parent //=> undefined\n * cloned.toString() //=> -moz-transform: scale(0)\n *\n * @return {Node} clone of the node\n */\n clone(overrides = {}) {\n const cloned = cloneNode(this);\n for (const name in overrides) {\n cloned[name] = overrides[name];\n }\n return cloned;\n }\n\n /**\n * Shortcut to clone the node and insert the resulting cloned node\n * before the current node.\n *\n * @param {object} [overrides] - new properties to override in the clone.\n *\n * @example\n * decl.cloneBefore({ prop: '-moz-' + decl.prop });\n *\n * @return {Node} - new node\n */\n cloneBefore(overrides = {}) {\n const cloned = this.clone(overrides);\n this.parent.insertBefore(this, cloned);\n return cloned;\n }\n\n /**\n * Shortcut to clone the node and insert the resulting cloned node\n * after the current node.\n *\n * @param {object} [overrides] - new properties to override in the clone.\n *\n * @return {Node} - new node\n */\n cloneAfter(overrides = {}) {\n const cloned = this.clone(overrides);\n this.parent.insertAfter(this, cloned);\n return cloned;\n }\n\n /**\n * Inserts node(s) before the current node and removes the current node.\n *\n * @param {...Node} nodes - node(s) to replace current one\n *\n * @example\n * if ( atrule.name == 'mixin' ) {\n * atrule.replaceWith(mixinRules[atrule.params]);\n * }\n *\n * @return {Node} current node to methods chain\n */\n replaceWith(...nodes) {\n if (this.parent) {\n nodes.forEach(node => {\n this.parent.insertBefore(this, node);\n });\n\n this.remove();\n }\n\n return this;\n }\n\n /**\n * Removes the node from its current parent and inserts it\n * at the end of `newParent`.\n *\n * This will clean the `before` and `after` code {@link Node#raws} data\n * from the node and replace them with the indentation style of `newParent`.\n * It will also clean the `between` property\n * if `newParent` is in another {@link Root}.\n *\n * @param {Container} newParent - container node where the current node\n * will be moved\n *\n * @example\n * atrule.moveTo(atrule.root());\n *\n * @return {Node} current node to methods chain\n */\n moveTo(newParent) {\n this.cleanRaws(this.root() === newParent.root());\n this.remove();\n newParent.append(this);\n return this;\n }\n\n /**\n * Removes the node from its current parent and inserts it into\n * a new parent before `otherNode`.\n *\n * This will also clean the node’s code style properties just as it would\n * in {@link Node#moveTo}.\n *\n * @param {Node} otherNode - node that will be before current node\n *\n * @return {Node} current node to methods chain\n */\n moveBefore(otherNode) {\n this.cleanRaws(this.root() === otherNode.root());\n this.remove();\n otherNode.parent.insertBefore(otherNode, this);\n return this;\n }\n\n /**\n * Removes the node from its current parent and inserts it into\n * a new parent after `otherNode`.\n *\n * This will also clean the node’s code style properties just as it would\n * in {@link Node#moveTo}.\n *\n * @param {Node} otherNode - node that will be after current node\n *\n * @return {Node} current node to methods chain\n */\n moveAfter(otherNode) {\n this.cleanRaws(this.root() === otherNode.root());\n this.remove();\n otherNode.parent.insertAfter(otherNode, this);\n return this;\n }\n\n /**\n * Returns the next child of the node’s parent.\n * Returns `undefined` if the current node is the last child.\n *\n * @return {Node|undefined} next node\n *\n * @example\n * if ( comment.text === 'delete next' ) {\n * const next = comment.next();\n * if ( next ) {\n * next.remove();\n * }\n * }\n */\n next() {\n const index = this.parent.index(this);\n return this.parent.nodes[index + 1];\n }\n\n /**\n * Returns the previous child of the node’s parent.\n * Returns `undefined` if the current node is the first child.\n *\n * @return {Node|undefined} previous node\n *\n * @example\n * const annotation = decl.prev();\n * if ( annotation.type == 'comment' ) {\n * readAnnotation(annotation.text);\n * }\n */\n prev() {\n const index = this.parent.index(this);\n return this.parent.nodes[index - 1];\n }\n\n toJSON() {\n const fixed = {};\n\n for (const name in this) {\n if (!this.hasOwnProperty(name)) continue;\n if (name === 'parent') continue;\n const value = this[name];\n\n if (value instanceof Array) {\n fixed[name] = value.map(i => {\n if (typeof i === 'object' && i.toJSON) {\n return i.toJSON();\n } else {\n return i;\n }\n });\n } else if (typeof value === 'object' && value.toJSON) {\n fixed[name] = value.toJSON();\n } else {\n fixed[name] = value;\n }\n }\n\n return fixed;\n }\n\n /**\n * Returns a {@link Node#raws} value. If the node is missing\n * the code style property (because the node was manually built or cloned),\n * PostCSS will try to autodetect the code style property by looking\n * at other nodes in the tree.\n *\n * @param {string} prop - name of code style property\n * @param {string} [defaultType] - name of default value, it can be missed\n * if the value is the same as prop\n *\n * @example\n * const root = postcss.parse('a { background: white }');\n * root.nodes[0].append({ prop: 'color', value: 'black' });\n * root.nodes[0].nodes[1].raws.before //=> undefined\n * root.nodes[0].nodes[1].raw('before') //=> ' '\n *\n * @return {string} code style value\n */\n raw(prop, defaultType) {\n const str = new Stringifier();\n return str.raw(this, prop, defaultType);\n }\n\n /**\n * Finds the Root instance of the node’s tree.\n *\n * @example\n * root.nodes[0].nodes[0].root() === root\n *\n * @return {Root} root parent\n */\n root() {\n let result = this;\n while (result.parent) result = result.parent;\n return result;\n }\n\n cleanRaws(keepBetween) {\n delete this.raws.before;\n delete this.raws.after;\n if (!keepBetween) delete this.raws.between;\n }\n\n positionInside(index) {\n const string = this.toString();\n let column = this.source.start.column;\n let line = this.source.start.line;\n\n for (let i = 0; i < index; i++) {\n if (string[i] === '\\n') {\n column = 1;\n line += 1;\n } else {\n column += 1;\n }\n }\n\n return { line, column };\n }\n\n positionBy(opts) {\n let pos = this.source.start;\n if (opts.index) {\n pos = this.positionInside(opts.index);\n } else if (opts.word) {\n const index = this.toString().indexOf(opts.word);\n if (index !== -1) pos = this.positionInside(index);\n }\n return pos;\n }\n\n removeSelf() {\n warnOnce('Node#removeSelf is deprecated. Use Node#remove.');\n return this.remove();\n }\n\n replace(nodes) {\n warnOnce('Node#replace is deprecated. Use Node#replaceWith');\n return this.replaceWith(nodes);\n }\n\n style(own, detect) {\n warnOnce('Node#style() is deprecated. Use Node#raw()');\n return this.raw(own, detect);\n }\n\n cleanStyles(keepBetween) {\n warnOnce('Node#cleanStyles() is deprecated. Use Node#cleanRaws()');\n return this.cleanRaws(keepBetween);\n }\n\n get before() {\n warnOnce('Node#before is deprecated. Use Node#raws.before');\n return this.raws.before;\n }\n\n set before(val) {\n warnOnce('Node#before is deprecated. Use Node#raws.before');\n this.raws.before = val;\n }\n\n get between() {\n warnOnce('Node#between is deprecated. Use Node#raws.between');\n return this.raws.between;\n }\n\n set between(val) {\n warnOnce('Node#between is deprecated. Use Node#raws.between');\n this.raws.between = val;\n }\n\n /**\n * @memberof Node#\n * @member {string} type - String representing the node’s type.\n * Possible values are `root`, `atrule`, `rule`,\n * `decl`, or `comment`.\n *\n * @example\n * postcss.decl({ prop: 'color', value: 'black' }).type //=> 'decl'\n */\n\n /**\n * @memberof Node#\n * @member {Container} parent - the node’s parent node.\n *\n * @example\n * root.nodes[0].parent == root;\n */\n\n /**\n * @memberof Node#\n * @member {source} source - the input source of the node\n *\n * The property is used in source map generation.\n *\n * If you create a node manually (e.g., with `postcss.decl()`),\n * that node will not have a `source` property and will be absent\n * from the source map. For this reason, the plugin developer should\n * consider cloning nodes to create new ones (in which case the new node’s\n * source will reference the original, cloned node) or setting\n * the `source` property manually.\n *\n * ```js\n * // Bad\n * const prefixed = postcss.decl({\n * prop: '-moz-' + decl.prop,\n * value: decl.value\n * });\n *\n * // Good\n * const prefixed = decl.clone({ prop: '-moz-' + decl.prop });\n * ```\n *\n * ```js\n * if ( atrule.name == 'add-link' ) {\n * const rule = postcss.rule({ selector: 'a', source: atrule.source });\n * atrule.parent.insertBefore(atrule, rule);\n * }\n * ```\n *\n * @example\n * decl.source.input.from //=> '/home/ai/a.sass'\n * decl.source.start //=> { line: 10, column: 2 }\n * decl.source.end //=> { line: 10, column: 12 }\n */\n\n /**\n * @memberof Node#\n * @member {object} raws - Information to generate byte-to-byte equal\n * node string as it was in the origin input.\n *\n * Every parser saves its own properties,\n * but the default CSS parser uses:\n *\n * * `before`: the space symbols before the node. It also stores `*`\n * and `_` symbols before the declaration (IE hack).\n * * `after`: the space symbols after the last child of the node\n * to the end of the node.\n * * `between`: the symbols between the property and value\n * for declarations, selector and `{` for rules, or last parameter\n * and `{` for at-rules.\n * * `semicolon`: contains true if the last child has\n * an (optional) semicolon.\n * * `afterName`: the space between the at-rule name and its parameters.\n * * `left`: the space symbols between `/*` and the comment’s text.\n * * `right`: the space symbols between the comment’s text\n * and */.\n * * `important`: the content of the important statement,\n * if it is not just `!important`.\n *\n * PostCSS cleans selectors, declaration values and at-rule parameters\n * from comments and extra spaces, but it stores origin content in raws\n * properties. As such, if you don’t change a declaration’s value,\n * PostCSS will use the raw value with comments.\n *\n * @example\n * const root = postcss.parse('a {\\n color:black\\n}')\n * root.first.first.raws //=> { before: '\\n ', between: ':' }\n */\n}\n\nexport default Node;\n","// @flow\nimport warnOnce from './warn-once';\nimport Node from './node';\n\n/**\n * Represents a CSS declaration.\n *\n * @extends Node\n *\n * @example\n * const root = postcss.parse('a { color: black }');\n * const decl = root.first.first;\n * decl.type //=> 'decl'\n * decl.toString() //=> ' color: black'\n */\nclass Declaration extends Node {\n constructor(defaults) {\n super(defaults);\n this.type = 'decl';\n }\n\n get _value() {\n warnOnce('Node#_value was deprecated. Use Node#raws.value');\n return this.raws.value;\n }\n\n set _value(val) {\n warnOnce('Node#_value was deprecated. Use Node#raws.value');\n this.raws.value = val;\n }\n\n get _important() {\n warnOnce('Node#_important was deprecated. Use Node#raws.important');\n return this.raws.important;\n }\n\n set _important(val) {\n warnOnce('Node#_important was deprecated. Use Node#raws.important');\n this.raws.important = val;\n }\n\n /**\n * @memberof Declaration#\n * @member {string} prop - the declaration’s property name\n *\n * @example\n * const root = postcss.parse('a { color: black }');\n * const decl = root.first.first;\n * decl.prop //=> 'color'\n */\n\n /**\n * @memberof Declaration#\n * @member {string} value - the declaration’s value\n *\n * @example\n * const root = postcss.parse('a { color: black }');\n * const decl = root.first.first;\n * decl.value //=> 'black'\n */\n\n /**\n * @memberof Declaration#\n * @member {boolean} important - `true` if the declaration\n * has an !important annotation.\n *\n * @example\n * const root = postcss.parse('a { color: black !important; color: red }');\n * root.first.first.important //=> true\n * root.first.last.important //=> undefined\n */\n\n /**\n * @memberof Declaration#\n * @member {object} raws - Information to generate byte-to-byte equal\n * node string as it was in the origin input.\n *\n * Every parser saves its own properties,\n * but the default CSS parser uses:\n *\n * * `before`: the space symbols before the node. It also stores `*`\n * and `_` symbols before the declaration (IE hack).\n * * `between`: the symbols between the property and value\n * for declarations, selector and `{` for rules, or last parameter\n * and `{` for at-rules.\n * * `important`: the content of the important statement,\n * if it is not just `!important`.\n *\n * PostCSS cleans declaration from comments and extra spaces,\n * but it stores origin content in raws properties.\n * As such, if you don’t change a declaration’s value,\n * PostCSS will use the raw value with comments.\n *\n * @example\n * const root = postcss.parse('a {\\n color:black\\n}')\n * root.first.first.raws //=> { before: '\\n ', between: ':' }\n */\n}\n\nexport default Declaration;\n","// @flow\nimport warnOnce from './warn-once';\nimport Node from './node';\n\n/**\n * Represents a comment between declarations or statements (rule and at-rules).\n *\n * Comments inside selectors, at-rule parameters, or declaration values\n * will be stored in the `raws` properties explained above.\n *\n * @extends Node\n */\nclass Comment extends Node {\n constructor(defaults) {\n super(defaults);\n this.type = 'comment';\n }\n\n get left() {\n warnOnce('Comment#left was deprecated. Use Comment#raws.left');\n return this.raws.left;\n }\n\n set left(val) {\n warnOnce('Comment#left was deprecated. Use Comment#raws.left');\n this.raws.left = val;\n }\n\n get right() {\n warnOnce('Comment#right was deprecated. Use Comment#raws.right');\n return this.raws.right;\n }\n\n set right(val) {\n warnOnce('Comment#right was deprecated. Use Comment#raws.right');\n this.raws.right = val;\n }\n\n /**\n * @memberof Comment#\n * @member {string} text - the comment’s text\n */\n\n /**\n * @memberof Comment#\n * @member {object} raws - Information to generate byte-to-byte equal\n * node string as it was in the origin input.\n *\n * Every parser saves its own properties,\n * but the default CSS parser uses:\n *\n * * `before`: the space symbols before the node.\n * * `left`: the space symbols between `/*` and the comment’s text.\n * * `right`: the space symbols between the comment’s text.\n */\n}\n\nexport default Comment;\n","// @flow\nimport Declaration from './declaration';\nimport tokenizer from './tokenize';\nimport Comment from './comment';\nimport AtRule from './at-rule';\nimport Root from './root';\nimport Rule from './rule';\n\nexport default class Parser {\n constructor(input) {\n this.input = input;\n\n this.pos = 0;\n this.root = new Root();\n this.current = this.root;\n this.spaces = '';\n this.semicolon = false;\n\n this.root.source = { input, start: { line: 1, column: 1 } };\n }\n\n tokenize() {\n this.tokens = tokenizer(this.input);\n }\n\n loop() {\n let token;\n while (this.pos < this.tokens.length) {\n token = this.tokens[this.pos];\n\n switch (token[0]) {\n case 'space':\n case ';':\n this.spaces += token[1];\n break;\n\n case '}':\n this.end(token);\n break;\n\n case 'comment':\n this.comment(token);\n break;\n\n case 'at-word':\n this.atrule(token);\n break;\n\n case '{':\n this.emptyRule(token);\n break;\n\n default:\n this.other();\n break;\n }\n\n this.pos += 1;\n }\n this.endFile();\n }\n\n comment(token) {\n const node = new Comment();\n this.init(node, token[2], token[3]);\n node.source.end = { line: token[4], column: token[5] };\n\n const text = token[1].slice(2, -2);\n if (/^\\s*$/.test(text)) {\n node.text = '';\n node.raws.left = text;\n node.raws.right = '';\n } else {\n const match = text.match(/^(\\s*)([^]*[^\\s])(\\s*)$/);\n node.text = match[2];\n node.raws.left = match[1];\n node.raws.right = match[3];\n }\n }\n\n emptyRule(token) {\n const node = new Rule();\n this.init(node, token[2], token[3]);\n node.selector = '';\n node.raws.between = '';\n this.current = node;\n }\n\n other() {\n let token;\n let end = false;\n let type = null;\n let colon = false;\n let bracket = null;\n const brackets = [];\n\n const start = this.pos;\n while (this.pos < this.tokens.length) {\n token = this.tokens[this.pos];\n type = token[0];\n\n if (type === '(' || type === '[') {\n if (!bracket) bracket = token;\n brackets.push(type === '(' ? ')' : ']');\n } else if (brackets.length === 0) {\n if (type === ';') {\n if (colon) {\n this.decl(this.tokens.slice(start, this.pos + 1));\n return;\n } else {\n break;\n }\n } else if (type === '{') {\n this.rule(this.tokens.slice(start, this.pos + 1));\n return;\n } else if (type === '}') {\n this.pos -= 1;\n end = true;\n break;\n } else if (type === ':') {\n colon = true;\n }\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop();\n if (brackets.length === 0) bracket = null;\n }\n\n this.pos += 1;\n }\n if (this.pos === this.tokens.length) {\n this.pos -= 1;\n end = true;\n }\n\n if (brackets.length > 0) this.unclosedBracket(bracket);\n\n if (end && colon) {\n while (this.pos > start) {\n token = this.tokens[this.pos][0];\n if (token !== 'space' && token !== 'comment') break;\n this.pos -= 1;\n }\n this.decl(this.tokens.slice(start, this.pos + 1));\n return;\n }\n\n this.unknownWord(start);\n }\n\n rule(tokens) {\n tokens.pop();\n\n const node = new Rule();\n this.init(node, tokens[0][2], tokens[0][3]);\n\n node.raws.between = this.spacesFromEnd(tokens);\n this.raw(node, 'selector', tokens);\n this.current = node;\n }\n\n decl(tokens) {\n const node = new Declaration();\n this.init(node);\n\n const last = tokens[tokens.length - 1];\n if (last[0] === ';') {\n this.semicolon = true;\n tokens.pop();\n }\n if (last[4]) {\n node.source.end = { line: last[4], column: last[5] };\n } else {\n node.source.end = { line: last[2], column: last[3] };\n }\n\n while (tokens[0][0] !== 'word') {\n node.raws.before += tokens.shift()[1];\n }\n node.source.start = { line: tokens[0][2], column: tokens[0][3] };\n\n node.prop = '';\n while (tokens.length) {\n const type = tokens[0][0];\n if (type === ':' || type === 'space' || type === 'comment') {\n break;\n }\n node.prop += tokens.shift()[1];\n }\n\n node.raws.between = '';\n\n let token;\n while (tokens.length) {\n token = tokens.shift();\n\n if (token[0] === ':') {\n node.raws.between += token[1];\n break;\n } else {\n node.raws.between += token[1];\n }\n }\n\n if (node.prop[0] === '_' || node.prop[0] === '*') {\n node.raws.before += node.prop[0];\n node.prop = node.prop.slice(1);\n }\n node.raws.between += this.spacesFromStart(tokens);\n this.precheckMissedSemicolon(tokens);\n\n for (let i = tokens.length - 1; i > 0; i--) {\n token = tokens[i];\n if (token[1] === '!important') {\n node.important = true;\n let string = this.stringFrom(tokens, i);\n string = this.spacesFromEnd(tokens) + string;\n if (string !== ' !important') node.raws.important = string;\n break;\n } else if (token[1] === 'important') {\n const cache = tokens.slice(0);\n let str = '';\n for (let j = i; j > 0; j--) {\n const type = cache[j][0];\n if (str.trim().indexOf('!') === 0 && type !== 'space') {\n break;\n }\n str = cache.pop()[1] + str;\n }\n if (str.trim().indexOf('!') === 0) {\n node.important = true;\n node.raws.important = str;\n tokens = cache;\n }\n }\n\n if (token[0] !== 'space' && token[0] !== 'comment') {\n break;\n }\n }\n\n this.raw(node, 'value', tokens);\n\n if (node.value.indexOf(':') !== -1) this.checkMissedSemicolon(tokens);\n }\n\n atrule(token) {\n const node = new AtRule();\n node.name = token[1].slice(1);\n if (node.name === '') {\n this.unnamedAtrule(node, token);\n }\n this.init(node, token[2], token[3]);\n\n let last = false;\n let open = false;\n const params = [];\n\n this.pos += 1;\n while (this.pos < this.tokens.length) {\n token = this.tokens[this.pos];\n\n if (token[0] === ';') {\n node.source.end = { line: token[2], column: token[3] };\n this.semicolon = true;\n break;\n } else if (token[0] === '{') {\n open = true;\n break;\n } else if (token[0] === '}') {\n this.end(token);\n break;\n } else {\n params.push(token);\n }\n\n this.pos += 1;\n }\n if (this.pos === this.tokens.length) {\n last = true;\n }\n\n node.raws.between = this.spacesFromEnd(params);\n if (params.length) {\n node.raws.afterName = this.spacesFromStart(params);\n this.raw(node, 'params', params);\n if (last) {\n token = params[params.length - 1];\n node.source.end = { line: token[4], column: token[5] };\n this.spaces = node.raws.between;\n node.raws.between = '';\n }\n } else {\n node.raws.afterName = '';\n node.params = '';\n }\n\n if (open) {\n node.nodes = [];\n this.current = node;\n }\n }\n\n end(token) {\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.semicolon = false;\n\n this.current.raws.after = (this.current.raws.after || '') + this.spaces;\n this.spaces = '';\n\n if (this.current.parent) {\n this.current.source.end = { line: token[2], column: token[3] };\n this.current = this.current.parent;\n } else {\n this.unexpectedClose(token);\n }\n }\n\n endFile() {\n if (this.current.parent) this.unclosedBlock();\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.current.raws.after = (this.current.raws.after || '') + this.spaces;\n }\n\n // Helpers\n\n init(node, line, column) {\n this.current.push(node);\n\n node.source = { start: { line, column }, input: this.input };\n node.raws.before = this.spaces;\n this.spaces = '';\n if (node.type !== 'comment') this.semicolon = false;\n }\n\n raw(node, prop, tokens) {\n let token, type;\n const length = tokens.length;\n let value = '';\n let clean = true;\n for (let i = 0; i < length; i += 1) {\n token = tokens[i];\n type = token[0];\n if (type === 'comment' || (type === 'space' && i === length - 1)) {\n clean = false;\n } else {\n value += token[1];\n }\n }\n if (!clean) {\n const raw = tokens.reduce((all, i) => all + i[1], '');\n node.raws[prop] = { value, raw };\n }\n node[prop] = value;\n }\n\n spacesFromEnd(tokens) {\n let lastTokenType;\n let spaces = '';\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0];\n if (lastTokenType !== 'space' && lastTokenType !== 'comment') break;\n spaces = tokens.pop()[1] + spaces;\n }\n return spaces;\n }\n\n spacesFromStart(tokens) {\n let next;\n let spaces = '';\n while (tokens.length) {\n next = tokens[0][0];\n if (next !== 'space' && next !== 'comment') break;\n spaces += tokens.shift()[1];\n }\n return spaces;\n }\n\n stringFrom(tokens, from) {\n let result = '';\n for (let i = from; i < tokens.length; i++) {\n result += tokens[i][1];\n }\n tokens.splice(from, tokens.length - from);\n return result;\n }\n\n colon(tokens) {\n let brackets = 0;\n let token, type, prev;\n for (let i = 0; i < tokens.length; i++) {\n token = tokens[i];\n type = token[0];\n\n if (type === '(') {\n brackets += 1;\n } else if (type === ')') {\n brackets -= 1;\n } else if (brackets === 0 && type === ':') {\n if (!prev) {\n this.doubleColon(token);\n } else if (prev[0] === 'word' && prev[1] === 'progid') {\n continue;\n } else {\n return i;\n }\n }\n\n prev = token;\n }\n return false;\n }\n\n // Errors\n\n unclosedBracket(bracket) {\n throw this.input.error('Unclosed bracket', bracket[2], bracket[3]);\n }\n\n unknownWord(start) {\n const token = this.tokens[start];\n throw this.input.error('Unknown word', token[2], token[3]);\n }\n\n unexpectedClose(token) {\n throw this.input.error('Unexpected }', token[2], token[3]);\n }\n\n unclosedBlock() {\n const pos = this.current.source.start;\n throw this.input.error('Unclosed block', pos.line, pos.column);\n }\n\n doubleColon(token) {\n throw this.input.error('Double colon', token[2], token[3]);\n }\n\n unnamedAtrule(node, token) {\n throw this.input.error('At-rule without name', token[2], token[3]);\n }\n\n precheckMissedSemicolon(tokens) {\n // Hook for Safe Parser\n tokens;\n }\n\n checkMissedSemicolon(tokens) {\n const colon = this.colon(tokens);\n if (colon === false) return;\n\n let founded = 0;\n let token;\n for (let j = colon - 1; j >= 0; j--) {\n token = tokens[j];\n if (token[0] !== 'space') {\n founded += 1;\n if (founded === 2) break;\n }\n }\n throw this.input.error('Missed semicolon', token[2], token[3]);\n }\n}\n","// @flow\nimport Parser from './parser';\nimport Input from './input';\n\nexport default function parse(css, opts) {\n if (opts && opts.safe) {\n throw new Error('Option safe was removed. ' + 'Use parser: require(\"postcss-safe-parser\")');\n }\n\n const input = new Input(css, opts);\n\n const parser = new Parser(input);\n try {\n parser.tokenize();\n parser.loop();\n } catch (e) {\n if (e.name === 'CssSyntaxError' && opts && opts.from) {\n if (/\\.scss$/i.test(opts.from)) {\n e.message +=\n '\\nYou tried to parse SCSS with ' +\n 'the standard CSS parser; ' +\n 'try again with the postcss-scss parser';\n } else if (/\\.less$/i.test(opts.from)) {\n e.message +=\n '\\nYou tried to parse Less with ' +\n 'the standard CSS parser; ' +\n 'try again with the postcss-less parser';\n }\n }\n throw e;\n }\n\n return parser.root;\n}\n","// @flow\nimport parse from './parse';\nimport Root from './root';\nimport Rule from './rule';\nimport AtRule from './at-rule';\nimport Declaration from './declaration';\nimport warnOnce from './warn-once';\nimport Comment from './comment';\nimport Node from './node';\n\nfunction cleanSource(nodes) {\n return nodes.map(i => {\n if (i.nodes) i.nodes = cleanSource(i.nodes);\n delete i.source;\n return i;\n });\n}\n\n/**\n * @callback childCondition\n * @param {Node} node - container child\n * @param {number} index - child index\n * @param {Node[]} nodes - all container children\n * @return {boolean}\n */\n\n/**\n * @callback childIterator\n * @param {Node} node - container child\n * @param {number} index - child index\n * @return {false|undefined} returning `false` will break iteration\n */\n\n/**\n * The {@link Root}, {@link AtRule}, and {@link Rule} container nodes\n * inherit some common methods to help work with their children.\n *\n * Note that all containers can store any content. If you write a rule inside\n * a rule, PostCSS will parse it.\n *\n * @extends Node\n * @abstract\n */\nclass Container extends Node {\n push(child) {\n child.parent = this;\n this.nodes.push(child);\n return this;\n }\n\n /**\n * Iterates through the container’s immediate children,\n * calling `callback` for each child.\n *\n * Returning `false` in the callback will break iteration.\n *\n * This method only iterates through the container’s immediate children.\n * If you need to recursively iterate through all the container’s descendant\n * nodes, use {@link Container#walk}.\n *\n * Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe\n * if you are mutating the array of child nodes during iteration.\n * PostCSS will adjust the current index to match the mutations.\n *\n * @param {childIterator} callback - iterator receives each node and index\n *\n * @return {false|undefined} returns `false` if iteration was broke\n *\n * @example\n * const root = postcss.parse('a { color: black; z-index: 1 }');\n * const rule = root.first;\n *\n * for ( let decl of rule.nodes ) {\n * decl.cloneBefore({ prop: '-webkit-' + decl.prop });\n * // Cycle will be infinite, because cloneBefore moves the current node\n * // to the next index\n * }\n *\n * rule.each(decl => {\n * decl.cloneBefore({ prop: '-webkit-' + decl.prop });\n * // Will be executed only for color and z-index\n * });\n */\n each(callback) {\n if (!this.lastEach) this.lastEach = 0;\n if (!this.indexes) this.indexes = {};\n\n this.lastEach += 1;\n const id = this.lastEach;\n this.indexes[id] = 0;\n\n if (!this.nodes) return undefined;\n\n let index, result;\n while (this.indexes[id] < this.nodes.length) {\n index = this.indexes[id];\n result = callback(this.nodes[index], index);\n if (result === false) break;\n\n this.indexes[id] += 1;\n }\n\n delete this.indexes[id];\n\n return result;\n }\n\n /**\n * Traverses the container’s descendant nodes, calling callback\n * for each node.\n *\n * Like container.each(), this method is safe to use\n * if you are mutating arrays during iteration.\n *\n * If you only need to iterate through the container’s immediate children,\n * use {@link Container#each}.\n *\n * @param {childIterator} callback - iterator receives each node and index\n *\n * @return {false|undefined} returns `false` if iteration was broke\n *\n * @example\n * root.walk(node => {\n * // Traverses all descendant nodes.\n * });\n */\n walk(callback) {\n return this.each((child, i) => {\n let result = callback(child, i);\n if (result !== false && child.walk) {\n result = child.walk(callback);\n }\n return result;\n });\n }\n\n /**\n * Traverses the container’s descendant nodes, calling callback\n * for each declaration node.\n *\n * If you pass a filter, iteration will only happen over declarations\n * with matching properties.\n *\n * Like {@link Container#each}, this method is safe\n * to use if you are mutating arrays during iteration.\n *\n * @param {string|RegExp} [prop] - string or regular expression\n * to filter declarations by property name\n * @param {childIterator} callback - iterator receives each node and index\n *\n * @return {false|undefined} returns `false` if iteration was broke\n *\n * @example\n * root.walkDecls(decl => {\n * checkPropertySupport(decl.prop);\n * });\n *\n * root.walkDecls('border-radius', decl => {\n * decl.remove();\n * });\n *\n * root.walkDecls(/^background/, decl => {\n * decl.value = takeFirstColorFromGradient(decl.value);\n * });\n */\n walkDecls(prop, callback) {\n if (!callback) {\n callback = prop;\n return this.walk((child, i) => {\n if (child.type === 'decl') {\n return callback(child, i);\n }\n });\n } else if (prop instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === 'decl' && prop.test(child.prop)) {\n return callback(child, i);\n }\n });\n } else {\n return this.walk((child, i) => {\n if (child.type === 'decl' && child.prop === prop) {\n return callback(child, i);\n }\n });\n }\n }\n\n /**\n * Traverses the container’s descendant nodes, calling callback\n * for each rule node.\n *\n * If you pass a filter, iteration will only happen over rules\n * with matching selectors.\n *\n * Like {@link Container#each}, this method is safe\n * to use if you are mutating arrays during iteration.\n *\n * @param {string|RegExp} [selector] - string or regular expression\n * to filter rules by selector\n * @param {childIterator} callback - iterator receives each node and index\n *\n * @return {false|undefined} returns `false` if iteration was broke\n *\n * @example\n * const selectors = [];\n * root.walkRules(rule => {\n * selectors.push(rule.selector);\n * });\n * console.log(`Your CSS uses ${selectors.length} selectors`);\n */\n walkRules(selector, callback) {\n if (!callback) {\n callback = selector;\n\n return this.walk((child, i) => {\n if (child.type === 'rule') {\n return callback(child, i);\n }\n });\n } else if (selector instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === 'rule' && selector.test(child.selector)) {\n return callback(child, i);\n }\n });\n } else {\n return this.walk((child, i) => {\n if (child.type === 'rule' && child.selector === selector) {\n return callback(child, i);\n }\n });\n }\n }\n\n /**\n * Traverses the container’s descendant nodes, calling callback\n * for each at-rule node.\n *\n * If you pass a filter, iteration will only happen over at-rules\n * that have matching names.\n *\n * Like {@link Container#each}, this method is safe\n * to use if you are mutating arrays during iteration.\n *\n * @param {string|RegExp} [name] - string or regular expression\n * to filter at-rules by name\n * @param {childIterator} callback - iterator receives each node and index\n *\n * @return {false|undefined} returns `false` if iteration was broke\n *\n * @example\n * root.walkAtRules(rule => {\n * if ( isOld(rule.name) ) rule.remove();\n * });\n *\n * let first = false;\n * root.walkAtRules('charset', rule => {\n * if ( !first ) {\n * first = true;\n * } else {\n * rule.remove();\n * }\n * });\n */\n walkAtRules(name, callback) {\n if (!callback) {\n callback = name;\n return this.walk((child, i) => {\n if (child.type === 'atrule') {\n return callback(child, i);\n }\n });\n } else if (name instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === 'atrule' && name.test(child.name)) {\n return callback(child, i);\n }\n });\n } else {\n return this.walk((child, i) => {\n if (child.type === 'atrule' && child.name === name) {\n return callback(child, i);\n }\n });\n }\n }\n\n /**\n * Traverses the container’s descendant nodes, calling callback\n * for each comment node.\n *\n * Like {@link Container#each}, this method is safe\n * to use if you are mutating arrays during iteration.\n *\n * @param {childIterator} callback - iterator receives each node and index\n *\n * @return {false|undefined} returns `false` if iteration was broke\n *\n * @example\n * root.walkComments(comment => {\n * comment.remove();\n * });\n */\n walkComments(callback) {\n return this.walk((child, i) => {\n if (child.type === 'comment') {\n return callback(child, i);\n }\n });\n }\n\n /**\n * Inserts new nodes to the start of the container.\n *\n * @param {...(Node|object|string|Node[])} children - new nodes\n *\n * @return {Node} this node for methods chain\n *\n * @example\n * const decl1 = postcss.decl({ prop: 'color', value: 'black' });\n * const decl2 = postcss.decl({ prop: 'background-color', value: 'white' });\n * rule.append(decl1, decl2);\n *\n * root.append({ name: 'charset', params: '\"UTF-8\"' }); // at-rule\n * root.append({ selector: 'a' }); // rule\n * rule.append({ prop: 'color', value: 'black' }); // declaration\n * rule.append({ text: 'Comment' }) // comment\n *\n * root.append('a {}');\n * root.first.append('color: black; z-index: 1');\n */\n append(...children) {\n children.forEach(child => {\n const nodes = this.normalize(child, this.last);\n nodes.forEach(node => this.nodes.push(node));\n });\n return this;\n }\n\n /**\n * Inserts new nodes to the end of the container.\n *\n * @param {...(Node|object|string|Node[])} children - new nodes\n *\n * @return {Node} this node for methods chain\n *\n * @example\n * const decl1 = postcss.decl({ prop: 'color', value: 'black' });\n * const decl2 = postcss.decl({ prop: 'background-color', value: 'white' });\n * rule.prepend(decl1, decl2);\n *\n * root.append({ name: 'charset', params: '\"UTF-8\"' }); // at-rule\n * root.append({ selector: 'a' }); // rule\n * rule.append({ prop: 'color', value: 'black' }); // declaration\n * rule.append({ text: 'Comment' }) // comment\n *\n * root.append('a {}');\n * root.first.append('color: black; z-index: 1');\n */\n prepend(...children) {\n children = children.reverse();\n children.forEach(child => {\n const nodes = this.normalize(child, this.first, 'prepend').reverse();\n nodes.forEach(node => this.nodes.unshift(node));\n for (const id in this.indexes) {\n this.indexes[id] = this.indexes[id] + nodes.length;\n }\n });\n return this;\n }\n\n cleanRaws(keepBetween) {\n super.cleanRaws(keepBetween);\n if (this.nodes) {\n this.nodes.forEach(node => node.cleanRaws(keepBetween));\n }\n }\n\n /**\n * Insert new node before old node within the container.\n *\n * @param {Node|number} exist - child or child’s index.\n * @param {Node|object|string|Node[]} add - new node\n *\n * @return {Node} this node for methods chain\n *\n * @example\n * rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }));\n */\n insertBefore(exist, add) {\n exist = this.index(exist);\n\n const type = exist === 0 ? 'prepend' : false;\n const nodes = this.normalize(add, this.nodes[exist], type).reverse();\n nodes.forEach(node => this.nodes.splice(exist, 0, node));\n\n let index;\n for (const id in this.indexes) {\n index = this.indexes[id];\n if (exist <= index) {\n this.indexes[id] = index + nodes.length;\n }\n }\n\n return this;\n }\n\n /**\n * Insert new node after old node within the container.\n *\n * @param {Node|number} exist - child or child’s index\n * @param {Node|object|string|Node[]} add - new node\n *\n * @return {Node} this node for methods chain\n */\n insertAfter(exist, add) {\n exist = this.index(exist);\n\n const nodes = this.normalize(add, this.nodes[exist]).reverse();\n nodes.forEach(node => this.nodes.splice(exist + 1, 0, node));\n\n let index;\n for (const id in this.indexes) {\n index = this.indexes[id];\n if (exist < index) {\n this.indexes[id] = index + nodes.length;\n }\n }\n\n return this;\n }\n\n remove(child) {\n if (typeof child !== 'undefined') {\n warnOnce('Container#remove is deprecated. ' + 'Use Container#removeChild');\n this.removeChild(child);\n } else {\n super.remove();\n }\n return this;\n }\n\n /**\n * Removes node from the container and cleans the parent properties\n * from the node and its children.\n *\n * @param {Node|number} child - child or child’s index\n *\n * @return {Node} this node for methods chain\n *\n * @example\n * rule.nodes.length //=> 5\n * rule.removeChild(decl);\n * rule.nodes.length //=> 4\n * decl.parent //=> undefined\n */\n removeChild(child) {\n child = this.index(child);\n this.nodes[child].parent = undefined;\n this.nodes.splice(child, 1);\n\n let index;\n for (const id in this.indexes) {\n index = this.indexes[id];\n if (index >= child) {\n this.indexes[id] = index - 1;\n }\n }\n\n return this;\n }\n\n /**\n * Removes all children from the container\n * and cleans their parent properties.\n *\n * @return {Node} this node for methods chain\n *\n * @example\n * rule.removeAll();\n * rule.nodes.length //=> 0\n */\n removeAll() {\n this.nodes.forEach(node => (node.parent = undefined));\n this.nodes = [];\n return this;\n }\n\n /**\n * Passes all declaration values within the container that match pattern\n * through callback, replacing those values with the returned result\n * of callback.\n *\n * This method is useful if you are using a custom unit or function\n * and need to iterate through all values.\n *\n * @param {string|RegExp} pattern - replace pattern\n * @param {object} opts - options to speed up the search\n * @param {string|string[]} opts.props - an array of property names\n * @param {string} opts.fast - string that’s used\n * to narrow down values and speed up\n the regexp search\n * @param {function|string} callback - string to replace pattern\n * or callback that returns a new\n * value.\n * The callback will receive\n * the same arguments as those\n * passed to a function parameter\n * of `String#replace`.\n *\n * @return {Node} this node for methods chain\n *\n * @example\n * root.replaceValues(/\\d+rem/, { fast: 'rem' }, string => {\n * return 15 * parseInt(string) + 'px';\n * });\n */\n replaceValues(pattern, opts, callback) {\n if (!callback) {\n callback = opts;\n opts = {};\n }\n\n this.walkDecls(decl => {\n if (opts.props && opts.props.indexOf(decl.prop) === -1) return;\n if (opts.fast && decl.value.indexOf(opts.fast) === -1) return;\n\n decl.value = decl.value.replace(pattern, callback);\n });\n\n return this;\n }\n\n /**\n * Returns `true` if callback returns `true`\n * for all of the container’s children.\n *\n * @param {childCondition} condition - iterator returns true or false.\n *\n * @return {boolean} is every child pass condition\n *\n * @example\n * const noPrefixes = rule.every(i => i.prop[0] !== '-');\n */\n every(condition) {\n return this.nodes.every(condition);\n }\n\n /**\n * Returns `true` if callback returns `true` for (at least) one\n * of the container’s children.\n *\n * @param {childCondition} condition - iterator returns true or false.\n *\n * @return {boolean} is some child pass condition\n *\n * @example\n * const hasPrefix = rule.some(i => i.prop[0] === '-');\n */\n some(condition) {\n return this.nodes.some(condition);\n }\n\n /**\n * Returns a `child`’s index within the {@link Container#nodes} array.\n *\n * @param {Node} child - child of the current container.\n *\n * @return {number} child index\n *\n * @example\n * rule.index( rule.nodes[2] ) //=> 2\n */\n index(child) {\n if (typeof child === 'number') {\n return child;\n } else {\n return this.nodes.indexOf(child);\n }\n }\n\n /**\n * The container’s first child.\n *\n * @type {Node}\n *\n * @example\n * rule.first == rules.nodes[0];\n */\n get first() {\n if (!this.nodes) return undefined;\n return this.nodes[0];\n }\n\n /**\n * The container’s last child.\n *\n * @type {Node}\n *\n * @example\n * rule.last == rule.nodes[rule.nodes.length - 1];\n */\n get last() {\n if (!this.nodes) return undefined;\n return this.nodes[this.nodes.length - 1];\n }\n\n normalize(nodes, sample) {\n if (typeof nodes === 'string') {\n nodes = cleanSource(parse(nodes).nodes);\n } else if (!Array.isArray(nodes)) {\n if (nodes.type === 'root') {\n nodes = nodes.nodes;\n } else if (nodes.type) {\n nodes = [nodes];\n } else if (nodes.prop) {\n if (typeof nodes.value === 'undefined') {\n throw new Error('Value field is missed in node creation');\n } else if (typeof nodes.value !== 'string') {\n nodes.value = String(nodes.value);\n }\n nodes = [new Declaration(nodes)];\n } else if (nodes.selector) {\n nodes = [new Rule(nodes)];\n } else if (nodes.name) {\n nodes = [new AtRule(nodes)];\n } else if (nodes.text) {\n nodes = [new Comment(nodes)];\n } else {\n throw new Error('Unknown node type in node creation');\n }\n }\n\n const processed = nodes.map(i => {\n if (typeof i.raws === 'undefined') i = this.rebuild(i);\n\n if (i.parent) i = i.clone();\n if (typeof i.raws.before === 'undefined') {\n if (sample && typeof sample.raws.before !== 'undefined') {\n i.raws.before = sample.raws.before.replace(/[^\\s]/g, '');\n }\n }\n i.parent = this;\n return i;\n });\n\n return processed;\n }\n\n rebuild(node, parent) {\n let fix;\n if (node.type === 'root') {\n fix = new Root();\n } else if (node.type === 'atrule') {\n fix = new AtRule();\n } else if (node.type === 'rule') {\n fix = new Rule();\n } else if (node.type === 'decl') {\n fix = new Declaration();\n } else if (node.type === 'comment') {\n fix = new Comment();\n }\n\n for (const i in node) {\n if (i === 'nodes') {\n fix.nodes = node.nodes.map(j => this.rebuild(j, fix));\n } else if (i === 'parent' && parent) {\n fix.parent = parent;\n } else if (node.hasOwnProperty(i)) {\n fix[i] = node[i];\n }\n }\n\n return fix;\n }\n\n eachInside(callback) {\n warnOnce('Container#eachInside is deprecated. ' + 'Use Container#walk instead.');\n return this.walk(callback);\n }\n\n eachDecl(prop, callback) {\n warnOnce('Container#eachDecl is deprecated. ' + 'Use Container#walkDecls instead.');\n return this.walkDecls(prop, callback);\n }\n\n eachRule(selector, callback) {\n warnOnce('Container#eachRule is deprecated. ' + 'Use Container#walkRules instead.');\n return this.walkRules(selector, callback);\n }\n\n eachAtRule(name, callback) {\n warnOnce('Container#eachAtRule is deprecated. ' + 'Use Container#walkAtRules instead.');\n return this.walkAtRules(name, callback);\n }\n\n eachComment(callback) {\n warnOnce('Container#eachComment is deprecated. ' + 'Use Container#walkComments instead.');\n return this.walkComments(callback);\n }\n\n get semicolon() {\n warnOnce('Node#semicolon is deprecated. Use Node#raws.semicolon');\n return this.raws.semicolon;\n }\n\n set semicolon(val) {\n warnOnce('Node#semicolon is deprecated. Use Node#raws.semicolon');\n this.raws.semicolon = val;\n }\n\n get after() {\n warnOnce('Node#after is deprecated. Use Node#raws.after');\n return this.raws.after;\n }\n\n set after(val) {\n warnOnce('Node#after is deprecated. Use Node#raws.after');\n this.raws.after = val;\n }\n\n /**\n * @memberof Container#\n * @member {Node[]} nodes - an array containing the container’s children\n *\n * @example\n * const root = postcss.parse('a { color: black }');\n * root.nodes.length //=> 1\n * root.nodes[0].selector //=> 'a'\n * root.nodes[0].nodes[0].prop //=> 'color'\n */\n}\n\nexport default Container;\n","// @flow\nimport Container from './container';\nimport warnOnce from './warn-once';\n\n/**\n * Represents an at-rule.\n *\n * If it’s followed in the CSS by a {} block, this node will have\n * a nodes property representing its children.\n *\n * @extends Container\n *\n * @example\n * const root = postcss.parse('@charset \"UTF-8\"; @media print {}');\n *\n * const charset = root.first;\n * charset.type //=> 'atrule'\n * charset.nodes //=> undefined\n *\n * const media = root.last;\n * media.nodes //=> []\n */\nclass AtRule extends Container {\n constructor(defaults) {\n super(defaults);\n this.type = 'atrule';\n }\n\n append(...children) {\n if (!this.nodes) this.nodes = [];\n return super.append(...children);\n }\n\n prepend(...children) {\n if (!this.nodes) this.nodes = [];\n return super.prepend(...children);\n }\n\n get afterName() {\n warnOnce('AtRule#afterName was deprecated. Use AtRule#raws.afterName');\n return this.raws.afterName;\n }\n\n set afterName(val) {\n warnOnce('AtRule#afterName was deprecated. Use AtRule#raws.afterName');\n this.raws.afterName = val;\n }\n\n get _params() {\n warnOnce('AtRule#_params was deprecated. Use AtRule#raws.params');\n return this.raws.params;\n }\n\n set _params(val) {\n warnOnce('AtRule#_params was deprecated. Use AtRule#raws.params');\n this.raws.params = val;\n }\n\n /**\n * @memberof AtRule#\n * @member {string} name - the at-rule’s name immediately follows the `@`\n *\n * @example\n * const root = postcss.parse('@media print {}');\n * media.name //=> 'media'\n * const media = root.first;\n */\n\n /**\n * @memberof AtRule#\n * @member {string} params - the at-rule’s parameters, the values\n * that follow the at-rule’s name but precede\n * any {} block\n *\n * @example\n * const root = postcss.parse('@media print, screen {}');\n * const media = root.first;\n * media.params //=> 'print, screen'\n */\n\n /**\n * @memberof AtRule#\n * @member {object} raws - Information to generate byte-to-byte equal\n * node string as it was in the origin input.\n *\n * Every parser saves its own properties,\n * but the default CSS parser uses:\n *\n * * `before`: the space symbols before the node. It also stores `*`\n * and `_` symbols before the declaration (IE hack).\n * * `after`: the space symbols after the last child of the node\n * to the end of the node.\n * * `between`: the symbols between the property and value\n * for declarations, selector and `{` for rules, or last parameter\n * and `{` for at-rules.\n * * `semicolon`: contains true if the last child has\n * an (optional) semicolon.\n * * `afterName`: the space between the at-rule name and its parameters.\n *\n * PostCSS cleans at-rule parameters from comments and extra spaces,\n * but it stores origin content in raws properties.\n * As such, if you don’t change a declaration’s value,\n * PostCSS will use the raw value with comments.\n *\n * @example\n * const root = postcss.parse(' @media\\nprint {\\n}')\n * root.first.first.raws //=> { before: ' ',\n * // between: ' ',\n * // afterName: '\\n',\n * // after: '\\n' }\n */\n}\n\nexport default AtRule;\n","// @flow\n/**\n * Contains helpers for safely splitting lists of CSS values,\n * preserving parentheses and quotes.\n *\n * @example\n * const list = postcss.list;\n *\n * @namespace list\n */\nconst list = {\n split(string, separators, last) {\n const array = [];\n let current = '';\n let split = false;\n\n let func = 0;\n let quote = false;\n let escape = false;\n\n for (let i = 0; i < string.length; i++) {\n const letter = string[i];\n\n if (quote) {\n if (escape) {\n escape = false;\n } else if (letter === '\\\\') {\n escape = true;\n } else if (letter === quote) {\n quote = false;\n }\n } else if (letter === '\"' || letter === \"'\") {\n quote = letter;\n } else if (letter === '(') {\n func += 1;\n } else if (letter === ')') {\n if (func > 0) func -= 1;\n } else if (func === 0) {\n if (separators.indexOf(letter) !== -1) split = true;\n }\n\n if (split) {\n if (current !== '') array.push(current.trim());\n current = '';\n split = false;\n } else {\n current += letter;\n }\n }\n\n if (last || current !== '') array.push(current.trim());\n return array;\n },\n\n /**\n * Safely splits space-separated values (such as those for `background`,\n * `border-radius`, and other shorthand properties).\n *\n * @param {string} string - space-separated values\n *\n * @return {string[]} splitted values\n *\n * @example\n * postcss.list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']\n */\n space(string) {\n const spaces = [' ', '\\n', '\\t'];\n return list.split(string, spaces);\n },\n\n /**\n * Safely splits comma-separated values (such as those for `transition-*`\n * and `background` properties).\n *\n * @param {string} string - comma-separated values\n *\n * @return {string[]} splitted values\n *\n * @example\n * postcss.list.comma('black, linear-gradient(white, black)')\n * //=> ['black', 'linear-gradient(white, black)']\n */\n comma(string) {\n const comma = ',';\n return list.split(string, [comma], true);\n },\n};\n\nexport default list;\n","// @flow\nimport './at-rule'; // break cyclical dependency deadlock – #87\n\nimport Container from './container';\nimport warnOnce from './warn-once';\nimport list from './list';\n\n/**\n * Represents a CSS rule: a selector followed by a declaration block.\n *\n * @extends Container\n *\n * @example\n * const root = postcss.parse('a{}');\n * const rule = root.first;\n * rule.type //=> 'rule'\n * rule.toString() //=> 'a{}'\n */\nclass Rule extends Container {\n constructor(defaults) {\n super(defaults);\n this.type = 'rule';\n if (!this.nodes) this.nodes = [];\n }\n\n /**\n * An array containing the rule’s individual selectors.\n * Groups of selectors are split at commas.\n *\n * @type {string[]}\n *\n * @example\n * const root = postcss.parse('a, b { }');\n * const rule = root.first;\n *\n * rule.selector //=> 'a, b'\n * rule.selectors //=> ['a', 'b']\n *\n * rule.selectors = ['a', 'strong'];\n * rule.selector //=> 'a, strong'\n */\n get selectors() {\n return list.comma(this.selector);\n }\n\n set selectors(values) {\n const match = this.selector ? this.selector.match(/,\\s*/) : null;\n const sep = match ? match[0] : `,${this.raw('between', 'beforeOpen')}`;\n this.selector = values.join(sep);\n }\n\n get _selector() {\n warnOnce('Rule#_selector is deprecated. Use Rule#raws.selector');\n return this.raws.selector;\n }\n\n set _selector(val) {\n warnOnce('Rule#_selector is deprecated. Use Rule#raws.selector');\n this.raws.selector = val;\n }\n\n /**\n * @memberof Rule#\n * @member {string} selector - the rule’s full selector represented\n * as a string\n *\n * @example\n * const root = postcss.parse('a, b { }');\n * const rule = root.first;\n * rule.selector //=> 'a, b'\n */\n\n /**\n * @memberof Rule#\n * @member {object} raws - Information to generate byte-to-byte equal\n * node string as it was in the origin input.\n *\n * Every parser saves its own properties,\n * but the default CSS parser uses:\n *\n * * `before`: the space symbols before the node. It also stores `*`\n * and `_` symbols before the declaration (IE hack).\n * * `after`: the space symbols after the last child of the node\n * to the end of the node.\n * * `between`: the symbols between the property and value\n * for declarations, selector and `{` for rules, or last parameter\n * and `{` for at-rules.\n * * `semicolon`: contains true if the last child has\n * an (optional) semicolon.\n *\n * PostCSS cleans selectors from comments and extra spaces,\n * but it stores origin content in raws properties.\n * As such, if you don’t change a declaration’s value,\n * PostCSS will use the raw value with comments.\n *\n * @example\n * const root = postcss.parse('a {\\n color:black\\n}')\n * root.first.first.raws //=> { before: '', between: ' ', after: '\\n' }\n */\n}\n\nexport default Rule;\n","// @flow\n/**\n * Represents a plugin’s warning. It can be created using {@link Node#warn}.\n *\n * @example\n * if ( decl.important ) {\n * decl.warn(result, 'Avoid !important', { word: '!important' });\n * }\n */\nclass Warning {\n /**\n * @param {string} text - warning message\n * @param {Object} [opts] - warning options\n * @param {Node} opts.node - CSS node that caused the warning\n * @param {string} opts.word - word in CSS source that caused the warning\n * @param {number} opts.index - index in CSS node string that caused\n * the warning\n * @param {string} opts.plugin - name of the plugin that created\n * this warning. {@link Result#warn} fills\n * this property automatically.\n */\n constructor(text, opts = {}) {\n /**\n * @member {string} - Type to filter warnings from\n * {@link Result#messages}. Always equal\n * to `\"warning\"`.\n *\n * @example\n * const nonWarning = result.messages.filter(i => i.type !== 'warning')\n */\n this.type = 'warning';\n /**\n * @member {string} - The warning message.\n *\n * @example\n * warning.text //=> 'Try to avoid !important'\n */\n this.text = text;\n\n if (opts.node && opts.node.source) {\n const pos = opts.node.positionBy(opts);\n /**\n * @member {number} - Line in the input file\n * with this warning’s source\n *\n * @example\n * warning.line //=> 5\n */\n this.line = pos.line;\n /**\n * @member {number} - Column in the input file\n * with this warning’s source.\n *\n * @example\n * warning.column //=> 6\n */\n this.column = pos.column;\n }\n\n for (const opt in opts) this[opt] = opts[opt];\n }\n\n /**\n * Returns a warning position and message.\n *\n * @example\n * warning.toString() //=> 'postcss-lint:a.css:10:14: Avoid !important'\n *\n * @return {string} warning position and message\n */\n toString() {\n if (this.node) {\n return this.node.error(this.text, {\n plugin: this.plugin,\n index: this.index,\n word: this.word,\n }).message;\n } else if (this.plugin) {\n return `${this.plugin}: ${this.text}`;\n } else {\n return this.text;\n }\n }\n\n /**\n * @memberof Warning#\n * @member {string} plugin - The name of the plugin that created\n * it will fill this property automatically.\n * this warning. When you call {@link Node#warn}\n *\n * @example\n * warning.plugin //=> 'postcss-important'\n */\n\n /**\n * @memberof Warning#\n * @member {Node} node - Contains the CSS node that caused the warning.\n *\n * @example\n * warning.node.toString() //=> 'color: white !important'\n */\n}\n\nexport default Warning;\n","// @flow\nimport Warning from './warning';\n\n/**\n * @typedef {object} Message\n * @property {string} type - message type\n * @property {string} plugin - source PostCSS plugin name\n */\n\n/**\n * Provides the result of the PostCSS transformations.\n *\n * A Result instance is returned by {@link LazyResult#then}\n * or {@link Root#toResult} methods.\n *\n * @example\n * postcss([cssnext]).process(css).then(function (result) {\n * console.log(result.css);\n * });\n *\n * @example\n * var result2 = postcss.parse(css).toResult();\n */\nclass Result {\n /**\n * @param {Processor} processor - processor used for this transformation.\n * @param {Root} root - Root node after all transformations.\n * @param {processOptions} opts - options from the {@link Processor#process}\n * or {@link Root#toResult}\n */\n constructor(processor, root, opts) {\n /**\n * @member {Processor} - The Processor instance used\n * for this transformation.\n *\n * @example\n * for ( let plugin of result.processor.plugins) {\n * if ( plugin.postcssPlugin === 'postcss-bad' ) {\n * throw 'postcss-good is incompatible with postcss-bad';\n * }\n * });\n */\n this.processor = processor;\n /**\n * @member {Message[]} - Contains messages from plugins\n * (e.g., warnings or custom messages).\n * Each message should have type\n * and plugin properties.\n *\n * @example\n * postcss.plugin('postcss-min-browser', () => {\n * return (root, result) => {\n * var browsers = detectMinBrowsersByCanIUse(root);\n * result.messages.push({\n * type: 'min-browser',\n * plugin: 'postcss-min-browser',\n * browsers: browsers\n * });\n * };\n * });\n */\n this.messages = [];\n /**\n * @member {Root} - Root node after all transformations.\n *\n * @example\n * root.toResult().root == root;\n */\n this.root = root;\n /**\n * @member {processOptions} - Options from the {@link Processor#process}\n * or {@link Root#toResult} call\n * that produced this Result instance.\n *\n * @example\n * root.toResult(opts).opts == opts;\n */\n this.opts = opts;\n /**\n * @member {string} - A CSS string representing of {@link Result#root}.\n *\n * @example\n * postcss.parse('a{}').toResult().css //=> \"a{}\"\n */\n this.css = undefined;\n /**\n * @member {SourceMapGenerator} - An instance of `SourceMapGenerator`\n * class from the `source-map` library,\n * representing changes\n * to the {@link Result#root} instance.\n *\n * @example\n * result.map.toJSON() //=> { version: 3, file: 'a.css', … }\n *\n * @example\n * if ( result.map ) {\n * fs.writeFileSync(result.opts.to + '.map', result.map.toString());\n * }\n */\n this.map = undefined;\n }\n\n /**\n * Returns for @{link Result#css} content.\n *\n * @example\n * result + '' === result.css\n *\n * @return {string} string representing of {@link Result#root}\n */\n toString() {\n return this.css;\n }\n\n /**\n * Creates an instance of {@link Warning} and adds it\n * to {@link Result#messages}.\n *\n * @param {string} text - warning message\n * @param {Object} [opts] - warning options\n * @param {Node} opts.node - CSS node that caused the warning\n * @param {string} opts.word - word in CSS source that caused the warning\n * @param {number} opts.index - index in CSS node string that caused\n * the warning\n * @param {string} opts.plugin - name of the plugin that created\n * this warning. {@link Result#warn} fills\n * this property automatically.\n *\n * @return {Warning} created warning\n */\n warn(text, opts = {}) {\n if (!opts.plugin) {\n if (this.lastPlugin && this.lastPlugin.postcssPlugin) {\n opts.plugin = this.lastPlugin.postcssPlugin;\n }\n }\n\n const warning = new Warning(text, opts);\n this.messages.push(warning);\n\n return warning;\n }\n\n /**\n * Returns warnings from plugins. Filters {@link Warning} instances\n * from {@link Result#messages}.\n *\n * @example\n * result.warnings().forEach(warn => {\n * console.warn(warn.toString());\n * });\n *\n * @return {Warning[]} warnings from plugins\n */\n warnings() {\n return this.messages.filter(i => i.type === 'warning');\n }\n\n /**\n * An alias for the {@link Result#css} property.\n * Use it with syntaxes that generate non-CSS output.\n * @type {string}\n *\n * @example\n * result.css === result.content;\n */\n get content() {\n return this.css;\n }\n}\n\nexport default Result;\n","// @flow\nimport stringify from './stringify';\nimport warnOnce from './warn-once';\nimport Result from './result';\nimport parse from './parse';\n\nfunction isPromise(obj) {\n return typeof obj === 'object' && typeof obj.then === 'function';\n}\n\n/**\n * @callback onFulfilled\n * @param {Result} result\n */\n\n/**\n * @callback onRejected\n * @param {Error} error\n */\n\n/**\n * A Promise proxy for the result of PostCSS transformations.\n *\n * A `LazyResult` instance is returned by {@link Processor#process}.\n *\n * @example\n * const lazy = postcss([cssnext]).process(css);\n */\nclass LazyResult {\n constructor(processor, css, opts) {\n this.stringified = false;\n this.processed = false;\n\n let root;\n if (typeof css === 'object' && css.type === 'root') {\n root = css;\n } else if (css instanceof LazyResult || css instanceof Result) {\n root = css.root;\n if (css.map) {\n if (typeof opts.map === 'undefined') opts.map = {};\n if (!opts.map.inline) opts.map.inline = false;\n opts.map.prev = css.map;\n }\n } else {\n let parser = parse;\n if (opts.syntax) parser = opts.syntax.parse;\n if (opts.parser) parser = opts.parser;\n if (parser.parse) parser = parser.parse;\n\n try {\n root = parser(css, opts);\n } catch (error) {\n this.error = error;\n }\n }\n\n this.result = new Result(processor, root, opts);\n }\n\n /**\n * Returns a {@link Processor} instance, which will be used\n * for CSS transformations.\n * @type {Processor}\n */\n get processor() {\n return this.result.processor;\n }\n\n /**\n * Options from the {@link Processor#process} call.\n * @type {processOptions}\n */\n get opts() {\n return this.result.opts;\n }\n\n /**\n * Processes input CSS through synchronous plugins, converts `Root`\n * to a CSS string and returns {@link Result#css}.\n *\n * This property will only work with synchronous plugins.\n * If the processor contains any asynchronous plugins\n * it will throw an error. This is why this method is only\n * for debug purpose, you should always use {@link LazyResult#then}.\n *\n * @type {string}\n * @see Result#css\n */\n get css() {\n return this.stringify().css;\n }\n\n /**\n * An alias for the `css` property. Use it with syntaxes\n * that generate non-CSS output.\n *\n * This property will only work with synchronous plugins.\n * If the processor contains any asynchronous plugins\n * it will throw an error. This is why this method is only\n * for debug purpose, you should always use {@link LazyResult#then}.\n *\n * @type {string}\n * @see Result#content\n */\n get content() {\n return this.stringify().content;\n }\n\n /**\n * Processes input CSS through synchronous plugins\n * and returns {@link Result#map}.\n *\n * This property will only work with synchronous plugins.\n * If the processor contains any asynchronous plugins\n * it will throw an error. This is why this method is only\n * for debug purpose, you should always use {@link LazyResult#then}.\n *\n * @type {SourceMapGenerator}\n * @see Result#map\n */\n get map() {\n return this.stringify().map;\n }\n\n /**\n * Processes input CSS through synchronous plugins\n * and returns {@link Result#root}.\n *\n * This property will only work with synchronous plugins. If the processor\n * contains any asynchronous plugins it will throw an error.\n *\n * This is why this method is only for debug purpose,\n * you should always use {@link LazyResult#then}.\n *\n * @type {Root}\n * @see Result#root\n */\n get root() {\n return this.sync().root;\n }\n\n /**\n * Processes input CSS through synchronous plugins\n * and returns {@link Result#messages}.\n *\n * This property will only work with synchronous plugins. If the processor\n * contains any asynchronous plugins it will throw an error.\n *\n * This is why this method is only for debug purpose,\n * you should always use {@link LazyResult#then}.\n *\n * @type {Message[]}\n * @see Result#messages\n */\n get messages() {\n return this.sync().messages;\n }\n\n /**\n * Processes input CSS through synchronous plugins\n * and calls {@link Result#warnings()}.\n *\n * @return {Warning[]} warnings from plugins\n */\n warnings() {\n return this.sync().warnings();\n }\n\n /**\n * Alias for the {@link LazyResult#css} property.\n *\n * @example\n * lazy + '' === lazy.css;\n *\n * @return {string} output CSS\n */\n toString() {\n return this.css;\n }\n\n /**\n * Processes input CSS through synchronous and asynchronous plugins\n * and calls `onFulfilled` with a Result instance. If a plugin throws\n * an error, the `onRejected` callback will be executed.\n *\n * It implements standard Promise API.\n *\n * @param {onFulfilled} onFulfilled - callback will be executed\n * when all plugins will finish work\n * @param {onRejected} onRejected - callback will be execited on any error\n *\n * @return {Promise} Promise API to make queue\n *\n * @example\n * postcss([cssnext]).process(css).then(result => {\n * console.log(result.css);\n * });\n */\n then(onFulfilled, onRejected) {\n return this.async().then(onFulfilled, onRejected);\n }\n\n /**\n * Processes input CSS through synchronous and asynchronous plugins\n * and calls onRejected for each error thrown in any plugin.\n *\n * It implements standard Promise API.\n *\n * @param {onRejected} onRejected - callback will be execited on any error\n *\n * @return {Promise} Promise API to make queue\n *\n * @example\n * postcss([cssnext]).process(css).then(result => {\n * console.log(result.css);\n * }).catch(error => {\n * console.error(error);\n * });\n */\n catch(onRejected) {\n return this.async().catch(onRejected);\n }\n\n handleError(error, plugin) {\n try {\n this.error = error;\n if (error.name === 'CssSyntaxError' && !error.plugin) {\n error.plugin = plugin.postcssPlugin;\n error.setMessage();\n } else if (plugin.postcssVersion) {\n const pluginName = plugin.postcssPlugin;\n const pluginVer = plugin.postcssVersion;\n const runtimeVer = this.result.processor.version;\n const a = pluginVer.split('.');\n const b = runtimeVer.split('.');\n\n if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {\n warnOnce(\n `${'Your current PostCSS version ' + 'is '}${runtimeVer}, but ${pluginName} ` +\n `uses ${pluginVer}. Perhaps this is ` +\n `the source of the error below.`\n );\n }\n }\n } catch (err) {\n if (console && console.error) console.error(err);\n }\n }\n\n asyncTick(resolve, reject) {\n if (this.plugin >= this.processor.plugins.length) {\n this.processed = true;\n return resolve();\n }\n\n try {\n const plugin = this.processor.plugins[this.plugin];\n const promise = this.run(plugin);\n this.plugin += 1;\n\n if (isPromise(promise)) {\n promise\n .then(() => {\n this.asyncTick(resolve, reject);\n })\n .catch(error => {\n this.handleError(error, plugin);\n this.processed = true;\n reject(error);\n });\n } else {\n this.asyncTick(resolve, reject);\n }\n } catch (error) {\n this.processed = true;\n reject(error);\n }\n }\n\n async() {\n if (this.processed) {\n return new Promise((resolve, reject) => {\n if (this.error) {\n reject(this.error);\n } else {\n resolve(this.stringify());\n }\n });\n }\n if (this.processing) {\n return this.processing;\n }\n\n this.processing = new Promise((resolve, reject) => {\n if (this.error) return reject(this.error);\n this.plugin = 0;\n this.asyncTick(resolve, reject);\n }).then(() => {\n this.processed = true;\n return this.stringify();\n });\n\n return this.processing;\n }\n\n sync() {\n if (this.processed) return this.result;\n this.processed = true;\n\n if (this.processing) {\n throw new Error('Use process(css).then(cb) to work with async plugins');\n }\n\n if (this.error) throw this.error;\n\n this.result.processor.plugins.forEach(plugin => {\n const promise = this.run(plugin);\n if (isPromise(promise)) {\n throw new Error('Use process(css).then(cb) to work with async plugins');\n }\n });\n\n return this.result;\n }\n\n run(plugin) {\n this.result.lastPlugin = plugin;\n\n try {\n return plugin(this.result.root, this.result);\n } catch (error) {\n this.handleError(error, plugin);\n throw error;\n }\n }\n\n stringify() {\n if (this.stringified) return this.result;\n this.stringified = true;\n\n this.sync();\n\n const opts = this.result.opts;\n let str = stringify;\n if (opts.syntax) str = opts.syntax.stringify;\n if (opts.stringifier) str = opts.stringifier;\n if (str.stringify) str = str.stringify;\n\n let result = '';\n str(this.root, i => {\n result += i;\n });\n this.result.css = result;\n\n return this.result;\n }\n}\n\nexport default LazyResult;\n","// @flow\nimport LazyResult from './lazy-result';\n\n/**\n * @callback builder\n * @param {string} part - part of generated CSS connected to this node\n * @param {Node} node - AST node\n * @param {\"start\"|\"end\"} [type] - node’s part type\n */\n\n/**\n * @callback parser\n *\n * @param {string|toString} css - string with input CSS or any object\n * with toString() method, like a Buffer\n * @param {processOptions} [opts] - options with only `from` and `map` keys\n *\n * @return {Root} PostCSS AST\n */\n\n/**\n * @callback stringifier\n *\n * @param {Node} node - start node for stringifing. Usually {@link Root}.\n * @param {builder} builder - function to concatenate CSS from node’s parts\n * or generate string and source map\n *\n * @return {void}\n */\n\n/**\n * @typedef {object} syntax\n * @property {parser} parse - function to generate AST by string\n * @property {stringifier} stringify - function to generate string by AST\n */\n\n/**\n * @typedef {object} toString\n * @property {function} toString\n */\n\n/**\n * @callback pluginFunction\n * @param {Root} root - parsed input CSS\n * @param {Result} result - result to set warnings or check other plugins\n */\n\n/**\n * @typedef {object} Plugin\n * @property {function} postcss - PostCSS plugin function\n */\n\n/**\n * @typedef {object} processOptions\n * @property {string} from - the path of the CSS source file.\n * You should always set `from`,\n * because it is used in source map\n * generation and syntax error messages.\n * @property {string} to - the path where you’ll put the output\n * CSS file. You should always set `to`\n * to generate correct source maps.\n * @property {parser} parser - function to generate AST by string\n * @property {stringifier} stringifier - class to generate string by AST\n * @property {syntax} syntax - object with `parse` and `stringify`\n * @property {object} map - source map options\n * @property {boolean} map.inline - does source map should\n * be embedded in the output\n * CSS as a base64-encoded\n * comment\n * @property {string|object|false|function} map.prev - source map content\n * from a previous\n * processing step\n * (for example, Sass).\n * PostCSS will try to find\n * previous map\n * automatically, so you\n * could disable it by\n * `false` value.\n * @property {boolean} map.sourcesContent - does PostCSS should set\n * the origin content to map\n * @property {string|false} map.annotation - does PostCSS should set\n * annotation comment to map\n * @property {string} map.from - override `from` in map’s\n * `sources`\n */\n\n/**\n * Contains plugins to process CSS. Create one `Processor` instance,\n * initialize its plugins, and then use that instance on numerous CSS files.\n *\n * @example\n * const processor = postcss([autoprefixer, precss]);\n * processor.process(css1).then(result => console.log(result.css));\n * processor.process(css2).then(result => console.log(result.css));\n */\nclass Processor {\n /**\n * @param {Array.|Processor} plugins - PostCSS\n * plugins. See {@link Processor#use} for plugin format.\n */\n constructor(plugins = []) {\n /**\n * @member {string} - Current PostCSS version.\n *\n * @example\n * if ( result.processor.version.split('.')[0] !== '5' ) {\n * throw new Error('This plugin works only with PostCSS 5');\n * }\n */\n this.version = '5.2.0';\n /**\n * @member {pluginFunction[]} - Plugins added to this processor.\n *\n * @example\n * const processor = postcss([autoprefixer, precss]);\n * processor.plugins.length //=> 2\n */\n this.plugins = this.normalize(plugins);\n }\n\n /**\n * Adds a plugin to be used as a CSS processor.\n *\n * PostCSS plugin can be in 4 formats:\n * * A plugin created by {@link postcss.plugin} method.\n * * A function. PostCSS will pass the function a @{link Root}\n * as the first argument and current {@link Result} instance\n * as the second.\n * * An object with a `postcss` method. PostCSS will use that method\n * as described in #2.\n * * Another {@link Processor} instance. PostCSS will copy plugins\n * from that instance into this one.\n *\n * Plugins can also be added by passing them as arguments when creating\n * a `postcss` instance (see [`postcss(plugins)`]).\n *\n * Asynchronous plugins should return a `Promise` instance.\n *\n * @param {Plugin|pluginFunction|Processor} plugin - PostCSS plugin\n * or {@link Processor}\n * with plugins\n *\n * @example\n * const processor = postcss()\n * .use(autoprefixer)\n * .use(precss);\n *\n * @return {Processes} current processor to make methods chain\n */\n use(plugin) {\n this.plugins = this.plugins.concat(this.normalize([plugin]));\n return this;\n }\n\n /**\n * Parses source CSS and returns a {@link LazyResult} Promise proxy.\n * Because some plugins can be asynchronous it doesn’t make\n * any transformations. Transformations will be applied\n * in the {@link LazyResult} methods.\n *\n * @param {string|toString|Result} css - String with input CSS or\n * any object with a `toString()`\n * method, like a Buffer.\n * Optionally, send a {@link Result}\n * instance and the processor will\n * take the {@link Root} from it.\n * @param {processOptions} [opts] - options\n *\n * @return {LazyResult} Promise proxy\n *\n * @example\n * processor.process(css, { from: 'a.css', to: 'a.out.css' })\n * .then(result => {\n * console.log(result.css);\n * });\n */\n process(css, opts = {}) {\n return new LazyResult(this, css, opts);\n }\n\n normalize(plugins) {\n let normalized = [];\n plugins.forEach(i => {\n if (i.postcss) i = i.postcss;\n\n if (typeof i === 'object' && Array.isArray(i.plugins)) {\n normalized = normalized.concat(i.plugins);\n } else if (typeof i === 'function') {\n normalized.push(i);\n } else {\n throw new Error(`${i} is not a PostCSS plugin`);\n }\n });\n return normalized;\n }\n}\n\nexport default Processor;\n","// @flow\nimport './rule'; // break cyclical dependency deadlock – #87\n\nimport Container from './container';\nimport LazyResult from './lazy-result';\nimport Processor from './processor';\nimport warnOnce from './warn-once';\n\n/**\n * Represents a CSS file and contains all its parsed nodes.\n *\n * @extends Container\n *\n * @example\n * const root = postcss.parse('a{color:black} b{z-index:2}');\n * root.type //=> 'root'\n * root.nodes.length //=> 2\n */\nclass Root extends Container {\n constructor(defaults) {\n super(defaults);\n this.type = 'root';\n if (!this.nodes) this.nodes = [];\n }\n\n removeChild(child) {\n child = this.index(child);\n\n if (child === 0 && this.nodes.length > 1) {\n this.nodes[1].raws.before = this.nodes[child].raws.before;\n }\n\n return super.removeChild(child);\n }\n\n normalize(child, sample, type) {\n const nodes = super.normalize(child);\n\n if (sample) {\n if (type === 'prepend') {\n if (this.nodes.length > 1) {\n sample.raws.before = this.nodes[1].raws.before;\n } else {\n delete sample.raws.before;\n }\n } else if (this.first !== sample) {\n nodes.forEach(node => {\n node.raws.before = sample.raws.before;\n });\n }\n }\n\n return nodes;\n }\n\n /**\n * Returns a {@link Result} instance representing the root’s CSS.\n *\n * @param {processOptions} [opts] - options with only `to` and `map` keys\n *\n * @return {Result} result with current root’s CSS\n *\n * @example\n * const root1 = postcss.parse(css1, { from: 'a.css' });\n * const root2 = postcss.parse(css2, { from: 'b.css' });\n * root1.append(root2);\n * const result = root1.toResult({ to: 'all.css', map: true });\n */\n toResult(opts = {}) {\n const lazy = new LazyResult(new Processor(), this, opts);\n return lazy.stringify();\n }\n\n remove(child) {\n warnOnce('Root#remove is deprecated. Use Root#removeChild');\n this.removeChild(child);\n }\n\n prevMap() {\n warnOnce('Root#prevMap is deprecated. Use Root#source.input.map');\n return this.source.input.map;\n }\n\n /**\n * @memberof Root#\n * @member {object} raws - Information to generate byte-to-byte equal\n * node string as it was in the origin input.\n *\n * Every parser saves its own properties,\n * but the default CSS parser uses:\n *\n * * `after`: the space symbols after the last child to the end of file.\n * * `semicolon`: is the last child has an (optional) semicolon.\n *\n * @example\n * postcss.parse('a {}\\n').raws //=> { after: '\\n' }\n * postcss.parse('a {}').raws //=> { after: '' }\n */\n}\n\nexport default Root;\n","// @flow\nimport './root'; // break cyclical dependency deadlock – #87\n\nimport CssSyntaxError from './css-syntax-error';\n// import PreviousMap from './previous-map';\n\nlet sequence = 0;\n\n/**\n * @typedef {object} filePosition\n * @property {string} file - path to file\n * @property {number} line - source line in file\n * @property {number} column - source column in file\n */\n\n/**\n * Represents the source CSS.\n *\n * @example\n * const root = postcss.parse(css, { from: file });\n * const input = root.source.input;\n */\nclass Input {\n /**\n * @param {string} css - input CSS source\n * @param {object} [opts] - {@link Processor#process} options\n */\n constructor(css, opts = {}) {\n /**\n * @member {string} - input CSS source\n *\n * @example\n * const input = postcss.parse('a{}', { from: file }).input;\n * input.css //=> \"a{}\";\n */\n this.css = css.toString();\n\n if (this.css[0] === '\\uFEFF' || this.css[0] === '\\uFFFE') {\n this.css = this.css.slice(1);\n }\n\n if (opts.from) {\n if (/^\\w+:\\/\\//.test(opts.from)) {\n /**\n * @member {string} - The absolute path to the CSS source file\n * defined with the `from` option.\n *\n * @example\n * const root = postcss.parse(css, { from: 'a.css' });\n * root.source.input.file //=> '/home/ai/a.css'\n */\n this.file = opts.from;\n } else {\n this.file = path.resolve(opts.from);\n }\n }\n\n /*\n let map = new PreviousMap(this.css, opts);\n if ( map.text ) {\n /!**\n * @member {PreviousMap} - The input source map passed from\n * a compilation step before PostCSS\n * (for example, from Sass compiler).\n *\n * @example\n * root.source.input.map.consumer().sources //=> ['a.sass']\n *!/\n this.map = map;\n let file = map.consumer().file;\n if ( !this.file && file ) this.file = this.mapResolve(file);\n }\n*/\n\n if (!this.file) {\n sequence += 1;\n /**\n * @member {string} - The unique ID of the CSS source. It will be\n * created if `from` option is not provided\n * (because PostCSS does not know the file path).\n *\n * @example\n * const root = postcss.parse(css);\n * root.source.input.file //=> undefined\n * root.source.input.id //=> \"\"\n */\n this.id = ``;\n }\n if (this.map) this.map.file = this.from;\n }\n\n error(message, line, column, opts = {}) {\n let result;\n const origin = this.origin(line, column);\n if (origin) {\n result = new CssSyntaxError(\n message,\n origin.line,\n origin.column,\n origin.source,\n origin.file,\n opts.plugin\n );\n } else {\n result = new CssSyntaxError(message, line, column, this.css, this.file, opts.plugin);\n }\n\n result.input = { line, column, source: this.css };\n if (this.file) result.input.file = this.file;\n\n return result;\n }\n\n /**\n * Reads the input source map and returns a symbol position\n * in the input source (e.g., in a Sass file that was compiled\n * to CSS before being passed to PostCSS).\n *\n * @param {number} line - line in input CSS\n * @param {number} column - column in input CSS\n *\n * @return {filePosition} position in input source\n *\n * @example\n * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 }\n */\n origin(line, column) {\n if (!this.map) return false;\n const consumer = this.map.consumer();\n\n const from = consumer.originalPositionFor({ line, column });\n if (!from.source) return false;\n\n const result = {\n file: this.mapResolve(from.source),\n line: from.line,\n column: from.column,\n };\n\n const source = consumer.sourceContentFor(from.source);\n if (source) result.source = source;\n\n return result;\n }\n\n mapResolve(file) {\n if (/^\\w+:\\/\\//.test(file)) {\n return file;\n } else {\n return path.resolve(this.map.consumer().sourceRoot || '.', file);\n }\n }\n\n /**\n * The CSS source identifier. Contains {@link Input#file} if the user\n * set the `from` option, or {@link Input#id} if they did not.\n * @type {string}\n *\n * @example\n * const root = postcss.parse(css, { from: 'a.css' });\n * root.source.input.from //=> \"/home/ai/a.css\"\n *\n * const root = postcss.parse(css);\n * root.source.input.from //=> \"\"\n */\n get from() {\n return this.file || this.id;\n }\n}\n\nexport default Input;\n","// @flow\nimport tokenize from '../postcss/tokenize';\nimport Comment from '../postcss/comment';\nimport Parser from '../postcss/parser';\n\nexport default class SafeParser extends Parser {\n tokenize() {\n this.tokens = tokenize(this.input, { ignoreErrors: true });\n }\n\n comment(token) {\n const node = new Comment();\n this.init(node, token[2], token[3]);\n node.source.end = { line: token[4], column: token[5] };\n\n let text = token[1].slice(2);\n if (text.slice(-2) === '*/') text = text.slice(0, -2);\n\n if (/^\\s*$/.test(text)) {\n node.text = '';\n node.raws.left = text;\n node.raws.right = '';\n } else {\n const match = text.match(/^(\\s*)([^]*[^\\s])(\\s*)$/);\n node.text = match[2];\n node.raws.left = match[1];\n node.raws.right = match[3];\n }\n }\n\n unclosedBracket() {}\n\n unknownWord(start) {\n const buffer = this.tokens.slice(start, this.pos + 1);\n this.spaces += buffer.map(i => i[1]).join('');\n }\n\n unexpectedClose() {\n this.current.raws.after += '}';\n }\n\n doubleColon() {}\n\n unnamedAtrule(node) {\n node.name = '';\n }\n\n precheckMissedSemicolon(tokens) {\n const colon = this.colon(tokens);\n if (colon === false) return;\n\n let split;\n for (split = colon - 1; split >= 0; split--) {\n if (tokens[split][0] === 'word') break;\n }\n for (split -= 1; split >= 0; split--) {\n if (tokens[split][0] !== 'space') {\n split += 1;\n break;\n }\n }\n const other = tokens.splice(split, tokens.length - split);\n this.decl(other);\n }\n\n checkMissedSemicolon() {}\n\n endFile() {\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon;\n }\n this.current.raws.after = (this.current.raws.after || '') + this.spaces;\n\n while (this.current.parent) {\n this.current = this.current.parent;\n this.current.raws.after = '';\n }\n }\n}\n","// @flow\nimport Input from '../postcss/input';\n\nimport SafeParser from './safe-parser';\n\nexport default function safeParse(css, opts) {\n const input = new Input(css, opts);\n\n const parser = new SafeParser(input);\n parser.tokenize();\n parser.loop();\n\n return parser.root;\n}\n","// @flow\n/* eslint-disable import/no-unresolved */\nimport transformDeclPairs from 'css-to-react-native';\n\nimport generateComponentId from '../utils/generateComponentId';\nimport type { RuleSet, StyleSheet } from '../types';\nimport flatten from '../utils/flatten';\n// $FlowFixMe\nimport parse from '../vendor/postcss-safe-parser/parse';\n\nlet generated = {};\n\nexport const resetStyleCache = () => {\n generated = {};\n};\n\n/*\n InlineStyle takes arbitrary CSS and generates a flat object\n */\nexport default (styleSheet: StyleSheet) => {\n class InlineStyle {\n rules: RuleSet;\n\n constructor(rules: RuleSet) {\n this.rules = rules;\n }\n\n generateStyleObject(executionContext: Object) {\n const flatCSS = flatten(this.rules, executionContext).join('');\n\n const hash = generateComponentId(flatCSS);\n if (!generated[hash]) {\n const root = parse(flatCSS);\n const declPairs = [];\n root.each(node => {\n if (node.type === 'decl') {\n declPairs.push([node.prop, node.value]);\n } else if (process.env.NODE_ENV !== 'production' && node.type !== 'comment') {\n /* eslint-disable no-console */\n console.warn(`Node of type ${node.type} not supported as an inline style`);\n }\n });\n // RN currently does not support differing values for the corner radii of Image\n // components (but does for View). It is almost impossible to tell whether we'll have\n // support, so we'll just disable multiple values here.\n // https://github.com/styled-components/css-to-react-native/issues/11\n const styleObject = transformDeclPairs(declPairs, [\n 'borderRadius',\n 'borderWidth',\n 'borderColor',\n 'borderStyle',\n ]);\n const styles = styleSheet.create({\n generated: styleObject,\n });\n generated[hash] = styles.generated;\n }\n return generated[hash];\n }\n }\n\n return InlineStyle;\n};\n","/* eslint-disable */\n/**\n mixin-deep; https://github.com/jonschlinkert/mixin-deep\n Inlined such that it will be consistently transpiled to an IE-compatible syntax.\n\n The MIT License (MIT)\n\n Copyright (c) 2014-present, Jon Schlinkert.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\n\nconst isObject = val => {\n return (\n typeof val === 'function' || (typeof val === 'object' && val !== null && !Array.isArray(val))\n );\n};\n\nconst isValidKey = key => {\n return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';\n};\n\nfunction mixin(target, val, key) {\n const obj = target[key];\n if (isObject(val) && isObject(obj)) {\n mixinDeep(obj, val);\n } else {\n target[key] = val;\n }\n}\n\nexport default function mixinDeep(target, ...rest) {\n for (const obj of rest) {\n if (isObject(obj)) {\n for (const key in obj) {\n if (isValidKey(key)) {\n mixin(target, obj[key], key);\n }\n }\n }\n }\n\n return target;\n}\n","// @flow\nimport { EMPTY_OBJECT } from './empties';\n\ntype Props = {\n theme?: any,\n};\n\nexport default (props: Props, providedTheme: any, defaultProps: any = EMPTY_OBJECT) => {\n return (props.theme !== defaultProps.theme && props.theme) || providedTheme || defaultProps.theme;\n};\n","// @flow\nimport type { IStyledComponent } from '../types';\n\nexport default function isTag(target: $PropertyType): boolean %checks {\n return (\n typeof target === 'string' &&\n (process.env.NODE_ENV !== 'production'\n ? target.charAt(0) === target.charAt(0).toLowerCase()\n : true)\n );\n}\n","// @flow\nimport type { IStyledComponent } from '../types';\nimport getComponentName from './getComponentName';\nimport isTag from './isTag';\n\nexport default function generateDisplayName(\n target: $PropertyType\n): string {\n return isTag(target) ? `styled.${target}` : `Styled(${getComponentName(target)})`;\n}\n","// @flow\nimport React, { useContext, useMemo, type Element, type Context } from 'react';\nimport throwStyledError from '../utils/error';\nimport isFunction from '../utils/isFunction';\n\nexport type Theme = { [key: string]: mixed };\n\ntype ThemeArgument = Theme | ((outerTheme?: Theme) => Theme);\n\ntype Props = {\n children?: Element,\n theme: ThemeArgument,\n};\n\nexport const ThemeContext: Context = React.createContext();\n\nexport const ThemeConsumer = ThemeContext.Consumer;\n\nfunction mergeTheme(theme: ThemeArgument, outerTheme?: Theme): Theme {\n if (!theme) {\n return throwStyledError(14);\n }\n\n if (isFunction(theme)) {\n const mergedTheme = theme(outerTheme);\n\n if (\n process.env.NODE_ENV !== 'production' &&\n (mergedTheme === null || Array.isArray(mergedTheme) || typeof mergedTheme !== 'object')\n ) {\n return throwStyledError(7);\n }\n\n return mergedTheme;\n }\n\n if (Array.isArray(theme) || typeof theme !== 'object') {\n return throwStyledError(8);\n }\n\n return outerTheme ? { ...outerTheme, ...theme } : theme;\n}\n\n/**\n * Provide a theme to an entire react component tree via context\n */\nexport default function ThemeProvider(props: Props) {\n const outerTheme = useContext(ThemeContext);\n const themeContext = useMemo(() => mergeTheme(props.theme, outerTheme), [\n props.theme,\n outerTheme,\n ]);\n\n if (!props.children) {\n return null;\n }\n\n return {props.children};\n}\n","// @flow\nimport React, { createElement, Component } from 'react';\nimport hoist from 'hoist-non-react-statics';\nimport merge from '../utils/mixinDeep';\nimport determineTheme from '../utils/determineTheme';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from '../utils/empties';\nimport generateDisplayName from '../utils/generateDisplayName';\nimport isFunction from '../utils/isFunction';\nimport isTag from '../utils/isTag';\nimport isStyledComponent from '../utils/isStyledComponent';\nimport { ThemeConsumer } from './ThemeProvider';\n\nimport type { Theme } from './ThemeProvider';\nimport type { Attrs, RuleSet, Target } from '../types';\n\n// NOTE: no hooks available for react-native yet;\n// if the user makes use of ThemeProvider or StyleSheetManager things will break.\n\n// Validator defaults to true if not in HTML/DOM env\nconst validAttr = () => true;\n\nclass StyledNativeComponent extends Component<*, *> {\n root: ?Object;\n\n attrs = {};\n\n render() {\n return (\n \n {(theme?: Theme) => {\n const {\n $as: transientAsProp,\n as: renderAs,\n forwardedComponent,\n forwardedAs,\n forwardedRef,\n testID,\n style = [],\n ...props\n } = this.props;\n\n const { defaultProps, target, shouldForwardProp } = forwardedComponent;\n const elementToBeRendered =\n this.attrs.$as || this.attrs.as || transientAsProp || renderAs || target;\n\n const generatedStyles = this.generateAndInjectStyles(\n determineTheme(this.props, theme, defaultProps) || EMPTY_OBJECT,\n this.props\n );\n\n const isTargetTag = isTag(elementToBeRendered);\n const computedProps = this.attrs !== props ? { ...props, ...this.attrs } : props;\n const propFilterFn = shouldForwardProp || (isTargetTag && validAttr);\n const propsForElement = {};\n let key;\n\n for (key in computedProps) {\n if (key[0] === '$' || key === 'as') continue;\n else if (key === 'forwardedAs') {\n propsForElement.as = props[key];\n } else if (!propFilterFn || propFilterFn(key, validAttr)) {\n // Don't pass through filtered tags through to native elements\n propsForElement[key] = computedProps[key];\n }\n }\n\n propsForElement.style = typeof style === 'function' ?\n (state) => {\n return [generatedStyles].concat(style(state))\n }\n : [generatedStyles].concat(style);\n propsForElement.testID = testID || propsForElement.testID;\n\n if (forwardedRef) propsForElement.ref = forwardedRef;\n if (forwardedAs) propsForElement.as = forwardedAs;\n\n return createElement(elementToBeRendered, propsForElement);\n }}\n \n );\n }\n\n buildExecutionContext(theme: ?Object, props: Object, attrs: Attrs) {\n const context = { ...props, theme };\n\n if (!attrs.length) return context;\n\n this.attrs = {};\n\n attrs.forEach(attrDef => {\n let resolvedAttrDef = attrDef;\n let attr;\n let key;\n\n if (isFunction(resolvedAttrDef)) {\n resolvedAttrDef = resolvedAttrDef(context);\n }\n\n /* eslint-disable guard-for-in */\n for (key in resolvedAttrDef) {\n attr = resolvedAttrDef[key];\n this.attrs[key] = attr;\n context[key] = attr;\n }\n /* eslint-enable */\n });\n\n return context;\n }\n\n generateAndInjectStyles(theme: any, props: any) {\n const { inlineStyle } = props.forwardedComponent;\n\n const executionContext = this.buildExecutionContext(\n theme,\n props,\n props.forwardedComponent.attrs\n );\n\n return inlineStyle.generateStyleObject(executionContext);\n }\n\n setNativeProps(nativeProps: Object) {\n if (this.root !== undefined) {\n // $FlowFixMe\n this.root.setNativeProps(nativeProps);\n } else if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n 'setNativeProps was called on a Styled Component wrapping a stateless functional component.'\n );\n }\n }\n}\n\nexport default (InlineStyle: Function) => {\n const createStyledNativeComponent = (target: Target, options: Object, rules: RuleSet) => {\n const {\n attrs = EMPTY_ARRAY,\n displayName = generateDisplayName(target),\n ParentComponent = StyledNativeComponent,\n } = options;\n\n const isClass = !isTag(target);\n const isTargetStyledComp = isStyledComponent(target);\n\n // $FlowFixMe\n const WrappedStyledNativeComponent = React.forwardRef((props, ref) => (\n \n ));\n\n const finalAttrs =\n // $FlowFixMe\n isTargetStyledComp && target.attrs\n ? Array.prototype.concat(target.attrs, attrs).filter(Boolean)\n : attrs;\n\n // eslint-disable-next-line prefer-destructuring\n let shouldForwardProp = options.shouldForwardProp;\n\n // $FlowFixMe\n if (isTargetStyledComp && target.shouldForwardProp) {\n if (shouldForwardProp) {\n // compose nested shouldForwardProp calls\n shouldForwardProp = (prop, filterFn, elementToBeCreated) =>\n // $FlowFixMe\n target.shouldForwardProp(prop, filterFn, elementToBeCreated) &&\n options.shouldForwardProp(prop, filterFn, elementToBeCreated);\n } else {\n // eslint-disable-next-line prefer-destructuring\n shouldForwardProp = target.shouldForwardProp;\n }\n }\n\n /**\n * forwardRef creates a new interim component, which we'll take advantage of\n * instead of extending ParentComponent to create _another_ interim class\n */\n\n // $FlowFixMe\n WrappedStyledNativeComponent.attrs = finalAttrs;\n\n WrappedStyledNativeComponent.displayName = displayName;\n\n // $FlowFixMe\n WrappedStyledNativeComponent.shouldForwardProp = shouldForwardProp;\n\n // $FlowFixMe\n WrappedStyledNativeComponent.inlineStyle = new InlineStyle(\n // $FlowFixMe\n isTargetStyledComp ? target.inlineStyle.rules.concat(rules) : rules\n );\n\n // $FlowFixMe\n WrappedStyledNativeComponent.styledComponentId = 'StyledNativeComponent';\n // $FlowFixMe\n WrappedStyledNativeComponent.target = isTargetStyledComp\n ? // $FlowFixMe\n target.target\n : target;\n // $FlowFixMe\n WrappedStyledNativeComponent.withComponent = function withComponent(tag: Target) {\n const { displayName: _, componentId: __, ...optionsToCopy } = options;\n const newOptions = {\n ...optionsToCopy,\n attrs: finalAttrs,\n ParentComponent,\n };\n\n return createStyledNativeComponent(tag, newOptions, rules);\n };\n\n // $FlowFixMe\n Object.defineProperty(WrappedStyledNativeComponent, 'defaultProps', {\n get() {\n return this._foldedDefaultProps;\n },\n\n set(obj) {\n // $FlowFixMe\n this._foldedDefaultProps = isTargetStyledComp ? merge({}, target.defaultProps, obj) : obj;\n },\n });\n\n if (isClass) {\n hoist(WrappedStyledNativeComponent, (target: any), {\n // all SC-specific things should not be hoisted\n attrs: true,\n displayName: true,\n shouldForwardProp: true,\n inlineStyle: true,\n styledComponentId: true,\n target: true,\n withComponent: true,\n });\n }\n\n return WrappedStyledNativeComponent;\n };\n\n return createStyledNativeComponent;\n};\n","// @flow\nimport type { Interpolation } from '../types';\n\nexport default (\n strings: Array,\n interpolations: Array\n): Array => {\n const result = [strings[0]];\n\n for (let i = 0, len = interpolations.length; i < len; i += 1) {\n result.push(interpolations[i], strings[i + 1]);\n }\n\n return result;\n};\n","// @flow\nimport interleave from '../utils/interleave';\nimport isPlainObject from '../utils/isPlainObject';\nimport { EMPTY_ARRAY } from '../utils/empties';\nimport isFunction from '../utils/isFunction';\nimport flatten from '../utils/flatten';\nimport type { Interpolation, RuleSet, Styles } from '../types';\n\n/**\n * Used when flattening object styles to determine if we should\n * expand an array of styles.\n */\nconst addTag = arg => {\n if (Array.isArray(arg)) {\n // eslint-disable-next-line no-param-reassign\n arg.isCss = true;\n }\n return arg;\n};\n\nexport default function css(styles: Styles, ...interpolations: Array): RuleSet {\n if (isFunction(styles) || isPlainObject(styles)) {\n // $FlowFixMe\n return addTag(flatten(interleave(EMPTY_ARRAY, [styles, ...interpolations])));\n }\n\n if (interpolations.length === 0 && styles.length === 1 && typeof styles[0] === 'string') {\n // $FlowFixMe\n return styles;\n }\n\n // $FlowFixMe\n return addTag(flatten(interleave(styles, interpolations)));\n}\n","// @flow\nimport { isValidElementType } from 'react-is';\nimport css from './css';\nimport throwStyledError from '../utils/error';\nimport { EMPTY_OBJECT } from '../utils/empties';\n\nimport type { Target } from '../types';\n\nexport default function constructWithOptions(\n componentConstructor: Function,\n tag: Target,\n options: Object = EMPTY_OBJECT\n) {\n if (!isValidElementType(tag)) {\n return throwStyledError(1, String(tag));\n }\n\n /* This is callable directly as a template function */\n // $FlowFixMe: Not typed to avoid destructuring arguments\n const templateFunction = (...args) => componentConstructor(tag, options, css(...args));\n\n /* If config methods are called, wrap up a new template function and merge options */\n templateFunction.withConfig = config =>\n constructWithOptions(componentConstructor, tag, { ...options, ...config });\n\n /* Modify/inject new props at runtime */\n templateFunction.attrs = attrs =>\n constructWithOptions(componentConstructor, tag, {\n ...options,\n attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean),\n });\n\n return templateFunction;\n}\n","// @flow\nimport React, { useContext, type AbstractComponent } from 'react';\nimport hoistStatics from 'hoist-non-react-statics';\nimport { ThemeContext } from '../models/ThemeProvider';\nimport determineTheme from '../utils/determineTheme';\nimport getComponentName from '../utils/getComponentName';\n\n// NOTE: this would be the correct signature:\n// export default (\n// Component: AbstractComponent\n// ): AbstractComponent<$Diff & { theme?: any }, Instance>\n//\n// but the old build system tooling doesn't support the syntax\n\nexport default (Component: AbstractComponent<*, *>) => {\n // $FlowFixMe This should be React.forwardRef\n const WithTheme = React.forwardRef((props, ref) => {\n const theme = useContext(ThemeContext);\n // $FlowFixMe defaultProps isn't declared so it can be inferrable\n const { defaultProps } = Component;\n const themeProp = determineTheme(props, theme, defaultProps);\n\n if (process.env.NODE_ENV !== 'production' && themeProp === undefined) {\n // eslint-disable-next-line no-console\n console.warn(\n `[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class \"${getComponentName(\n Component\n )}\"`\n );\n }\n\n return ;\n });\n\n hoistStatics(WithTheme, Component);\n\n WithTheme.displayName = `WithTheme(${getComponentName(Component)})`;\n\n return WithTheme;\n};\n","// @flow\nimport { useContext } from 'react';\nimport { ThemeContext } from '../models/ThemeProvider';\n\nconst useTheme = () => useContext(ThemeContext);\n\nexport default useTheme;\n","// @flow\n\n/* eslint-disable import/no-unresolved */\nimport reactPrimitives from 'react-primitives';\n\nimport _InlineStyle from '../models/InlineStyle';\nimport _StyledNativeComponent from '../models/StyledNativeComponent';\n\nimport css from '../constructors/css';\nimport constructWithOptions from '../constructors/constructWithOptions';\nimport ThemeProvider, { ThemeConsumer, ThemeContext } from '../models/ThemeProvider';\nimport withTheme from '../hoc/withTheme';\nimport useTheme from '../hooks/useTheme';\nimport isStyledComponent from '../utils/isStyledComponent';\n\nimport type { Target } from '../types';\n\nconst InlineStyle = _InlineStyle(reactPrimitives.StyleSheet);\nconst StyledNativeComponent = _StyledNativeComponent(InlineStyle);\nconst styled = (tag: Target) => constructWithOptions(StyledNativeComponent, tag);\n\n/* React native lazy-requires each of these modules for some reason, so let's\n * assume it's for a good reason and not eagerly load them all */\nconst aliases = 'Image Text Touchable View ';\n\n/* Define a getter for each alias which simply gets the reactNative component\n * and passes it to styled */\naliases.split(/\\s+/m).forEach(alias =>\n Object.defineProperty(styled, alias, {\n enumerable: true,\n configurable: false,\n get() {\n return styled(reactPrimitives[alias]);\n },\n })\n);\n\nexport { css, isStyledComponent, ThemeProvider, ThemeConsumer, ThemeContext, withTheme, useTheme };\nexport default styled;\n"],"names":["AD_REPLACER_R","charsLength","getAlphabeticChar","code","String","fromCharCode","generateAlphabeticName","name","x","Math","abs","replace","SEED","phash","h","i","length","charCodeAt","hash","str","getComponentName","target","process","env","NODE_ENV","displayName","isFunction","test","isStatelessFunction","prototype","isReactComponent","toString","Object","call","typeOf","isStyledComponent","styledComponentId","SC_ATTR","REACT_APP_SC_ATTR","SC_ATTR_ACTIVE","SC_ATTR_VERSION","SC_VERSION","__VERSION__","SPLITTER","IS_BROWSER","window","DISABLE_SPEEDY","Boolean","SC_DISABLE_SPEEDY","REACT_APP_SC_DISABLE_SPEEDY","EMPTY_ARRAY","freeze","EMPTY_OBJECT","ERRORS","errorMap","format","a","b","c","len","push","forEach","d","throwStyledComponentsError","interpolations","Error","join","trim","makeGroupedTag","tag","DefaultGroupedTag","BASE_SIZE","groupSizes","Uint32Array","indexOfGroup","group","index","insertRules","rules","oldBuffer","oldSize","newSize","throwStyledError","set","ruleIndex","l","insertRule","clearGroup","startIndex","endIndex","deleteRule","getGroup","css","getRule","MAX_SMI","groupIDRegister","Map","reverseRegister","nextFreeGroup","getGroupForId","id","has","get","getIdForGroup","setGroupForId","SELECTOR","MARKER_RE","RegExp","outputSheet","sheet","getTag","undefined","names","size","selector","content","rehydrateNamesFromContent","split","registerName","rehydrateSheetFromTag","style","parts","textContent","part","marker","match","parseInt","rehydrateSheet","nodes","document","querySelectorAll","node","getAttribute","parentNode","removeChild","getNonce","__webpack_nonce__","ELEMENT_TYPE","findLastStyleTag","childNodes","child","nodeType","hasAttribute","makeStyleTag","head","parent","createElement","prevStyle","nextSibling","setAttribute","nonce","insertBefore","getSheet","styleSheets","ownerNode","makeTag","isServer","useCSSOMInjection","VirtualTag","CSSOMTag","TextTag","element","appendChild","createTextNode","rule","_error","cssRules","cssText","refNode","_target","splice","SHOULD_REHYDRATE","defaultOptions","StyleSheet","registerId","options","globalStyles","gs","server","reconstructWithOptions","withNames","allocateGSInstance","hasNameForId","groupNames","Set","add","clearNames","clear","clearRules","clearTag","delimiter","needle","toSheet","block","e","ruleSheet","context","selectors","parents","line","column","ns","depth","at","COMMENT_REGEX","COMPLEX_SELECTOR_PREFIX","createStylisInstance","plugins","stylis","Stylis","parsingRules","returnRulesPlugin","parsedRules","parseRulesPlugin","insertRulePlugin","_componentId","_selector","_selectorRegexp","_consecutiveSelfRefRegExp","selfReferenceReplacer","offset","string","indexOf","selfReferenceReplacementPlugin","_","lastIndexOf","use","stringifyRules","prefix","componentId","flatCSS","cssStr","reduce","acc","plugin","StyleSheetContext","React","createContext","StyleSheetConsumer","Consumer","StylisContext","StylisConsumer","masterSheet","masterStylis","Keyframes","inject","styleSheet","stylisInstance","resolvedName","getName","uppercaseCheck","uppercasePattern","msPattern","prefixAndLowerCase","char","toLowerCase","hyphenateStyleName","addUnitIfNeeded","value","unitless","startsWith","isFalsish","chunk","objToCssArray","obj","prevKey","key","hasOwnProperty","Array","isArray","isCss","hyphenate","isPlainObject","flatten","executionContext","ruleSet","result","isElement","console","warn","printed","warnOnce","message","SINGLE_QUOTE","DOUBLE_QUOTE","BACKSLASH","SLASH","NEWLINE","SPACE","FEED","TAB","CR","OPEN_SQUARE","CLOSE_SQUARE","OPEN_PARENTHESES","CLOSE_PARENTHESES","OPEN_CURLY","CLOSE_CURLY","SEMICOLON","ASTERISK","COLON","AT","RE_AT_END","RE_WORD_END","RE_BAD_BRACKET","tokenize","input","tokens","valueOf","ignore","ignoreErrors","next","quote","lines","last","escape","nextLine","nextOffset","escaped","escapePos","prev","n","pos","unclosed","what","error","slice","lastIndex","HIGHLIGHT_THEME","brackets","comment","color","terminalHighlight","Input","token","map","CssSyntaxError","source","file","reason","setMessage","captureStackTrace","showSourceCode","supportsColor","start","max","end","min","maxWidth","number","padded","gutter","spacing","defaultRaw","colon","indent","beforeDecl","beforeRule","beforeOpen","beforeClose","beforeComment","after","emptyBody","commentLeft","commentRight","capitalize","toUpperCase","Stringifier","builder","stringify","semicolon","type","root","body","raws","left","raw","right","text","decl","between","prop","rawValue","important","atrule","params","afterName","before","own","detect","first","rawCache","beforeAfter","method","walk","rawSemicolon","rawEmptyBody","rawIndent","p","rawBeforeComment","walkComments","rawBeforeDecl","walkDecls","rawBeforeRule","rawBeforeClose","rawBeforeOpen","rawColon","buf","step","cloneNode","cloned","constructor","j","Node","defaults","opts","positionBy","data","remove","stringifier","clone","overrides","cloneBefore","cloneAfter","insertAfter","replaceWith","moveTo","newParent","cleanRaws","append","moveBefore","otherNode","moveAfter","toJSON","fixed","defaultType","keepBetween","positionInside","word","removeSelf","cleanStyles","val","Declaration","Comment","Parser","Root","current","spaces","tokenizer","loop","emptyRule","other","endFile","init","Rule","bracket","pop","unclosedBracket","unknownWord","spacesFromEnd","shift","spacesFromStart","precheckMissedSemicolon","stringFrom","cache","checkMissedSemicolon","AtRule","unnamedAtrule","open","unexpectedClose","unclosedBlock","clean","all","lastTokenType","from","doubleColon","founded","parse","safe","parser","cleanSource","Container","each","callback","lastEach","indexes","walkRules","walkAtRules","children","normalize","prepend","reverse","unshift","exist","removeAll","replaceValues","pattern","props","fast","every","condition","some","sample","processed","rebuild","fix","eachInside","eachDecl","eachRule","eachAtRule","eachComment","list","separators","array","func","letter","space","comma","values","sep","Warning","opt","Result","processor","messages","lastPlugin","postcssPlugin","warning","warnings","filter","isPromise","then","LazyResult","stringified","inline","syntax","sync","onFulfilled","onRejected","async","handleError","postcssVersion","pluginName","pluginVer","runtimeVer","version","err","asyncTick","resolve","reject","promise","run","Promise","processing","Processor","concat","normalized","postcss","toResult","lazy","prevMap","sequence","path","origin","consumer","originalPositionFor","mapResolve","sourceContentFor","sourceRoot","SafeParser","buffer","safeParse","generated","InlineStyle","generateStyleObject","generateComponentId","declPairs","styleObject","transformDeclPairs","styles","create","isObject","isValidKey","mixin","mixinDeep","rest","providedTheme","defaultProps","theme","isTag","charAt","generateDisplayName","ThemeContext","ThemeConsumer","mergeTheme","outerTheme","mergedTheme","ThemeProvider","useContext","themeContext","useMemo","validAttr","StyledNativeComponent","attrs","render","transientAsProp","$as","renderAs","as","forwardedComponent","forwardedAs","forwardedRef","testID","shouldForwardProp","elementToBeRendered","generatedStyles","generateAndInjectStyles","determineTheme","isTargetTag","computedProps","propFilterFn","propsForElement","state","ref","buildExecutionContext","attrDef","resolvedAttrDef","attr","inlineStyle","setNativeProps","nativeProps","Component","createStyledNativeComponent","ParentComponent","isClass","isTargetStyledComp","WrappedStyledNativeComponent","forwardRef","finalAttrs","filterFn","elementToBeCreated","withComponent","__","optionsToCopy","newOptions","defineProperty","_foldedDefaultProps","merge","hoist","strings","addTag","arg","interleave","constructWithOptions","componentConstructor","isValidElementType","templateFunction","withConfig","config","WithTheme","themeProp","hoistStatics","useTheme","_InlineStyle","reactPrimitives","_StyledNativeComponent","styled","aliases","alias","enumerable","configurable"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;AAEA,IAAMA,aAAa,GAAG,UAAtB;AAEA;;;AAEA,IAAMC,WAAW,GAAG,EAApB;AAEA;;AACA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,IAAD;AAAA,SACxBC,MAAM,CAACC,YAAP,CAAoBF,IAAI,IAAIA,IAAI,GAAG,EAAP,GAAY,EAAZ,GAAiB,EAArB,CAAxB,CADwB;AAAA,CAA1B;AAGA;;;AACe,SAASG,sBAAT,CAAgCH,IAAhC,EAAsD;AACnE,MAAII,IAAI,GAAG,EAAX;AACA,MAAIC,CAAJ;AAEA;;AACA,OAAKA,CAAC,GAAGC,IAAI,CAACC,GAAL,CAASP,IAAT,CAAT,EAAyBK,CAAC,GAAGP,WAA7B,EAA0CO,CAAC,GAAIA,CAAC,GAAGP,WAAL,GAAoB,CAAlE,EAAqE;AACnEM,IAAAA,IAAI,GAAGL,iBAAiB,CAACM,CAAC,GAAGP,WAAL,CAAjB,GAAqCM,IAA5C;AACD;;AAED,SAAO,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