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,sGAAsG;IACtG,iFAAiF;IACjF,+DAA+D;IAC/D,aAAa;IACb,2BAA2B;IAC3B,IAAI,AAAC,CAAA,IAAI,IAAI,QAAQ,IAAI,KAAK,UAAS,KAAM,QAAQ,GAAG,CAAC,QAAQ,KAAK,QACpE,MAAM,IAAI,MAAM;IAElB,IAAI,YAAY,qDAA+B,KAAK;IACpD,MAAM,CAAC,OAAO,EAAE,MAAM;GACrB,EAAE,UAAU;EACb,EAAE,IAAI;;CAEP,CAAC;IAEA,yEAAyE;IACzE,IAAI,CAAC,MAAM,UAAU,CAAC,OACpB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,CAAC,GAAG;IAGlC,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,YACnC,IAAI,CAAC,QAAQ,CAAC;QACZ,MAAM;QACN,SAAS;IACX;IAEF,OAAO;AACT;AAEO,SAAS,0CAAqC,GAAW;IAC9D,sGAAsG;IACtG,iFAAiF;IACjF,+DAA+D;IAC/D,aAAa;IACb,2BAA2B;IAC3B,IAAI,AAAC,CAAA,IAAI,IAAI,QAAQ,IAAI,KAAK,UAAS,KAAM,QAAQ,GAAG,CAAC,QAAQ,KAAK,QACpE,MAAM,IAAI,MAAM;IAElB,IAAI,OAAO,qDAA+B,KAAK;IAC/C,MAAM,CAAC,WAAW,EAAE,KAAK;EACzB,EAAE,IAAI;CACP,CAAC;IACA,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,YACnC,IAAI,CAAC,QAAQ,CAAC;QACZ,MAAM;QACN,SAAS;IACX;IAEF,OAAO;AACT","sources":["packages/@react-spectrum/s2/style/style-macro.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type {Condition, CSSProperties, CSSValue, CustomValue, Property, PropertyValueDefinition, PropertyValueMap, RenderProps, ShorthandProperty, StyleFunction, StyleValue, Theme, ThemeProperties, Value} from './types';\nimport fs from 'fs';\nimport * as propertyInfo from './properties.json';\n\n// Postfix all class names with version for now.\nconst json = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8'));\nconst POSTFIX = json.version.includes('nightly') ? json.version.match(/-nightly-(.*)/)[1] : json.version.replace(/[0.]/g, '');\n\nexport class ArbitraryProperty<T extends Value> implements Property<T> {\n property: string;\n toCSS: (value: T) => CSSValue;\n\n constructor(property: string, toCSS?: (value: T) => CSSValue) {\n this.property = property;\n this.toCSS = toCSS || ((value) => String(value));\n }\n\n get cssProperties(): string[] {\n return [this.property];\n }\n\n toCSSValue(value: T): PropertyValueDefinition<Value> {\n return this.toCSS(value);\n }\n\n toCSSProperties(customProperty: string | null, value: PropertyValueDefinition<Value>): PropertyValueDefinition<[CSSProperties]> {\n return mapConditionalValue(value, value => [{[customProperty || this.property]: String(value)}]);\n }\n}\n\nexport class MappedProperty<T extends CSSValue> extends ArbitraryProperty<T> implements Property<T> {\n mapping: PropertyValueMap<T> | string[];\n\n constructor(property: string, mapping: PropertyValueMap<T> | string[]) {\n super(property);\n this.mapping = mapping;\n }\n\n toCSSValue(value: T): PropertyValueDefinition<Value> {\n if (Array.isArray(this.mapping)) {\n if (!this.mapping.includes(String(value))) {\n throw new Error('Invalid style value: ' + value);\n }\n return value;\n } else {\n let res = this.mapping[String(value)];\n if (res == null) {\n throw new Error('Invalid style value: ' + value);\n }\n return res;\n }\n }\n}\n\nexport type Color<C extends string> = C | `${string}/${number}`;\nexport class ColorProperty<C extends string> extends MappedProperty<C> implements Property<Color<C>> {\n toCSSValue(value: Color<C>): PropertyValueDefinition<Value> {\n let [color, opacity] = value.split('/');\n return mapConditionalValue(this.mapping[color], value => {\n return opacity ? `rgb(from ${value} r g b / ${opacity}%)` : value;\n });\n }\n}\n\nexport type LengthPercentageUnit = '%' | 'vw' | 'svw' | 'dvw' | 'vh' | 'svh' | 'dvh' | 'vmin' | 'svmin' | 'dvmin' | 'vmax' | 'svmax' | 'dvmax' | 'cqw' | 'cqh' | 'cqmin' | 'cqmax';\nexport type LengthPercentage = `${number}${LengthPercentageUnit}`;\n\nexport class PercentageProperty<T extends CSSValue> extends MappedProperty<T> implements Property<T | LengthPercentage> {\n constructor(property: string, mapping: PropertyValueMap<T> | string[]) {\n super(property, mapping);\n }\n\n toCSSValue(value: T | LengthPercentage): PropertyValueDefinition<Value> {\n if (typeof value === 'string' && /^-?\\d+(?:\\.\\d+)?(%|vw|svw|dvw|vh|svh|dvh|vmin|svmin|dvmin|vmax|svmax|dvmax|cqw|cqh|cqmin|cqmax)$/.test(value)) {\n return value;\n }\n\n return super.toCSSValue(value as T);\n }\n}\n\nexport class SizingProperty<T extends CSSValue> extends PercentageProperty<T> implements Property<T | number | LengthPercentage> {\n numberToCSS: (value: number) => string;\n\n constructor(property: string, mapping: PropertyValueMap<T> | string[], numberToCSS: (value: number) => string) {\n super(property, mapping);\n this.numberToCSS = numberToCSS;\n }\n\n toCSSValue(value: T | LengthPercentage | number): PropertyValueDefinition<Value> {\n if (typeof value === 'number') {\n return value === 0 ? '0px' : this.numberToCSS(value);\n }\n\n return super.toCSSValue(value);\n }\n}\n\nexport class ExpandedProperty<T extends Value> implements Property<T> {\n cssProperties: string[];\n mapping: Property<T> | null;\n expand: (v: T | CSSValue) => CSSProperties;\n\n constructor(properties: string[], expand: (v: T | CSSValue) => CSSProperties, mapping?: Property<T> | PropertyValueMap<CSSValue>) {\n this.cssProperties = properties;\n this.expand = expand;\n if (mapping instanceof MappedProperty) {\n this.mapping = mapping;\n } else if (mapping) {\n this.mapping = new MappedProperty<any>(properties[0], mapping as any);\n } else {\n this.mapping = null;\n }\n }\n\n toCSSValue(value: T): PropertyValueDefinition<Value> {\n if (!this.mapping) {\n return value;\n }\n\n return this.mapping.toCSSValue(value);\n }\n\n toCSSProperties(customProperty: string | null, value: PropertyValueDefinition<T>): PropertyValueDefinition<[CSSProperties]> {\n if (customProperty) {\n throw new Error('Style properties that expand into multiple CSS properties cannot be set as CSS variables.');\n }\n return mapConditionalValue(value, value => [this.expand(value)]);\n }\n}\n\nfunction mapConditionalValue<T, U>(value: PropertyValueDefinition<T>, fn: (value: T) => U): PropertyValueDefinition<U> {\n if (typeof value === 'object' && !Array.isArray(value)) {\n let res: PropertyValueDefinition<U> = {};\n for (let condition in value) {\n res[condition] = mapConditionalValue((value as any)[condition], fn);\n }\n return res;\n } else {\n return fn(value);\n }\n}\n\nfunction mapConditionalShorthand<T, C extends string, R extends RenderProps<string>>(value: PropertyValueDefinition<T>, fn: ShorthandProperty<T>): {[property: string]: StyleValue<Value, C, R>} {\n if (typeof value === 'object') {\n let res = {};\n for (let condition in value) {\n let properties = mapConditionalShorthand(value[condition], fn);\n for (let property in properties) {\n res[property] ??= {};\n res[property][condition] = properties[property];\n }\n }\n return res;\n } else {\n return fn(value);\n }\n}\n\nexport function parseArbitraryValue(value: Value): string | undefined {\n if (typeof value === 'string' && value.startsWith('--')) {\n return `var(${value})`;\n } else if (typeof value === 'string' && value[0] === '[' && value[value.length - 1] === ']') {\n return value.slice(1, -1);\n } else if (\n typeof value === 'string' && (\n /^(var|calc|min|max|clamp|round|mod|rem|sin|cos|tan|asin|acos|atan|atan2|pow|sqrt|hypot|log|exp|abs|sign)\\(.+\\)$/.test(value) || \n /^(inherit|initial|unset)$/.test(value)\n )\n ) {\n return value;\n }\n}\n\nfunction shortCSSPropertyName(property: string) {\n return propertyInfo.properties[property] ?? generateArbitraryValueSelector(property, true);\n}\n\nfunction classNamePrefix(property: string, cssProperty: string) {\n let className = propertyInfo.properties[cssProperty];\n if (className && property === '--' + className) {\n return '-' + className + '_-';\n }\n\n if (className && !property.startsWith('--')) {\n return className;\n }\n\n return '-' + generateArbitraryValueSelector(property, true) + '-';\n}\n\ninterface MacroContext {\n addAsset(asset: {type: string, content: string}): void\n}\n\nexport function createTheme<T extends Theme>(theme: T): StyleFunction<ThemeProperties<T>, 'default' | Extract<keyof T['conditions'], string>> {\n let properties = new Map<string, Property<any>>(Object.entries(theme.properties).map(([k, v]) => {\n if (!Array.isArray(v) && v.cssProperties) {\n return [k, v as Property<any>];\n }\n\n return [k, new MappedProperty(k, v as any)];\n }));\n\n let dependencies = new Set<string>();\n let hasConditions = false;\n return function style(this: MacroContext | void, style, allowedOverrides?: readonly string[]) {\n // Check if `this` is undefined, which means style was not called as a macro but as a normal function.\n // We also check if this is globalThis, which happens in non-strict mode bundles.\n // Also allow style to be called as a normal function in tests.\n // @ts-ignore\n // eslint-disable-next-line\n if ((this == null || this === globalThis) && process.env.NODE_ENV !== 'test') {\n throw new Error('The style macro must be imported with {type: \"macro\"}.');\n }\n\n // Generate rules for each property.\n let rules = new Map<string, Rule>();\n let values = new Map();\n dependencies.clear();\n let usedPriorities = 0;\n let setRules = (key: string, value: [number, Rule[]]) => {\n usedPriorities = Math.max(usedPriorities, value[0]);\n rules.set(key, new GroupRule(value[1]));\n };\n\n hasConditions = false;\n for (let key in style) {\n let value = style[key]!;\n let themeProperty = key;\n values.set(key, value);\n\n // Get the type of custom properties in the theme.\n if (key.startsWith('--')) {\n themeProperty = value.type;\n value = value.value;\n }\n\n // Expand shorthands to longhands so that merging works as expected.\n if (theme.shorthands[key]) {\n let shorthand = theme.shorthands[key];\n if (typeof shorthand === 'function') {\n let expanded = mapConditionalShorthand(value, shorthand);\n for (let k in expanded) {\n let v = expanded[k];\n values.set(k, v);\n setRules(k, compileValue(k, k, v));\n }\n } else {\n for (let prop of shorthand) {\n values.set(prop, value);\n setRules(prop, compileValue(prop, prop, value));\n }\n }\n } else if (themeProperty in theme.properties) {\n setRules(key, compileValue(key, themeProperty, value));\n }\n }\n\n // For properties referenced by self(), rewrite the declarations to assign\n // to an intermediary custom property so we can access the value.\n for (let dep of dependencies) {\n let value = values.get(dep);\n if (value != null) {\n if (!(dep in theme.properties)) {\n throw new Error(`Unknown dependency ${dep}`);\n }\n let prop = properties.get(dep)!;\n let name = `--${shortCSSPropertyName(prop.cssProperties[0])}`;\n // Could potentially use @property to prevent the var from inheriting in children.\n setRules(name, compileValue(name, dep, value));\n setRules(dep, compileValue(dep, dep, name));\n }\n }\n dependencies.clear();\n\n let css = '';\n\n // Declare layers for each priority ahead of time so the order is always correct.\n css += '@layer ';\n let first = true;\n for (let i = 0; i <= usedPriorities; i++) {\n if (first) {\n first = false;\n } else {\n css += ', ';\n }\n css += layerName(generateName(i, true));\n }\n css += ';\\n\\n';\n\n // If allowed overrides are provided, generate code to match the input override string and include only allowed classes.\n // Also generate a variable for each overridable property that overlaps with the style definition. If those are defined,\n // the defaults from the style definition are omitted.\n let allowedOverridesSet = new Set<string>();\n let js = 'let rules = \" \";\\n';\n if (allowedOverrides?.length) {\n for (let property of allowedOverrides) {\n let shorthand = theme.shorthands[property];\n let props = Array.isArray(shorthand) ? shorthand : [property];\n for (let property of props) {\n if (property.startsWith('--')) {\n allowedOverridesSet.add(property);\n continue;\n }\n \n let prop = properties.get(property);\n if (!prop) {\n throw new Error(`Invalid property ${property} in allowedOverrides`);\n }\n for (let property of prop.cssProperties) {\n allowedOverridesSet.add(property);\n }\n }\n }\n\n let loop = '';\n for (let property of rules.keys()) {\n let prop = properties.get(property);\n if (prop) {\n for (let property of prop.cssProperties) {\n if (property && allowedOverridesSet.has(property)) {\n let selector = classNamePrefix(property, property);\n let p = property.replace('--', '__');\n js += `let ${p} = false;\\n`;\n loop += ` if (p[1] === ${JSON.stringify(selector)}) ${p} = true;\\n`;\n }\n }\n } else if (property.startsWith('--') && allowedOverridesSet.has(property)) {\n let selector = classNamePrefix(property, property);\n let p = property.replace('--', '__');\n js += `let ${p} = false;\\n`;\n loop += ` if (p[1] === ${JSON.stringify(selector)}) ${p} = true;\\n`;\n }\n }\n\n let regex = `/(?:^|\\\\s)(${[...allowedOverridesSet].map(p => classNamePrefix(p, p)).join('|')})[^\\\\s]+/g`;\n if (loop) {\n js += `let matches = (overrides || '').matchAll(${regex});\\n`;\n js += 'for (let p of matches) {\\n';\n js += loop;\n js += ' rules += p[0];\\n';\n js += '}\\n';\n } else {\n js += `rules += ((overrides || '').match(${regex}) || []).join('')\\n`;\n }\n }\n\n // Generate JS and CSS for each rule.\n let isStatic = !(hasConditions || allowedOverrides);\n let className = '';\n let rulesByLayer = new Map<string, string[]>();\n let rootRule = new GroupRule([...rules.values()]);\n if (isStatic) {\n className += rootRule.getStaticClassName();\n } else {\n js += rootRule.toJS(allowedOverridesSet) + '\\n';\n }\n rootRule.toCSS(rulesByLayer);\n\n for (let [layer, rules] of rulesByLayer) {\n css += `@layer ${layerName(layer)} {\\n`;\n css += rules.join('\\n\\n');\n css += '}\\n\\n';\n }\n\n if (this && typeof this.addAsset === 'function') {\n this.addAsset({\n type: 'css',\n content: css\n });\n }\n\n if (isStatic) {\n return className;\n }\n\n js += 'return rules;';\n if (allowedOverrides) {\n return new Function('props', 'overrides', js) as any;\n }\n return new Function('props', js) as any;\n };\n\n function compileValue(property: string, themeProperty: string, value: StyleValue<Value, Condition<T>, any>) {\n return conditionalToRules(value as any, 0, new Set(), new Set(), (value, priority, conditions, skipConditions) => {\n return compileRule(property, themeProperty, value, priority, conditions, skipConditions);\n });\n }\n\n function conditionalToRules<P extends CustomValue | any[]>(\n value: PropertyValueDefinition<P>,\n parentPriority: number,\n currentConditions: Set<string>,\n skipConditions: Set<string>,\n fn: (value: P, priority: number, conditions: Set<string>, skipConditions: Set<string>) => [number, Rule[]]\n ): [number, Rule[]] {\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n let rules: Rule[] = [];\n\n // Later conditions in parent rules override conditions in child rules.\n let subSkipConditions = new Set([...skipConditions, ...Object.keys(value)]);\n\n // Skip the default condition if we're already filtering by one of the other possible conditions.\n // For example, if someone specifies `dark: 'gray-400'`, only include the dark version of `gray-400` from the theme.\n let skipDefault = Object.keys(value).some(k => currentConditions.has(k));\n let wasCSSCondition = false;\n let priority = parentPriority;\n\n for (let condition in value) {\n if (skipConditions.has(condition) || (condition === 'default' && skipDefault)) {\n continue;\n }\n subSkipConditions.delete(condition);\n\n let val = value[condition];\n\n // If a theme condition comes after runtime conditions, create a new grouping.\n // This makes the CSS class unconditional so it appears outside the `else` block in the JS.\n // The @layer order in the generated CSS will ensure that it overrides classes applied by runtime conditions.\n let isCSSCondition = condition in theme.conditions || /^[@:]/.test(condition);\n if (!wasCSSCondition && isCSSCondition && rules.length) {\n rules = [new GroupRule(rules)];\n }\n wasCSSCondition = isCSSCondition;\n\n // Increment the current priority whenever we see a new CSS condition.\n if (isCSSCondition) {\n priority++;\n }\n\n // If this is a runtime condition, inherit the priority from the parent rule.\n // Otherwise, use the current maximum of the parent and current priorities.\n let rulePriority = isCSSCondition ? priority : parentPriority;\n\n if (condition === 'default' || isCSSCondition || /^is[A-Z]/.test(condition) || /^allows[A-Z]/.test(condition)) {\n let subConditions = currentConditions;\n if (isCSSCondition) {\n subConditions = new Set([...currentConditions, condition]);\n }\n let [subPriority, subRules] = conditionalToRules(val, rulePriority, subConditions, subSkipConditions, fn);\n rules.push(...compileCondition(currentConditions, condition, priority, subRules));\n priority = Math.max(priority, subPriority);\n } else if (val && typeof val === 'object' && !Array.isArray(val)) {\n for (let key in val) {\n let [subPriority, subRules] = conditionalToRules(val[key], rulePriority, currentConditions, subSkipConditions, fn);\n rules.push(...compileCondition(currentConditions, `${condition} === ${JSON.stringify(key)}`, priority, subRules));\n priority = Math.max(priority, subPriority);\n }\n }\n }\n return [priority, rules];\n } else {\n // @ts-ignore - broken in non-strict?\n return fn(value, parentPriority, currentConditions, skipConditions);\n }\n }\n\n function compileCondition(conditions: Set<string>, condition: string, priority: number, rules: Rule[]): Rule[] {\n if (condition === 'default' || conditions.has(condition)) {\n return [new GroupRule(rules)];\n }\n\n if (condition in theme.conditions || /^[@:]/.test(condition)) {\n // Conditions starting with : are CSS pseudo classes. Nest them inside the parent rule.\n let prelude = theme.conditions[condition] || condition;\n if (prelude.startsWith(':')) {\n for (let rule of rules) {\n rule.addPseudo(prelude);\n }\n\n return [new GroupRule(rules, generateName(priority, true))];\n }\n\n // Otherwise, wrap the rule in the condition (e.g. @media).\n // Top level layer is based on the priority of the rule, not the condition.\n // Also group in a sub-layer based on the condition so that lightningcss can more effectively deduplicate rules.\n let layer = `${generateName(priority, true)}.${propertyInfo.conditions[theme.conditions[condition] || condition] || generateArbitraryValueSelector(condition, true)}`;\n return [new AtRule(rules, prelude, layer)];\n }\n\n hasConditions = true;\n return [new ConditionalRule(rules, condition)];\n }\n\n function compileRule(property: string, themeProperty: string, value: Value, priority: number, conditions: Set<string>, skipConditions: Set<string>): [number, Rule[]] {\n let propertyFunction = properties.get(themeProperty);\n if (propertyFunction) {\n // Expand value to conditional CSS values, and then to rules.\n let arbitrary = parseArbitraryValue(value);\n let cssValue = arbitrary ? arbitrary : propertyFunction.toCSSValue(value);\n let cssProperties = propertyFunction.toCSSProperties(property.startsWith('--') ? property : null, cssValue);\n\n return conditionalToRules(cssProperties, priority, conditions, skipConditions, (value, priority, conditions) => {\n let [obj] = value;\n let rules: Rule[] = [];\n for (let key in obj) {\n let k = key as any;\n let value = obj[k];\n if (value === undefined) {\n continue;\n }\n if (typeof value === 'string') {\n // Replace self() references with variables and track the dependencies.\n value = value.replace(/self\\(([a-zA-Z]+)/g, (_, v) => {\n let prop = properties.get(v);\n if (!prop) {\n throw new Error(`self(${v}) is invalid. ${v} is not a known property.`);\n }\n let cssProperties = prop.cssProperties;\n if (cssProperties.length !== 1) {\n throw new Error(`self(${v}) is not supported. ${v} expands to multiple CSS properties.`);\n }\n dependencies.add(v);\n return `var(--${shortCSSPropertyName(cssProperties[0])}`;\n });\n }\n\n // Generate selector. This consists of three parts: property, conditions, value.\n let cssProperty = key;\n if (property.startsWith('--')) {\n cssProperty = propertyFunction.cssProperties[0];\n }\n\n let className = classNamePrefix(key, cssProperty);\n if (conditions.size > 0) {\n for (let condition of conditions) {\n className += propertyInfo.conditions[theme.conditions[condition] || condition] || generateArbitraryValueSelector(condition);\n }\n }\n\n if (cssProperty !== key) {\n className += shortCSSPropertyName(cssProperty);\n }\n\n className += propertyInfo.values[cssProperty]?.[String(value)] ?? generateArbitraryValueSelector(String(value));\n className += POSTFIX;\n rules.push(new StyleRule(className, key, String(value)));\n }\n\n return [0, rules];\n });\n } else {\n throw new Error('Unknown property ' + themeProperty);\n }\n }\n}\n\nfunction kebab(property: string) {\n if (property.startsWith('--')) {\n return property;\n }\n return property.replace(/([a-z])([A-Z])/g, (_, a, b) => `${a}-${b.toLowerCase()}`);\n}\n\n// Generate a class name from a number, e.g. index within the theme.\n// This maps to an alphabet containing lower case letters, upper case letters, and numbers.\n// For numbers larger than 62, an underscore is prepended.\n// This encoding allows easy parsing to enable runtime merging by property.\nfunction generateName(index: number, atStart = false): string {\n if (index < 26) {\n // lower case letters\n return String.fromCharCode(index + 97);\n }\n\n if (index < 52) {\n // upper case letters\n return String.fromCharCode((index - 26) + 65);\n }\n\n if (index < 62 && !atStart) {\n // numbers\n return String.fromCharCode((index - 52) + 48);\n }\n\n return '_' + generateName(index - (atStart ? 52 : 62));\n}\n\n// For arbitrary values, we use a hash of the string to generate the class name.\nfunction generateArbitraryValueSelector(v: string, atStart = false) {\n let c = toBase62(hash(v));\n if (atStart && /^[0-9]/.test(c)) {\n c = `_${c}`;\n }\n return c;\n}\n\nfunction toBase62(value: number) {\n if (value === 0) {\n return generateName(value);\n }\n\n let res = '';\n while (value) {\n let remainder = value % 62;\n res += generateName(remainder);\n value = Math.floor((value - remainder) / 62);\n }\n\n return res;\n}\n\n// djb2 hash function.\n// http://www.cse.yorku.ca/~oz/hash.html\nfunction hash(v: string) {\n let hash = 5381;\n for (let i = 0; i < v.length; i++) {\n hash = ((hash << 5) + hash) + v.charCodeAt(i) >>> 0;\n }\n return hash;\n}\n\nfunction layerName(name: string) {\n // All of our layers should be sub-layers of a single parent layer, so that\n // the unsafe overrides layer always comes after.\n return `_.${name}`;\n}\n\ninterface Rule {\n addPseudo(prelude: string): void,\n getStaticClassName(): string,\n toCSS(rulesByLayer: Map<string, string[]>, preludes?: string[], layer?: string): void,\n toJS(allowedOverridesSet: Set<string>, indent?: string): string\n}\n\n/** A CSS style rule. */\nclass StyleRule implements Rule {\n className: string;\n pseudos: string;\n property: string;\n value: string;\n\n constructor(className: string, property: string, value: string) {\n this.className = className;\n this.pseudos = '';\n this.property = property;\n this.value = value;\n }\n\n addPseudo(prelude: string) {\n this.pseudos += prelude;\n }\n\n getStaticClassName(): string {\n return ' ' + this.className;\n }\n\n toCSS(rulesByLayer: Map<string, string[]>, preludes: string[] = [], layer = 'a') {\n let prelude = `.${this.className}${this.pseudos}`;\n preludes.push(prelude);\n\n // Nest rule in our stack of preludes (e.g. media queries/selectors).\n let content = ' ';\n preludes.forEach((p, i) => {\n content += `${p} {\\n${' '.repeat((i + 2) * 2)}`;\n });\n content += `${kebab(this.property)}: ${this.value};\\n`;\n preludes.map((_, i) => {\n content += `${' '.repeat((preludes.length - i) * 2)}}\\n`;\n });\n\n // Group rule into the appropriate layer.\n let rules = rulesByLayer.get(layer);\n if (!rules) {\n rules = [];\n rulesByLayer.set(layer, rules);\n }\n rules.push(content);\n preludes.pop();\n }\n\n toJS(allowedOverridesSet: Set<string>, indent = ''): string {\n let res = '';\n if (allowedOverridesSet.has(this.property)) {\n res += `${indent}if (!${this.property.replace('--', '__')}) `;\n }\n res += `${indent}rules += ' ${this.className}';`;\n return res;\n }\n}\n\n/** Base class for rules that contain other rules. */\nclass GroupRule implements Rule {\n rules: Rule[];\n layer: string | null;\n\n constructor(rules: Rule[], layer?: string) {\n this.rules = rules;\n this.layer = layer ?? null;\n }\n\n addPseudo(prelude: string) {\n for (let rule of this.rules) {\n rule.addPseudo(prelude);\n }\n }\n\n getStaticClassName(): string {\n return this.rules.map(rule => rule.getStaticClassName()).join('');\n }\n\n toCSS(rulesByLayer: Map<string, string[]>, preludes?: string[], layer?: string) {\n for (let rule of this.rules) {\n rule.toCSS(rulesByLayer, preludes, this.layer || layer);\n }\n }\n\n toJS(allowedOverridesSet: Set<string>, indent = ''): string {\n let rules = this.rules.slice();\n let conditional = rules.filter(rule => rule instanceof ConditionalRule).reverse().map((rule, i) => {\n return `${i > 0 ? ' else ' : ''}${rule.toJS(allowedOverridesSet, indent)}`;\n });\n\n let elseCases = rules.filter(rule => !(rule instanceof ConditionalRule)).map(rule => rule.toJS(allowedOverridesSet, indent));\n if (conditional.length && elseCases.length) {\n return `${conditional.join('')} else {\\n${indent} ${elseCases.join('\\n' + indent + ' ')}\\n${indent}}`;\n }\n\n if (conditional.length) {\n return conditional.join('');\n }\n\n return elseCases.join('\\n' + indent);\n }\n}\n\n/** A rule that applies conditionally in CSS (e.g. @media). */\nclass AtRule extends GroupRule {\n prelude: string;\n\n constructor(rules: Rule[], prelude: string, layer: string) {\n super(rules, layer);\n this.prelude = prelude;\n }\n\n toCSS(rulesByLayer: Map<string, string[]>, preludes: string[] = [], layer?: string): void {\n preludes.push(this.prelude);\n super.toCSS(rulesByLayer, preludes, layer);\n preludes?.pop();\n }\n}\n\n/** A rule that applies conditionally at runtime. */\nclass ConditionalRule extends GroupRule {\n condition: string;\n\n constructor(rules: Rule[], condition: string) {\n super(rules);\n this.condition = condition;\n }\n\n getStaticClassName(): string {\n throw new Error('Conditional rules cannot be compiled to a static class name. This is a bug.');\n }\n\n toJS(allowedOverridesSet: Set<string>, indent = ''): string {\n return `${indent}if (props.${this.condition}) {\\n${super.toJS(allowedOverridesSet, indent + ' ')}\\n${indent}}`;\n }\n}\n\nexport function raw(this: MacroContext | void, css: string, layer = '_.a'): string {\n // Check if `this` is undefined, which means style was not called as a macro but as a normal function.\n // We also check if this is globalThis, which happens in non-strict mode bundles.\n // Also allow style to be called as a normal function in tests.\n // @ts-ignore\n // eslint-disable-next-line\n if ((this == null || this === globalThis) && process.env.NODE_ENV !== 'test') {\n throw new Error('The raw macro must be imported with {type: \"macro\"}.');\n }\n let className = generateArbitraryValueSelector(css, true);\n css = `@layer ${layer} {\n .${className} {\n ${css}\n }\n}`;\n\n // Ensure layer is always declared after the _ layer used by style macro.\n if (!layer.startsWith('_.')) {\n css = `@layer _, ${layer};\\n` + css;\n }\n\n if (this && typeof this.addAsset === 'function') {\n this.addAsset({\n type: 'css',\n content: css\n });\n }\n return className;\n}\n\nexport function keyframes(this: MacroContext | void, css: string): string {\n // Check if `this` is undefined, which means style was not called as a macro but as a normal function.\n // We also check if this is globalThis, which happens in non-strict mode bundles.\n // Also allow style to be called as a normal function in tests.\n // @ts-ignore\n // eslint-disable-next-line\n if ((this == null || this === globalThis) && process.env.NODE_ENV !== 'test') {\n throw new Error('The keyframes macro must be imported with {type: \"macro\"}.');\n }\n let name = generateArbitraryValueSelector(css, true);\n css = `@keyframes ${name} {\n ${css}\n}`;\n if (this && typeof this.addAsset === 'function') {\n this.addAsset({\n type: 'css',\n content: css\n });\n }\n return name;\n}\n"],"names":[],"version":3,"file":"style-macro.cjs.map","sourceRoot":"../../../../../"}