@thejaredwilcurt/csslop 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/package.json +11 -5
- package/site/assets/CSSLOP-KqihQ_En.js +2 -0
- package/site/assets/CSSLOP-KqihQ_En.js.map +1 -0
- package/site/assets/codemirror-BJgHO250.js +13 -0
- package/site/assets/codemirror-BJgHO250.js.map +1 -0
- package/site/assets/{codemirror-lang-css-CnXScSYC.js → codemirror-lang-css-BZgt8Gl_.js} +2 -2
- package/site/assets/{codemirror-lang-css-CnXScSYC.js.map → codemirror-lang-css-BZgt8Gl_.js.map} +1 -1
- package/site/assets/index-9t3YlATS.js +3 -0
- package/site/assets/index-9t3YlATS.js.map +1 -0
- package/site/assets/lib-B1rwTJiT.js +2 -0
- package/site/assets/lib-B1rwTJiT.js.map +1 -0
- package/site/real/30days30submits-18-v0.0.0.css +1 -0
- package/site/real/3dtransforms-v0.0.0.css +1 -0
- package/site/real/960.gs-v0.0.0.css +1 -0
- package/site/real/98-v0.1.18.css +1 -0
- package/site/real/academicons-v1.9.6.css +1 -0
- package/site/real/admin-lte-v4.0.0.css +1 -0
- package/site/real/adminhub-v1.0.0.css +594 -0
- package/site/real/amoled-cord-v5.0.11.css +1 -0
- package/site/real/animate-v4.1.1.css +1 -0
- package/site/real/animating-hamburger-icons-v0.1.0.css +1 -0
- package/site/real/animo-v1.0.3.css +1 -0
- package/site/real/animsition-v4.0.2.css +1 -0
- package/site/real/awesome-bootstrap-checkbox-v0.3.7.css +1 -0
- package/site/real/balloon-v1.0.0.css +1 -0
- package/site/real/basscss-v8.1.0.css +1 -0
- package/site/real/beercss-v4.0.21.css +1 -0
- package/site/real/blooger-website-v0.0.0.css +583 -0
- package/site/real/blue-topaz-obsidian-v6.0.0.css +1 -0
- package/site/real/boilerform-v1.1.2.css +1 -0
- package/site/real/bojler-v3.2.1.css +1 -0
- package/site/real/bootplus-v1.0.5.css +1 -0
- package/site/real/bootstrap-4-v4.6.2.css +1 -0
- package/site/real/bootstrap-5-v5.3.8.css +1 -0
- package/site/real/bttn-v0.2.4.css +1 -0
- package/site/real/bulma-v1.0.4.css +1 -0
- package/site/real/carbon-v1.107.0.css +1 -0
- package/site/real/cardinal-v3.7.0.css +1 -0
- package/site/real/checka11y-v2.5.0.css +1632 -0
- package/site/real/chota-v0.9.2.css +1 -0
- package/site/real/cirrus-v0.8.0.css +1 -0
- package/site/real/classless-v1.0.0.css +1 -0
- package/site/real/cleanslate-v0.10.1.css +1 -0
- package/site/real/clickeffects-v0.0.0.css +1548 -0
- package/site/real/codyframe-v4.0.9.css +1 -0
- package/site/real/colofilter-v0.0.0.css +1 -0
- package/site/real/concise-v4.0.1.css +1 -0
- package/site/real/crayon-v1.0.0.css +277 -0
- package/site/real/crookedstylesheets-v0.0.0.css +1 -0
- package/site/real/cs16-v0.0.0.css +1 -0
- package/site/real/css-diner-v0.0.0.css +1 -0
- package/site/real/css-extras-v0.4.0.css +1 -0
- package/site/real/css-social-buttons-v1.4.0.css +1 -0
- package/site/real/css-spinners-v2.2.0.css +1 -0
- package/site/real/css3-buttons-v0.0.0.css +1 -0
- package/site/real/cssco-v1.1.0.css +1 -0
- package/site/real/cssicon-v1.0.0.css +1 -0
- package/site/real/cssplot-v0.0.0.css +1 -0
- package/site/real/csszengarden-215-v0.0.0.css +1 -0
- package/site/real/cutestrap1-v1.3.1.css +1 -0
- package/site/real/cutestrap2-v2.0.0.css +1 -0
- package/site/real/destyle-v4.0.1.css +1 -0
- package/site/real/devices-v0.2.0.css +1 -0
- package/site/real/doxygen-awesome-v2.4.2.css +1 -0
- package/site/real/effeckt-v0.5.0.css +1 -0
- package/site/real/elegantfin-v25.12.31.css +1 -0
- package/site/real/enferno-v13.1.1.css +1 -0
- package/site/real/evil-v0.0.0.css +1 -0
- package/site/real/facebook-buttons-v1.0.0.css +1 -0
- package/site/real/ff-ultima-v4.3.0.css +1 -0
- package/site/real/fileicon-v0.1.1.css +1 -0
- package/site/real/finimalism-v12.0.0.css +6332 -0
- package/site/real/firefox-one-v3.7.0.css +174 -0
- package/site/real/firefox-uwp-style-v0.0.0.css +1608 -0
- package/site/real/flakes-v1.0.1.css +1 -0
- package/site/real/flex-layout-attribute-v1.0.3.css +1 -0
- package/site/real/fluentbird-v1.1.2.css +1 -0
- package/site/real/fomantic-v2.9.4.css +1 -0
- package/site/real/font-awesome-v7.2.0.css +1 -0
- package/site/real/foundation-v6.9.0.css +1 -0
- package/site/real/freebies-v0.0.0.css +1 -0
- package/site/real/furatto-v3.1.1.css +1 -0
- package/site/real/gallery-v1.0.2.css +1 -0
- package/site/real/github-dark-v6.3.0.css +1 -0
- package/site/real/github-markdown-v5.9.0.css +1 -0
- package/site/real/github-windows-v0.6.0.css +1 -0
- package/site/real/gitweb-theme-v0.0.0.css +1 -0
- package/site/real/google-type-v0.0.0.css +1 -0
- package/site/real/gridism-v0.2.2.css +1 -0
- package/site/real/gridlex-v2.7.1.css +1 -0
- package/site/real/gumby-v2.6.4.css +1 -0
- package/site/real/gutenberg-v0.7.0.css +1 -0
- package/site/real/halfmoon-v2.0.2.css +1 -0
- package/site/real/halfstyle-v2.0.2.css +1 -0
- package/site/real/hint-v3.0.0.css +1 -0
- package/site/real/holmes-v6.8.12.css +1 -0
- package/site/real/hover-buttons-v0.15.0.css +2960 -0
- package/site/real/html-sheets-of-paper-v0.0.0.css +1 -0
- package/site/real/hugo-universal-theme-v1.4.1.css +1 -0
- package/site/real/icon-hover-effects-v0.0.0.css +1 -0
- package/site/real/instagram-v0.1.4.css +1 -0
- package/site/real/jupyter-themes-v0.20.0.css +1 -0
- package/site/real/justified-v0.0.0.css +1 -0
- package/site/real/kickoff-v8.0.0.css +1 -0
- package/site/real/knacss-v8.2.0.css +1 -0
- package/site/real/less-framework-v0.0.0.css +1 -0
- package/site/real/linktree-v0.0.0.css +1 -0
- package/site/real/littlebox-v0.0.4.css +1 -0
- package/site/real/load-awesome-v1.1.0.css +1 -0
- package/site/real/loaders-v0.1.2.css +1 -0
- package/site/real/luxbar-v0.3.0.css +1 -0
- package/site/real/lynx-v1.4.0.css +1 -0
- package/site/real/markdown-css-v0.0.0.css +1 -0
- package/site/real/material-for-bootstrap-v4.1.1.css +1 -0
- package/site/real/medium.css-v1.0.2.css +1 -0
- package/site/real/meyer-v2.0.0.css +1 -0
- package/site/real/microsoft-metro-buttons-v1.2.0.css +1 -0
- package/site/real/microtip-v0.2.2.css +1 -0
- package/site/real/mini-v3.0.1.css +1 -0
- package/site/real/minireset-v0.0.7.css +1 -0
- package/site/real/missing-v1.3.0.css +1 -0
- package/site/real/mobi-v3.1.1.css +1 -0
- package/site/real/mocka-v1.0.1.css +1 -0
- package/site/real/modern-css-resets-v1.4.0.css +1 -0
- package/site/real/mvcss-v4.1.0.css +1347 -0
- package/site/real/mvp-v1.17.3.css +1 -0
- package/site/real/my-internet-v1.0.0.css +692 -0
- package/site/real/natural-selection-v0.0.0.css +1 -0
- package/site/real/nes-v2.3.0.css +1 -0
- package/site/real/normalize-v8.0.1.css +1 -0
- package/site/real/object-fit-polyfill-v0.3.4.css +1 -0
- package/site/real/obnoxious-v3.5.2.css +1 -0
- package/site/real/obsidian-colored-sidebar-v2.0.0.css +1 -0
- package/site/real/obsidian-modular-css-layout-v0.10.0.css +1 -0
- package/site/real/obsidian-notebook-themes-v2.2.3.css +1 -0
- package/site/real/off-canvas-menu-effects-v0.0.0.css +1 -0
- package/site/real/orbit-v1.4.11.css +1 -0
- package/site/real/orgcss-v9.2.3.css +2464 -0
- package/site/real/paper-v0.4.1.css +1 -0
- package/site/real/patternbolt-v0.0.0.css +1 -0
- package/site/real/patternfly-v6.5.2.css +1 -0
- package/site/real/pesticide-v1.3.0.css +1 -0
- package/site/real/phonon-v1.5.1.css +6232 -0
- package/site/real/photon-v0.1.2.css +1 -0
- package/site/real/picnic-v7.1.0.css +1 -0
- package/site/real/pico-v2.1.1.css +1 -0
- package/site/real/pills-v1.0.1.css +1 -0
- package/site/real/portfolio-template-v0.0.0.css +1 -0
- package/site/real/preboot-v2.0.0.css +1 -0
- package/site/real/pretty-checkbox-v3.0.3.css +1 -0
- package/site/real/progress-tracker-v3.0.0.css +1 -0
- package/site/real/protonmail-themes-v4.0.8.css +276 -0
- package/site/real/proxmorph-v2.7.3.css +1 -0
- package/site/real/pure-v3.0.0.css +1 -0
- package/site/real/pygments-fruity-v1.0.0.css +1 -0
- package/site/real/ratchet-v2.0.2.css +1 -0
- package/site/real/remedy-quotes-v0.1.0.css +1 -0
- package/site/real/remedy-v0.1.0.css +1 -0
- package/site/real/repaintless-v1.4.0.css +1 -0
- package/site/real/reset-v1.0.2.css +1 -0
- package/site/real/responsive-4-v4.1.4.css +1 -0
- package/site/real/responsive-5-v5.0.0.css +1 -0
- package/site/real/ress-v5.0.2.css +1 -0
- package/site/real/rippleui-v1.12.1.css +1 -0
- package/site/real/sakura-v1.5.1.css +1 -0
- package/site/real/sanitize-v13.0.0.css +1 -0
- package/site/real/sapc-apca-v0.0.0.css +1 -0
- package/site/real/select-v3.2.0.css +1 -0
- package/site/real/select2-bootstrap-v1.2.5.css +1 -0
- package/site/real/semantic-v2.5.0.css +1 -0
- package/site/real/shards-v3.0.0.css +1 -0
- package/site/real/shina-fox-v0.1.0.css +1 -0
- package/site/real/sierra-v3.5.0.css +1 -0
- package/site/real/simple-grid-v0.0.0.css +1 -0
- package/site/real/simple-line-icons-v2.5.4.css +1 -0
- package/site/real/simple-v2.3.7.css +1 -0
- package/site/real/simptip-v1.0.4.css +1 -0
- package/site/real/skeleton-v2.0.4.css +1 -0
- package/site/real/slitslider-v1.1.0.css +115 -0
- package/site/real/social-signin-buttons-v0.0.0.css +1 -0
- package/site/real/spcss-v0.9.0.css +1 -0
- package/site/real/spectre-v0.5.9.css +1 -0
- package/site/real/spicetify-bloom-v0.0.0.css +1 -0
- package/site/real/spicetify-dribbblish-v0.0.0.css +1 -0
- package/site/real/spicetify-text-v0.0.0.css +1 -0
- package/site/real/spinkit-v2.0.1.css +1 -0
- package/site/real/stackicons-v1.13.0.css +1 -0
- package/site/real/stackoverflow-dark-v5.1.2.css +1 -0
- package/site/real/stacks-v2.8.6.css +1 -0
- package/site/real/swagger-ui-themes-2-v2.1.0.css +1 -0
- package/site/real/swagger-ui-themes-3-v3.0.1.css +1 -0
- package/site/real/system-v0.1.11.css +1 -0
- package/site/real/tablecloth-v1.0.0.css +1 -0
- package/site/real/tachyons-v4.12.0.css +1 -0
- package/site/real/tailwind-cards-v0.0.0.css +1 -0
- package/site/real/tailwind-v2.2.19.css +1 -0
- package/site/real/the-50-front-end-project-44-v0.0.0.css +1 -0
- package/site/real/the-new-css-reset-v1.11.3.css +1 -0
- package/site/real/toast-v1.1.0.css +1 -0
- package/site/real/tocas-v5.7.0.css +1 -0
- package/site/real/tooltip-twispy-v1.0.6.css +1 -0
- package/site/real/tootik-v1.0.2.css +428 -0
- package/site/real/tuesday-v1.3.0.css +1115 -0
- package/site/real/tufte-v1.8.0.css +1 -0
- package/site/real/tui-v2.1.2.css +1 -0
- package/site/real/tw-animate-css-v1.4.0.css +1 -0
- package/site/real/uikit-v3.25.17.css +1 -0
- package/site/real/unfold-v0.0.0.css +3569 -0
- package/site/real/universal-v0.0.0.css +1 -0
- package/site/real/uswds-v3.13.0.css +1 -0
- package/site/real/utility-opentype-v0.1.4.css +1 -0
- package/site/real/vim-css3-syntax-v2.10.0.css +1 -0
- package/site/real/virtual-bookshelf-v1.1.0.css +211 -0
- package/site/real/vitepress-v1.6.4.css +1 -0
- package/site/real/vivify-v1.0.0.css +1 -0
- package/site/real/voxels-v1.0.0.css +1 -0
- package/site/real/w3css-v4.10.0.css +233 -0
- package/site/real/waffle-grid-v1.3.6.css +1 -0
- package/site/real/water-v2.1.1.css +1 -0
- package/site/real/weather-icons-v2.0.10.css +1 -0
- package/site/real/webgradients-v0.0.0.css +1 -0
- package/site/real/wenk-v1.0.8.css +1 -0
- package/site/real/wikipedia-dark-v3.7.9.css +1 -0
- package/site/real/windows-95-v0.0.0.css +1 -0
- package/site/real/windows-98-v0.0.1.css +1 -0
- package/site/real/wing-v1.0.0.css +1 -0
- package/site/real/woah-v1.3.1.css +1 -0
- package/site/real/wtf-forms-v2.2.0.css +1 -0
- package/site/real/yacy-v4.1.2.css +1 -0
- package/site/real/yue-v1.1.1.css +1 -0
- package/site/real/zotero-dark-theme-v0.0.0.css +1 -0
- package/site/real.json +100 -0
- package/src/declarations/process.js +5 -0
- package/src/index.js +135 -1
- package/src/rules/optimize.js +22 -1
- package/src/rules/stringify.js +67 -1
- package/src/value/minify.js +116 -25
- package/src/value/quotes.js +62 -0
- package/site/assets/CSSLOP-DIcsfyiN.js +0 -2
- package/site/assets/CSSLOP-DIcsfyiN.js.map +0 -1
- package/site/assets/codemirror-CRWP0c-o.js +0 -13
- package/site/assets/codemirror-CRWP0c-o.js.map +0 -1
- package/site/assets/index-BtSQKlYm.js +0 -4
- package/site/assets/index-BtSQKlYm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSSLOP-KqihQ_En.js","names":["useImportant"],"sources":["../../src/context.js","../../src/position-try.js","../../src/utilities.js","../../src/preprocess.js","../../src/rules/normalize.js","../../src/rules/optimize.js","../../src/value/named-colors.js","../../src/value/shared.js","../../src/value/colors.js","../../src/value/gradients.js","../../src/value/math.js","../../src/value/quotes.js","../../src/value/transforms.js","../../src/value/unicode-range.js","../../src/value/minify.js","../../src/declarations/config.js","../../src/declarations/process.js","../../src/rules/stringify.js","../../src/index.js"],"sourcesContent":["/**\n * @file Manages the shared minification context for tracking registered custom properties and their syntax.\n */\n\n/**\n * Creates a fresh minification context used to track `@property`-registered custom properties and their declared syntax types across the entire stylesheet.\n *\n * @return {object} A context object with a registeredCustomProperties Set and a registeredCustomPropertySyntax Map.\n */\nfunction createMinifyContext () {\n return {\n registeredCustomProperties: new Set(),\n registeredCustomPropertySyntax: new Map()\n };\n}\n\nexport { createMinifyContext };\n","/**\n * @file Handles `@position-try` rule analysis, usage tracking, and dead-rule elimination during CSS minification.\n */\n\n/**\n * Scans top-level rules to register `@property` custom properties in the context and collect `@position-try` rule declarations and initial usage counts.\n *\n * @param {Array} rules The top-level AST rule nodes to scan.\n * @param {object} context The minification context to populate with custom property registrations.\n * @return {object} An object with positionTryRules Map and positionTryUsage Map.\n */\nfunction collectRuleMetadata (rules, context) {\n const positionTryRules = new Map();\n const positionTryUsage = new Map();\n\n for (const rule of rules) {\n if (rule.type === 'property' && rule.name) {\n context.registeredCustomProperties.add(rule.name);\n const syntaxDeclaration = (rule.declarations || []).find((declaration) => {\n return declaration.type !== 'whitespace' && declaration.property === 'syntax';\n });\n if (syntaxDeclaration?.value) {\n context.registeredCustomPropertySyntax.set(rule.name, syntaxDeclaration.value);\n }\n }\n if (rule.type === 'position-try') {\n const declarations = (rule.declarations || []).filter((declaration) => {\n return declaration.type !== 'whitespace';\n });\n if (declarations.length > 0) {\n positionTryRules.set(rule.name, declarations);\n positionTryUsage.set(rule.name, 0);\n }\n }\n }\n\n return {\n positionTryRules,\n positionTryUsage\n };\n}\n\n/**\n * Walks rules to resolve position-try-fallbacks references, replacing simple single-declaration patterns with built-in keywords like flip-block and tracking usage counts.\n *\n * @param {Array} rules The AST rule nodes to analyze.\n * @param {function(object): string} minifyValue The value minification function for resolving declaration values.\n * @param {Map} positionTryRules Map of `@position-try` names to their declaration arrays.\n * @param {Map} positionTryUsage Map of `@position-try` names to their reference counts.\n */\nfunction analyzePositionTryRules (rules, minifyValue, positionTryRules, positionTryUsage) {\n for (const rule of rules) {\n if (rule.type === 'rule') {\n let basePositionArea = null;\n for (const declaration of rule.declarations || []) {\n if (declaration.type !== 'whitespace' && declaration.property === 'position-area') {\n basePositionArea = minifyValue(declaration);\n }\n }\n\n for (const declaration of rule.declarations || []) {\n const isPositionTryProperty = (\n declaration.type !== 'whitespace' &&\n (declaration.property === 'position-try-fallbacks' || declaration.property === 'position-try')\n );\n if (!isPositionTryProperty) {\n continue;\n }\n\n const minifiedValue = minifyValue(declaration);\n const parts = minifiedValue.split(',').map((segment) => {\n return segment.trim();\n });\n const replacedParts = [];\n\n for (const part of parts) {\n if (!part.startsWith('--')) {\n replacedParts.push(part);\n continue;\n }\n\n if (!positionTryRules.has(part)) {\n replacedParts.push(part);\n continue;\n }\n\n const tryDeclarations = positionTryRules.get(part);\n const isSinglePositionArea = (\n tryDeclarations.length === 1 &&\n tryDeclarations[0].property === 'position-area' &&\n basePositionArea\n );\n\n if (isSinglePositionArea) {\n const tryValue = minifyValue(tryDeclarations[0]);\n const isVerticalFlip = (\n (basePositionArea === 'top' && tryValue === 'bottom') ||\n (basePositionArea === 'bottom' && tryValue === 'top')\n );\n\n if (isVerticalFlip && parts.length === 1) {\n replacedParts.push('flip-block');\n continue;\n }\n }\n\n replacedParts.push(part);\n const currentUsage = positionTryUsage.get(part);\n positionTryUsage.set(part, currentUsage + 1);\n }\n\n declaration.value = replacedParts.join(',');\n }\n } else if (rule.rules) {\n analyzePositionTryRules(rule.rules, minifyValue, positionTryRules, positionTryUsage);\n }\n }\n}\n\n/**\n * Removes empty position-try-fallbacks and position-try declarations left with blank values after analysis inlined their references.\n *\n * @param {Array} rules The AST rule nodes to clean in place.\n */\nfunction cleanPositionTryRules (rules) {\n for (const rule of rules) {\n if (rule.type === 'rule') {\n rule.declarations = (rule.declarations || []).filter((declaration) => {\n const isPositionTryProperty = (\n declaration.type !== 'whitespace' &&\n (declaration.property === 'position-try-fallbacks' || declaration.property === 'position-try')\n );\n if (isPositionTryProperty) {\n return declaration.value !== '';\n }\n return true;\n });\n } else if (rule.rules) {\n cleanPositionTryRules(rule.rules);\n }\n }\n}\n\n/**\n * Filters out unused `@position-try` rules whose references were fully inlined.\n *\n * @param {Array} rules The top-level AST rule nodes to filter.\n * @param {Map} positionTryRules Map of `@position-try` names to their declaration arrays.\n * @param {Map} positionTryUsage Map of `@position-try` names to their reference counts.\n * @return {Array} A new array of rules with unused `@position-try` entries removed.\n */\nfunction filterUnusedPositionTry (rules, positionTryRules, positionTryUsage) {\n return rules.filter((rule) => {\n if (rule.type === 'position-try') {\n if (!positionTryRules.has(rule.name)) {\n return false;\n }\n if (positionTryUsage.get(rule.name) === 0) {\n return false;\n }\n }\n return true;\n });\n}\n\n/**\n * Removes duplicate and redundant UTF-8 `@charset` rules, keeping only the first\n * non-UTF-8 charset declaration.\n *\n * @param {Array} rules The top-level AST rule nodes to filter.\n * @return {Array} A new array of rules with redundant `@charset` entries removed.\n */\nfunction filterRedundantCharsets (rules) {\n let firstCharsetFound = false;\n\n return rules.filter((rule) => {\n if (rule.type === 'charset') {\n if (!firstCharsetFound) {\n firstCharsetFound = true;\n // Strip surrounding quotes from the charset value for comparison\n const normalizedCharset = rule.charset?.toLowerCase().replace(/[\"']/g, '');\n if (normalizedCharset === 'utf-8') {\n return false;\n }\n return true;\n }\n return false;\n }\n return true;\n });\n}\n\nexport {\n analyzePositionTryRules,\n cleanPositionTryRules,\n collectRuleMetadata,\n filterRedundantCharsets,\n filterUnusedPositionTry\n};\n","/**\n * @file General CSS utilities shared across the minification pipeline.\n */\n\n/**\n * Resolves a CSS Unicode escape hex string to its literal character.\n * Returns null for control characters (code points below 0x20 or equal to 0x7F),\n * which must remain escaped in CSS.\n *\n * @param {string} hex The hex digit string (1–6 characters) from a CSS escape sequence.\n * @return {string|null} The resolved character, or null if the code point is a control character.\n */\nfunction resolveUnicodeEscape (hex) {\n const codePoint = parseInt(hex, 16);\n const isControlCharacter = codePoint < 0x20 || codePoint === 0x7f;\n if (isControlCharacter) {\n return null;\n }\n return String.fromCodePoint(codePoint);\n}\n\n/**\n * Escapes special regex metacharacters in a string so it can be safely used\n * as a literal pattern in a RegExp constructor.\n *\n * @param {string} input The string to escape.\n * @return {string} The escaped string safe for use in a RegExp.\n */\nfunction escapeRegexString (input) {\n // Escape all regex metacharacters: . * + ? ^ $ { } ( ) | [ ] backslash\n return input.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport {\n escapeRegexString,\n resolveUnicodeEscape\n};\n","/**\n * @file Preprocesses CSS declaration blocks by converting Unicode escape sequences to their literal characters before parsing.\n */\n\nimport { resolveUnicodeEscape } from './utilities.js';\n\n/**\n * Automatically fixes common CSS syntax errors that would cause parsing to fail.\n * Handles missing closing braces, unmatched quotes, and other structural issues.\n *\n * @param {string} css The raw CSS string to fix.\n * @return {string} The CSS string with common syntax errors corrected.\n */\nfunction fixCommonSyntaxErrors (css) {\n let fixed = css;\n\n // Fix missing closing braces by analyzing brace balance\n // Count braces while ignoring those inside comments and strings\n let openBraces = 0;\n let inString = false;\n let stringChar = '';\n let inComment = false;\n let commentType = '';\n\n for (let i = 0; i < fixed.length; i++) {\n const char = fixed[i];\n const prevChar = i > 0 ? fixed[i - 1] : '';\n\n // Handle string state\n if (!inComment && (char === '\"' || char === '\\'') && prevChar !== '\\\\') {\n if (!inString) {\n inString = true;\n stringChar = char;\n } else if (char === stringChar) {\n inString = false;\n stringChar = '';\n }\n }\n\n // Handle comment state\n if (!inString) {\n if (!inComment && char === '/' && i + 1 < fixed.length && fixed[i + 1] === '*') {\n inComment = true;\n commentType = '/*';\n i++; // Skip the next character\n } else if (inComment && commentType === '/*' && char === '*' && i + 1 < fixed.length && fixed[i + 1] === '/') {\n inComment = false;\n commentType = '';\n i++; // Skip the next character\n }\n }\n\n // Count braces only when not in strings or comments\n if (!inString && !inComment) {\n if (char === '{') {\n openBraces++;\n } else if (char === '}') {\n openBraces--;\n }\n }\n }\n\n // Add missing closing braces\n if (openBraces > 0) {\n fixed += '}'.repeat(openBraces);\n }\n\n // Fix unclosed strings (common in malformed CSS)\n if (inString) {\n fixed += stringChar;\n }\n\n // Fix unclosed comments\n if (inComment && commentType === '/*') {\n fixed += '*/';\n }\n\n return fixed;\n}\n\n/**\n * Converts CSS Unicode escape sequences inside declaration blocks to their literal character equivalents, while preserving control characters that must remain escaped.\n * Also cleans up malformed CSS syntax that would cause parser failures.\n *\n * @param {string} css The raw CSS string to preprocess.\n * @return {string} The CSS string with printable Unicode escapes resolved inside declaration blocks and syntax errors fixed.\n */\nfunction preprocessDeclarationBlocks (css) {\n // First, fix common syntax errors that would cause parsing to fail\n let processed = fixCommonSyntaxErrors(css);\n\n // Match top-level declaration blocks (non-nested { ... })\n return processed.replace(/\\{([^{}]*)\\}/g, (match, content) => {\n // First, remove semicolons after comments which cause parser errors\n // Pattern: comment followed by optional whitespace and semicolon\n let processed = content.replace(/\\/\\*.*?\\*\\/\\s*;/g, (commentMatch) => {\n // Remove the trailing semicolon from comment+semicolon combinations\n return commentMatch.replace(/;$/, '');\n });\n \n // Then, skip quoted strings and match CSS unicode escapes (backslash + 1-6 hex digits + optional whitespace)\n processed = processed.replace(/\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|\\\\([0-9a-fA-F]{1,6})\\s?/g, (fullMatch, hex) => {\n if (!hex) {\n return fullMatch;\n }\n return resolveUnicodeEscape(hex) ?? fullMatch;\n });\n \n return '{' + processed + '}';\n });\n}\n\n/**\n * Unicode Private Use Area characters used as temporary placeholders\n * for CSS escape sequences during preprocessing, preventing the parser\n * from exceeding its internal escape-counting limit on large files.\n */\nconst ESCAPED_COLON_PLACEHOLDER = '\\uE001';\nconst ESCAPED_DOT_PLACEHOLDER = '\\uE002';\nconst ESCAPED_SLASH_PLACEHOLDER = '\\uE003';\n\n/**\n * Replaces common single-character CSS escape sequences with Unicode Private\n * Use Area placeholder characters to prevent the parser from exceeding its\n * internal escape-counting limit on files with many escaped selectors\n * (e.g. Tailwind-style utility classes like `.sm\\:p-0`).\n *\n * Only neutralizes escapes outside of attribute selector brackets `[...]`,\n * quoted strings, and comments so the minifier's quote-vs-escape length\n * comparisons in attribute selectors remain accurate.\n *\n * @param {string} css The raw CSS string to preprocess.\n * @return {string} The CSS with escape sequences replaced by placeholders.\n */\nfunction neutralizeEscapeSequences (css) {\n let result = '';\n let insideBrackets = false;\n let insideString = false;\n let stringDelimiter = '';\n let insideComment = false;\n\n for (let i = 0; i < css.length; i++) {\n const character = css[i];\n const nextCharacter = i + 1 < css.length ? css[i + 1] : '';\n\n // Track block comment state\n if (!insideString && !insideComment && character === '/' && nextCharacter === '*') {\n insideComment = true;\n result += '/*';\n i++;\n continue;\n }\n if (insideComment) {\n if (character === '*' && nextCharacter === '/') {\n insideComment = false;\n result += '*/';\n i++;\n continue;\n }\n result += character;\n continue;\n }\n\n // Track string state (preserve escapes inside strings)\n if (!insideString && (character === '\"' || character === '\\'')) {\n insideString = true;\n stringDelimiter = character;\n result += character;\n continue;\n }\n if (insideString) {\n if (character === '\\\\' && nextCharacter) {\n result += character + nextCharacter;\n i++;\n continue;\n }\n if (character === stringDelimiter) {\n insideString = false;\n stringDelimiter = '';\n }\n result += character;\n continue;\n }\n\n // Track attribute selector bracket state\n if (character === '[') {\n insideBrackets = true;\n result += character;\n continue;\n }\n if (character === ']') {\n insideBrackets = false;\n result += character;\n continue;\n }\n\n // Replace escape sequences only outside brackets, strings, and comments\n if (!insideBrackets && character === '\\\\') {\n if (nextCharacter === ':') {\n result += ESCAPED_COLON_PLACEHOLDER;\n i++;\n continue;\n }\n if (nextCharacter === '.') {\n result += ESCAPED_DOT_PLACEHOLDER;\n i++;\n continue;\n }\n if (nextCharacter === '/') {\n result += ESCAPED_SLASH_PLACEHOLDER;\n i++;\n continue;\n }\n }\n\n result += character;\n }\n\n return result;\n}\n\n/**\n * Restores the original CSS escape sequences from their Unicode Private Use\n * Area placeholder characters after minification is complete.\n *\n * @param {string} css The minified CSS string with placeholders.\n * @return {string} The CSS with original escape sequences restored.\n */\nfunction restoreEscapeSequences (css) {\n return css\n .replaceAll(ESCAPED_COLON_PLACEHOLDER, '\\\\:')\n .replaceAll(ESCAPED_DOT_PLACEHOLDER, '\\\\.')\n .replaceAll(ESCAPED_SLASH_PLACEHOLDER, '\\\\/');\n}\n\nexport {\n neutralizeEscapeSequences,\n preprocessDeclarationBlocks,\n restoreEscapeSequences\n};\n","/**\n * @file Normalizes CSS selectors, `@media` queries, and `@supports` conditions by unescaping identifiers and collapsing whitespace.\n */\n\nimport { resolveUnicodeEscape } from '../utilities.js';\n\n/**\n * Converts CSS Unicode escape sequences in an identifier to their literal characters, preserving control characters that must remain escaped.\n *\n * @param {string} identifier The CSS identifier string to unescape.\n * @return {string} The identifier with printable Unicode escapes resolved.\n */\nfunction unescapeIdent (identifier) {\n // Match CSS unicode escapes: backslash + 1-6 hex digits + optional trailing whitespace\n return identifier.replace(/\\\\([0-9a-fA-F]{1,6})\\s?/g, (match, hex) => {\n return resolveUnicodeEscape(hex) ?? match;\n });\n}\n\n/**\n * Converts CSS Unicode escape sequences in a selector to literal characters, preserving escapes that are syntactically required such as leading digits after class or ID selectors.\n *\n * @param {string} selector The CSS selector string to unescape.\n * @return {string} The selector with safe Unicode escapes resolved.\n */\nfunction unescapeSelector (selector) {\n // Match CSS unicode escapes: backslash + 1-6 hex digits + optional trailing whitespace\n return selector.replace(/\\\\([0-9a-fA-F]{1,6})\\s?/g, (match, hex, offset) => {\n const character = resolveUnicodeEscape(hex);\n if (character === null) {\n return match;\n }\n let precedingCharacter;\n if (offset > 0) {\n precedingCharacter = selector[offset - 1];\n } else {\n precedingCharacter = '';\n }\n // Check if the unescaped character is a digit that would form an invalid start of a class/id name\n const isLeadingDigitAfterSelector = (\n /[0-9]/.test(character) &&\n (offset === 0 || precedingCharacter === '.' || precedingCharacter === '#')\n );\n if (isLeadingDigitAfterSelector) {\n return match;\n }\n return character;\n });\n}\n\n/**\n * Normalizes a `@media` query string by collapsing whitespace, stripping the default \"all and\" prefix, and converting min/max-width to range syntax.\n *\n * @param {string} media The raw `@media` query string.\n * @return {string} The normalized and minified media query.\n */\nfunction normalizeMedia (media) {\n // Collapse whitespace, strip spaces around punctuation, and remove the redundant \"all and\" prefix\n media = media.replace(/\\s+/g, ' ').replace(/\\s*([:,])\\s*/g, '$1').replace(/\\s*([=<>])\\s*/g, '$1').replace(/\\(\\s+/g, '(').replace(/\\s+\\)/g, ')').replace(/\\b(?:all and )/gi, '');\n // Convert min-width/max-width to range syntax (e.g. min-width:768px → width>=768px)\n media = media.replace(/min-width:(\\d+[a-z%]*)/gi, 'width>=$1').replace(/max-width:(\\d+[a-z%]*)/gi, 'width<=$1');\n media = media.replace(/min-height:(\\d+[a-z%]*)/gi, 'height>=$1').replace(/max-height:(\\d+[a-z%]*)/gi, 'height<=$1');\n // Combine adjacent min+max range queries into a single range expression: (width>=X) and (width<=Y) → (X<=width<=Y)\n media = media.replace(\n /\\((\\w+)>=(\\d+[a-z%]*)\\)\\s+and\\s+\\((\\w+)<=(\\d+[a-z%]*)\\)/gi,\n (fullMatch, minProperty, minValue, maxProperty, maxValue) => {\n if (minProperty === maxProperty) {\n return '(' + minValue + '<=' + minProperty + '<=' + maxValue + ')';\n }\n return fullMatch;\n }\n );\n return media;\n}\n\n/**\n * Normalizes a `@supports` condition string by collapsing whitespace, trimming, and standardizing spacing around logical operators.\n *\n * @param {string} supports The raw `@supports` condition string.\n * @return {string} The normalized `@supports` condition.\n */\nfunction normalizeSupports (supports) {\n // Collapse whitespace and strip spaces around punctuation\n supports = supports.replace(/\\s+/g, ' ').replace(/\\s*([:,])\\s*/g, '$1').replace(/\\s*([=<>])\\s*/g, '$1').replace(/\\(\\s+/g, '(').replace(/\\s+\\)/g, ')').trim();\n supports = supports.replace(/\\s+and\\s+/g, ' and ').replace(/\\s+or\\s+/g, ' or ').replace(/\\s+not\\s+/g, ' not ');\n // Compact logical operator spacing: \") and (\" → \")and (\"\n supports = supports.replace(/\\)\\s*and\\s*\\(/g, ')and (');\n supports = supports.replace(/\\)\\s*or\\s*\\(/g, ')or (');\n return supports;\n}\n\n/**\n * Checks if a `@supports` condition tests for universally supported features like display:grid or display:flex, allowing the `@supports` wrapper to be safely removed.\n *\n * @param {string} supports The normalized `@supports` condition string.\n * @return {boolean} True if the `@supports` block can be unwrapped.\n */\nfunction canUnwrapSupports (supports) {\n return supports === '(display:grid)' || supports === '(display:flex)';\n}\n\nexport {\n canUnwrapSupports,\n normalizeMedia,\n normalizeSupports,\n unescapeIdent,\n unescapeSelector\n};\n","/**\n * @file Optimizes CSS rule structures by merging selectors, deduplicating keyframes, nesting flat rules, and consolidating `@media` and `@layer` blocks.\n */\n\nimport { escapeRegexString } from '../utilities.js';\n\nimport { normalizeMedia } from './normalize.js';\n\n/**\n * Expands rules that contain only nested sub-rules into flat rules with combined selectors, enabling further merging when the combined selectors already exist elsewhere.\n *\n * @param {Array} rules The AST rule nodes to process.\n * @return {Array} A new array of rules with pure-nested rules expanded.\n */\nfunction expandPureNestedRules (rules) {\n const flatSelectors = new Set();\n for (const rule of rules) {\n if (rule.type !== 'rule' || !rule.selectors?.length) {\n continue;\n }\n const nonWhitespace = (rule.declarations || []).filter((declaration) => {\n return declaration.type !== 'whitespace';\n });\n const hasNonRuleDeclarations = nonWhitespace.some((declaration) => {\n return declaration.type !== 'rule';\n });\n if (hasNonRuleDeclarations) {\n rule.selectors.forEach((selector) => {\n // Normalize selector whitespace to single space for deduplication\n flatSelectors.add(selector.trim().replace(/\\s+/g, ' '));\n });\n }\n }\n\n const result = [];\n for (const rule of rules) {\n if (rule.type !== 'rule' || !rule.selectors?.length) {\n result.push(rule);\n continue;\n }\n const nonWhitespace = (rule.declarations || []).filter((declaration) => {\n return declaration.type !== 'whitespace';\n });\n const isPureNested = nonWhitespace.length > 0 && nonWhitespace.every((declaration) => {\n return declaration.type === 'rule';\n });\n if (!isPureNested) {\n result.push(rule);\n continue;\n }\n\n let anyMatch = false;\n let expandedRules = [];\n let canExpand = true;\n\n for (const nestedRule of nonWhitespace) {\n if (!nestedRule.selectors?.length) {\n canExpand = false;\n break;\n }\n const combinedSelectors = [];\n for (const parentSelector of rule.selectors) {\n for (const childSelector of nestedRule.selectors) {\n const trimmedChild = childSelector.trim();\n let combinedSelector;\n if (trimmedChild.startsWith('&')) {\n combinedSelector = trimmedChild.replace(/^&/, parentSelector.trim());\n } else {\n combinedSelector = parentSelector.trim() + ' ' + trimmedChild;\n }\n combinedSelectors.push(combinedSelector);\n if (flatSelectors.has(combinedSelector)) {\n anyMatch = true;\n }\n }\n }\n expandedRules.push({ ...nestedRule, selectors: combinedSelectors });\n }\n\n const allChildSelectorStrings = expandedRules.map((expandedRule) => {\n return expandedRule.selectors.join(',');\n });\n const allSame = (\n allChildSelectorStrings.length > 0 &&\n allChildSelectorStrings.every((selectorString) => {\n return selectorString === allChildSelectorStrings[0];\n })\n );\n if (canExpand && (allSame || anyMatch)) {\n for (const expandedRule of expandedRules) {\n result.push(expandedRule);\n }\n } else {\n result.push(rule);\n }\n }\n return result;\n}\n\n/**\n * Attempts to express a child selector as a nested selector relative to a parent, returning the nested form or null if nesting is not possible.\n *\n * @param {string} parentSel The parent selector string.\n * @param {string} childSel The child selector string to try nesting.\n * @return {string|null} The nested selector using & syntax, or null if the child cannot be nested under the parent.\n */\nfunction tryNestSelector (parentSel, childSel) {\n const parent = parentSel.trim();\n const child = childSel.trim();\n if (child.startsWith(parent + ':') || child.startsWith(parent + '::')) {\n return '&' + child.slice(parent.length);\n }\n if (child.startsWith(parent + ' ')) {\n return child.slice(parent.length + 1);\n }\n // Match child selector that starts with the parent followed by a combinator (>, +, ~)\n const combinatorMatch = child.match(\n new RegExp('^' + escapeRegexString(parent) + '\\\\s*([>+~])\\\\s*(.+)$')\n );\n if (combinatorMatch) {\n return combinatorMatch[1] + combinatorMatch[2];\n }\n return null;\n}\n\n/**\n * Determines whether a rule is effectively empty, containing no meaningful\n * CSS output after minification. A rule is effectively empty when it has\n * no declarations, or all of its entries are whitespace, non-important\n * comments, or recursively empty nested rules.\n *\n * @param {object} rule The AST rule node to evaluate.\n * @return {boolean} True if the rule produces no CSS output.\n */\nfunction isRuleEffectivelyEmpty (rule) {\n if (rule.type !== 'rule') {\n return false;\n }\n const nonWhitespaceEntries = (rule.declarations || []).filter((declaration) => {\n return declaration.type !== 'whitespace';\n });\n if (nonWhitespaceEntries.length === 0) {\n return true;\n }\n return nonWhitespaceEntries.every((entry) => {\n if (entry.type === 'comment') {\n return !entry.comment?.startsWith('!');\n }\n if (entry.type === 'rule') {\n return isRuleEffectivelyEmpty(entry);\n }\n return false;\n });\n}\n\n/**\n * Filters out effectively empty rules from the rules array, preventing\n * empty rules from being nested into parent rules during later\n * optimization passes and producing incorrect non-empty output.\n *\n * @param {Array} rules The AST rule nodes to filter.\n * @return {Array} A new array with effectively empty rules removed.\n */\nfunction removeEmptyRules (rules) {\n return rules.filter((rule) => {\n return !isRuleEffectivelyEmpty(rule);\n });\n}\n\n/**\n * Groups flat CSS rules into nested structures where a child selector can be expressed relative to a preceding parent, reducing output size through CSS nesting.\n *\n * @param {Array} rules The flat AST rule nodes to nest.\n * @return {Array} A new array of rules with applicable children nested under their parents.\n */\nfunction nestFlatRules (rules) {\n const result = [];\n for (const rule of rules) {\n if (rule.type !== 'rule' || rule.selectors?.length !== 1) {\n result.push(rule);\n continue;\n }\n const childSelector = rule.selectors[0].trim();\n let wasNested = false;\n for (let j = result.length - 1; j >= 0; j--) {\n const parentRule = result[j];\n if (parentRule.type !== 'rule' || parentRule.selectors?.length !== 1) {\n continue;\n }\n const nestedSelector = tryNestSelector(parentRule.selectors[0], childSelector);\n if (nestedSelector !== null) {\n parentRule.declarations = parentRule.declarations || [];\n parentRule.declarations.push({ ...rule, selectors: [nestedSelector] });\n wasNested = true;\n break;\n }\n }\n if (!wasNested) {\n result.push(rule);\n }\n }\n for (const rule of result) {\n if (rule.type === 'rule' && rule.declarations) {\n const innerRules = rule.declarations.filter((declaration) => {\n return declaration.type === 'rule';\n });\n if (innerRules.length > 0) {\n const nonRuleDeclarations = rule.declarations.filter((declaration) => {\n return declaration.type !== 'rule';\n });\n rule.declarations = [...nonRuleDeclarations, ...nestFlatRules(innerRules)];\n }\n }\n }\n return result;\n}\n\n/**\n * Extracts the leading compound selector of a complex selector: everything up to\n * the first top-level combinator (descendant whitespace, `>`, `+`, or `~`).\n * Combinator characters nested inside `()` or `[]` (such as `:nth-child(2n+1)` or\n * `[a~=b]`) are ignored so only structural combinators split the selector.\n *\n * @param {string} selector The selector string to inspect.\n * @return {string|null} The leading compound selector, or null when the selector has no descendant part to factor out.\n */\nfunction extractLeadingCompound (selector) {\n const trimmed = selector.trim();\n let bracketDepth = 0;\n for (let index = 0; index < trimmed.length; index++) {\n const character = trimmed[index];\n if (character === '(' || character === '[') {\n bracketDepth++;\n } else if (character === ')' || character === ']') {\n bracketDepth--;\n } else if (\n bracketDepth === 0 &&\n (character === ' ' || character === '>' || character === '+' || character === '~')\n ) {\n const compound = trimmed.slice(0, index).trim();\n return compound.length ? compound : null;\n }\n }\n return null;\n}\n\n/**\n * Groups consecutive sibling rules that share a common leading compound selector\n * (such as `.foo` in `.foo .a`, `.foo .b`) into a synthesized parent rule with the\n * shared portion factored out, but only when nesting trims more characters from the\n * child selectors than the wrapper itself costs.\n *\n * @param {Array} rules The flat AST rule nodes to factor.\n * @return {Array} A new array of rules with shared parent selectors factored into nesting wrappers.\n */\nfunction factorCommonParents (rules) {\n const result = [];\n let index = 0;\n while (index < rules.length) {\n const rule = rules[index];\n // Only single-selector style rules can act as a factoring candidate.\n if (rule.type !== 'rule' || rule.selectors?.length !== 1) {\n result.push(rule);\n index++;\n continue;\n }\n const candidateParent = extractLeadingCompound(rule.selectors[0]);\n if (candidateParent === null) {\n result.push(rule);\n index++;\n continue;\n }\n // Collect the run of consecutive rules that can all nest under the candidate.\n const run = [];\n const nestedForms = [];\n let lookahead = index;\n while (lookahead < rules.length) {\n const sibling = rules[lookahead];\n if (sibling.type !== 'rule' || sibling.selectors?.length !== 1) {\n break;\n }\n const nestedSelector = tryNestSelector(candidateParent, sibling.selectors[0]);\n if (nestedSelector === null) {\n break;\n }\n run.push(sibling);\n nestedForms.push(nestedSelector);\n lookahead++;\n }\n // The wrapper writes the shared selector once plus its surrounding braces.\n const wrapperCost = candidateParent.length + 2;\n const charactersSaved = run.reduce((total, sibling, position) => {\n return total + sibling.selectors[0].trim().length - nestedForms[position].length;\n }, 0);\n if (run.length >= 2 && charactersSaved > wrapperCost) {\n const children = run.map((sibling, position) => {\n return { ...sibling, selectors: [nestedForms[position]] };\n });\n result.push({\n type: 'rule',\n selectors: [candidateParent],\n // Recurse so deeper shared prefixes among the children also factor out.\n declarations: factorCommonParents(children)\n });\n index = lookahead;\n } else {\n result.push(rule);\n index++;\n }\n }\n return result;\n}\n\n/**\n * Merges adjacent `@media` rules that share an identical normalized query string and deduplicates their child selector rules.\n *\n * @param {Array} rules The AST rule nodes to process.\n * @param {function(Array): Array} mergeSelectorRules Callback to merge selector rules within each media block.\n * @return {Array} A new array of rules with consecutive identical `@media` blocks combined.\n */\nfunction mergeMediaRules (rules, mergeSelectorRules) {\n const mediaMap = new Map();\n const result = [];\n for (const rule of rules) {\n if (rule.type === 'media') {\n const normalizedQuery = normalizeMedia(rule.media);\n if (mediaMap.has(normalizedQuery)) {\n mediaMap.get(normalizedQuery).rules.push(...(rule.rules || []));\n } else {\n mediaMap.set(normalizedQuery, rule);\n result.push(rule);\n }\n } else {\n if (rule.type !== 'whitespace') {\n mediaMap.clear();\n }\n result.push(rule);\n }\n }\n for (const rule of result) {\n if (rule.type === 'media' && rule.rules && rule.rules.length) {\n rule.rules = mergeSelectorRules(rule.rules);\n }\n }\n return result;\n}\n\n/**\n * Removes duplicate `@keyframes` definitions, keeping only the last occurrence of each named animation.\n *\n * @param {Array} rules The AST rule nodes to deduplicate.\n * @return {Array} A new array of rules with earlier duplicate `@keyframes` removed.\n */\nfunction deduplicateKeyframes (rules) {\n const lastIndexByName = new Map();\n for (let i = 0; i < rules.length; i++) {\n if (rules[i].type === 'keyframes' && rules[i].name) {\n lastIndexByName.set(rules[i].name, i);\n }\n }\n return rules.filter((rule, index) => {\n if (rule.type === 'keyframes' && rule.name) {\n return lastIndexByName.get(rule.name) === index;\n }\n return true;\n });\n}\n\n/**\n * Removes duplicate selectors from a combined selector list by normalizing\n * whitespace and preserving the first occurrence of each unique selector.\n *\n * @param {Array} selectors The selector strings to deduplicate.\n * @return {Array} A new array with duplicate selectors removed.\n */\nfunction deduplicateSelectors (selectors) {\n const seen = new Set();\n return selectors.filter((selector) => {\n // Normalize whitespace to single spaces for consistent comparison\n const normalized = selector.trim().replace(/\\s+/g, ' ');\n if (seen.has(normalized)) {\n return false;\n }\n seen.add(normalized);\n return true;\n });\n}\n\n/**\n * Merges consecutive rules whose declarations are a subset of the following rule, combining their selectors and splitting out any extra declarations.\n *\n * @param {Array} rules The AST rule nodes to merge.\n * @return {Array} A new array of rules with declaration-compatible consecutive rules combined.\n */\nfunction mergeByDeclarations (rules) {\n const result = [];\n for (const rule of rules) {\n if (rule.type !== 'rule' || !rule.selectors?.length) {\n result.push(rule);\n continue;\n }\n const previousRule = result[result.length - 1];\n if (previousRule && previousRule.type === 'rule' && previousRule.selectors?.length) {\n const previousDeclarations = (previousRule.declarations || []).filter((declaration) => {\n return declaration.type !== 'whitespace' && declaration.property;\n });\n const currentDeclarations = (rule.declarations || []).filter((declaration) => {\n return declaration.type !== 'whitespace' && declaration.property;\n });\n if (previousDeclarations.length > 0 && currentDeclarations.length > 0) {\n const currentDeclarationMap = new Map(\n currentDeclarations.map((declaration) => {\n return [declaration.property, (declaration.value || '').trim()];\n })\n );\n const previousIsSubset = previousDeclarations.every((declaration) => {\n return currentDeclarationMap.get(declaration.property) === (declaration.value || '').trim();\n });\n const currentHasAllProperty = currentDeclarations.some((declaration) => {\n return declaration.property === 'all';\n });\n if (previousIsSubset && !currentHasAllProperty) {\n const commonProperties = new Set(\n previousDeclarations.map((declaration) => {\n return declaration.property;\n })\n );\n const currentOnlyDeclarations = currentDeclarations.filter((declaration) => {\n return !commonProperties.has(declaration.property);\n });\n result.pop();\n const combinedSelectors = deduplicateSelectors([...previousRule.selectors, ...rule.selectors]);\n result.push({ ...previousRule, selectors: combinedSelectors });\n if (currentOnlyDeclarations.length > 0) {\n result.push({ ...rule, declarations: currentOnlyDeclarations });\n }\n continue;\n }\n }\n }\n result.push(rule);\n }\n return result;\n}\n\n/**\n * Merges rules with identical normalized selectors by combining their declarations. Non-rule entries (like `@media`) break the merge window.\n *\n * @param {Array} rules The AST rule nodes to merge.\n * @return {Array} A new array of rules with same-selector rules combined.\n */\nfunction mergeSelectorRules (rules) {\n let result = [];\n let selectorMap = new Map();\n for (const rule of rules) {\n if (rule.type === 'rule') {\n const selectorKey = rule.selectors ?\n rule.selectors.map((selector) => {\n // Normalize selector whitespace for consistent comparison\n return selector.trim().replace(/\\s+/g, ' ');\n }).sort().join(',') :\n '';\n if (selectorKey && selectorMap.has(selectorKey)) {\n const existingRule = selectorMap.get(selectorKey);\n existingRule.declarations.push(...(rule.declarations || []));\n result = result.filter((candidate) => {\n return candidate !== existingRule;\n });\n result.push(existingRule);\n } else {\n selectorMap.set(selectorKey, rule);\n result.push(rule);\n }\n } else {\n if (rule.type === 'whitespace') {\n continue;\n }\n result.push(rule);\n selectorMap.clear();\n }\n }\n return result;\n}\n\n/**\n * Merges `@layer` blocks with the same name by combining their child rules, deduplicates layer statements, and merges selector rules within each block.\n *\n * @param {Array} rules The AST rule nodes to process.\n * @param {function(Array): Array} mergeSelectorRules Callback to merge selector rules within each layer block.\n * @return {Array} A new array of rules with same-name `@layer` blocks combined.\n */\nfunction mergeLayerRules (rules, mergeSelectorRules) {\n const layerBlockMap = new Map();\n const layerStatementSeen = new Set();\n const result = [];\n for (const rule of rules) {\n if (rule.type === 'layer') {\n const layerName = rule.layer || '';\n if (rule.rules && rule.rules.length > 0) {\n if (layerName && layerBlockMap.has(layerName)) {\n layerBlockMap.get(layerName).rules.push(...rule.rules);\n } else {\n if (layerName) {\n layerBlockMap.set(layerName, rule);\n }\n result.push(rule);\n }\n } else {\n if (!layerName || !layerStatementSeen.has(layerName)) {\n if (layerName) {\n layerStatementSeen.add(layerName);\n }\n result.push(rule);\n }\n }\n } else {\n result.push(rule);\n }\n }\n for (const rule of result) {\n if (rule.type === 'layer' && rule.rules && rule.rules.length) {\n rule.rules = mergeSelectorRules(rule.rules);\n }\n }\n return result;\n}\n\nexport {\n deduplicateKeyframes,\n expandPureNestedRules,\n factorCommonParents,\n mergeByDeclarations,\n mergeLayerRules,\n mergeMediaRules,\n mergeSelectorRules,\n nestFlatRules,\n removeEmptyRules\n};\n","/**\n * @file CSS named color keyword to RGB channel mapping.\n *\n * Each entry maps a lowercase CSS color keyword to an [r, g, b] array\n * with channel values in the 0–255 range, per the CSS Color Level 4 specification.\n */\n\nconst namedColors = {\n black: [0, 0, 0],\n silver: [192, 192, 192],\n gray: [128, 128, 128],\n grey: [128, 128, 128],\n white: [255, 255, 255],\n maroon: [128, 0, 0],\n red: [255, 0, 0],\n purple: [128, 0, 128],\n fuchsia: [255, 0, 255],\n green: [0, 128, 0],\n lime: [0, 255, 0],\n olive: [128, 128, 0],\n yellow: [255, 255, 0],\n navy: [0, 0, 128],\n blue: [0, 0, 255],\n teal: [0, 128, 128],\n aqua: [0, 255, 255],\n orange: [255, 165, 0],\n aliceblue: [240, 248, 255],\n antiquewhite: [250, 235, 215],\n aquamarine: [127, 255, 212],\n azure: [240, 255, 255],\n beige: [245, 245, 220],\n bisque: [255, 228, 196],\n blanchedalmond: [255, 235, 205],\n blueviolet: [138, 43, 226],\n brown: [165, 42, 42],\n burlywood: [222, 184, 135],\n cadetblue: [95, 158, 160],\n chartreuse: [127, 255, 0],\n chocolate: [210, 105, 30],\n coral: [255, 127, 80],\n cornflowerblue: [100, 149, 237],\n cornsilk: [255, 248, 220],\n crimson: [220, 20, 60],\n cyan: [0, 255, 255],\n darkblue: [0, 0, 139],\n darkcyan: [0, 139, 139],\n darkgoldenrod: [184, 134, 11],\n darkgray: [169, 169, 169],\n darkgreen: [0, 100, 0],\n darkgrey: [169, 169, 169],\n darkkhaki: [189, 183, 107],\n darkmagenta: [139, 0, 139],\n darkolivegreen: [85, 107, 47],\n darkorange: [255, 140, 0],\n darkorchid: [153, 50, 204],\n darkred: [139, 0, 0],\n darksalmon: [233, 150, 122],\n darkseagreen: [143, 188, 143],\n darkslateblue: [72, 61, 139],\n darkslategray: [47, 79, 79],\n darkslategrey: [47, 79, 79],\n darkturquoise: [0, 206, 209],\n darkviolet: [148, 0, 211],\n deeppink: [255, 20, 147],\n deepskyblue: [0, 191, 255],\n dimgray: [105, 105, 105],\n dimgrey: [105, 105, 105],\n dodgerblue: [30, 144, 255],\n firebrick: [178, 34, 34],\n floralwhite: [255, 250, 240],\n forestgreen: [34, 139, 34],\n gainsboro: [220, 220, 220],\n ghostwhite: [248, 248, 255],\n gold: [255, 215, 0],\n goldenrod: [218, 165, 32],\n greenyellow: [173, 255, 47],\n honeydew: [240, 255, 240],\n hotpink: [255, 105, 180],\n indianred: [205, 92, 92],\n indigo: [75, 0, 130],\n ivory: [255, 255, 240],\n khaki: [240, 230, 140],\n lavender: [230, 230, 250],\n lavenderblush: [255, 240, 245],\n lawngreen: [124, 252, 0],\n lemonchiffon: [255, 250, 205],\n lightblue: [173, 216, 230],\n lightcoral: [240, 128, 128],\n lightcyan: [224, 255, 255],\n lightgoldenrodyellow: [250, 250, 210],\n lightgray: [211, 211, 211],\n lightgreen: [144, 238, 144],\n lightgrey: [211, 211, 211],\n lightpink: [255, 182, 193],\n lightsalmon: [255, 160, 122],\n lightseagreen: [32, 178, 170],\n lightskyblue: [135, 206, 250],\n lightslategray: [119, 136, 153],\n lightslategrey: [119, 136, 153],\n lightsteelblue: [176, 196, 222],\n lightyellow: [255, 255, 224],\n limegreen: [50, 205, 50],\n linen: [250, 240, 230],\n magenta: [255, 0, 255],\n mediumaquamarine: [102, 205, 170],\n mediumblue: [0, 0, 205],\n mediumorchid: [186, 85, 211],\n mediumpurple: [147, 111, 219],\n mediumseagreen: [60, 179, 113],\n mediumslateblue: [123, 104, 238],\n mediumspringgreen: [0, 250, 154],\n mediumturquoise: [72, 209, 204],\n mediumvioletred: [199, 21, 133],\n midnightblue: [25, 25, 112],\n mintcream: [245, 255, 250],\n mistyrose: [255, 228, 225],\n moccasin: [255, 228, 181],\n navajowhite: [255, 222, 173],\n oldlace: [253, 245, 230],\n olivedrab: [107, 142, 35],\n orangered: [255, 69, 0],\n orchid: [218, 112, 214],\n palegoldenrod: [238, 232, 170],\n palegreen: [152, 251, 152],\n paleturquoise: [175, 238, 238],\n palevioletred: [219, 112, 147],\n papayawhip: [255, 239, 213],\n peachpuff: [255, 218, 185],\n peru: [205, 133, 63],\n pink: [255, 192, 203],\n plum: [221, 160, 221],\n powderblue: [176, 224, 230],\n rebeccapurple: [102, 51, 153],\n rosybrown: [188, 143, 143],\n royalblue: [65, 105, 225],\n saddlebrown: [139, 69, 19],\n salmon: [250, 128, 114],\n sandybrown: [244, 164, 96],\n seagreen: [46, 139, 87],\n seashell: [255, 245, 238],\n sienna: [160, 82, 45],\n skyblue: [135, 206, 235],\n slateblue: [106, 90, 205],\n slategray: [112, 128, 144],\n slategrey: [112, 128, 144],\n snow: [255, 250, 250],\n springgreen: [0, 255, 127],\n steelblue: [70, 130, 180],\n tan: [210, 180, 140],\n thistle: [216, 191, 216],\n tomato: [255, 99, 71],\n turquoise: [64, 224, 208],\n violet: [238, 130, 238],\n wheat: [245, 222, 179],\n whitesmoke: [245, 245, 245],\n yellowgreen: [154, 205, 50]\n};\n\nexport { namedColors };\n","/**\n * @file Shared numeric formatting and unit conversion utilities used across CSS value minification.\n */\n\n/**\n * Formats a number as a compact string, stripping leading zeros before decimal points (e.g. 0.5 becomes .5).\n *\n * @param {number|string} value The numeric value to format.\n * @return {string} The compact string representation.\n */\nfunction formatCompactNumber (value) {\n let result = String(Number(value));\n if (result.startsWith('0.')) {\n result = result.slice(1);\n }\n if (result.startsWith('-0.')) {\n result = '-' + result.slice(2);\n }\n return result;\n}\n\n/**\n * Converts a percentage scale component to its decimal equivalent (e.g. \"150%\" becomes \"1.5\"), or returns the value unchanged if it is not a percentage.\n *\n * @param {string} value The scale component string, possibly ending in %.\n * @return {string} The normalized decimal string.\n */\nfunction normalizeScaleComponent (value) {\n const trimmed = value.trim();\n // Match a percentage value (e.g. \"150%\", \"-50%\") and capture the numeric portion\n const percentMatch = trimmed.match(/^(-?(?:\\d+|\\d*\\.\\d+))%$/);\n if (!percentMatch) {\n return trimmed;\n }\n return formatCompactNumber(parseFloat(percentMatch[1]) / 100);\n}\n\n/**\n * Rounds a number to the given decimal precision and formats it compactly, removing trailing zeros and leading zeros before the decimal point.\n *\n * @param {number|string} value The numeric value to round and format.\n * @param {number} precision The number of decimal places to keep.\n * @return {string} The rounded and compact string representation.\n */\nfunction roundCompactNumber (value, precision = 3) {\n const number = typeof value === 'number' ? value : parseFloat(value);\n if (!Number.isFinite(number)) {\n return String(value);\n }\n // Strip trailing zeros and trailing decimal point from the fixed-precision string\n let result = number.toFixed(precision).replace(/0+$/, '').replace(/\\.$/, '');\n if (result.startsWith('0.')) {\n result = result.slice(1);\n }\n if (result.startsWith('-0.')) {\n result = '-' + result.slice(2);\n }\n return result;\n}\n\n/**\n * Converts an absolute CSS length value (pt, pc, in, cm, mm, q) to its pixel equivalent using standard conversion factors.\n *\n * @param {number|string} value The numeric length value to convert.\n * @param {string} unit The CSS length unit (e.g. \"pt\", \"in\", \"cm\").\n * @return {number|null} The pixel equivalent, or null if the unit is unrecognized or the value is not finite.\n */\nfunction convertAbsoluteLengthToPx (value, unit) {\n const numeric = typeof value === 'number' ? value : parseFloat(value);\n const conversionMap = {\n px: 1,\n pt: 96 / 72,\n pc: 16,\n in: 96,\n cm: 96 / 2.54,\n mm: 96 / 25.4,\n q: 96 / 101.6\n };\n const factor = conversionMap[unit.toLowerCase()];\n if (!factor || !Number.isFinite(numeric)) {\n return null;\n }\n return numeric * factor;\n}\n\n/**\n * Formats a numeric value with its CSS unit as a compact string, rounding to the specified precision.\n *\n * @param {number} value The numeric dimension value.\n * @param {string} unit The CSS unit suffix (e.g. \"px\", \"%\").\n * @param {number} precision The number of decimal places to keep.\n * @return {string} The formatted dimension string.\n */\nfunction formatDimension (value, unit, precision = 3) {\n return roundCompactNumber(value, precision) + unit;\n}\n\n/**\n * Parses a CSS alpha string (e.g. \"0.5\", \"50%\") into a numeric 0–1 value.\n * If the string is undefined or null, returns the provided fallback.\n *\n * @param {string|undefined} alphaStr The alpha string, optionally ending in \"%\".\n * @param {number} fallback The value to return when alphaStr is absent.\n * @return {number} The parsed alpha value in the 0–1 range.\n */\nfunction parseAlphaString (alphaStr, fallback = 1) {\n if (alphaStr === undefined || alphaStr === null) {\n return fallback;\n }\n if (alphaStr.endsWith('%')) {\n return parseFloat(alphaStr) / 100;\n }\n return parseFloat(alphaStr);\n}\n\n/**\n * Collapses redundant CSS shorthand parts using the standard box-model\n * reduction rules: 4-value → 3-value → 2-value → 1-value.\n *\n * For example, `[\"10px\", \"5px\", \"10px\", \"5px\"]` becomes `[\"10px\", \"5px\"]`.\n *\n * @param {Array} parts The array of shorthand value strings to collapse in place.\n * @return {Array} The same array, mutated with redundant entries removed.\n */\nfunction collapseShorthandParts (parts) {\n if (parts.length === 4 && parts[1] === parts[3]) {\n parts.splice(3, 1);\n }\n if (parts.length === 3 && parts[0] === parts[2]) {\n parts.splice(2, 1);\n }\n if (parts.length === 2 && parts[0] === parts[1]) {\n parts.splice(1, 1);\n }\n return parts;\n}\n\nexport {\n collapseShorthandParts,\n convertAbsoluteLengthToPx,\n formatCompactNumber,\n formatDimension,\n normalizeScaleComponent,\n parseAlphaString,\n roundCompactNumber\n};\n","/**\n * @file Provides color parsing, color space conversion (sRGB, OKLab, OKLCH, HSL, HWB), color-mix evaluation, and hex formatting for CSS value minification.\n */\n\nimport { namedColors } from './named-colors.js';\nimport {\n parseAlphaString,\n roundCompactNumber\n} from './shared.js';\n\n/**\n * Reverse lookup from \"r,g,b\" to the shortest CSS named color keyword.\n * Built once at module load from the namedColors map.\n *\n * @type {Map<string, string>}\n */\nconst rgbToShortestName = new Map();\nfor (const [name, channels] of Object.entries(namedColors)) {\n const key = channels[0] + ',' + channels[1] + ',' + channels[2];\n const existing = rgbToShortestName.get(key);\n if (!existing || name.length < existing.length) {\n rgbToShortestName.set(key, name);\n }\n}\n\n/**\n * Converts HSL color values to RGB channel values in the 0–255 range.\n *\n * @param {number} hue The hue angle in degrees.\n * @param {number} saturation The saturation as a fraction from 0 to 1.\n * @param {number} lightness The lightness as a fraction from 0 to 1.\n * @return {Array} An array of [r, g, b] channel values, each 0–255.\n */\nfunction hslToRgbChannels (hue, saturation, lightness) {\n const normalizedHue = (((hue % 360) + 360) % 360) / 360;\n const normalizedSaturation = Math.max(0, Math.min(1, saturation));\n const normalizedLightness = Math.max(0, Math.min(1, lightness));\n\n if (normalizedSaturation === 0) {\n const channel = Math.round(normalizedLightness * 255);\n return [channel, channel, channel];\n }\n\n const hue2rgb = (p, q, t) => {\n if (t < 0) {\n t += 1;\n }\n if (t > 1) {\n t -= 1;\n }\n if (t < 1 / 6) {\n return p + (q - p) * 6 * t;\n }\n if (t < 1 / 2) {\n return q;\n }\n if (t < 2 / 3) {\n return p + (q - p) * (2 / 3 - t) * 6;\n }\n return p;\n };\n\n const q = normalizedLightness < 0.5 ?\n normalizedLightness * (1 + normalizedSaturation) :\n normalizedLightness + normalizedSaturation - normalizedLightness * normalizedSaturation;\n const p = 2 * normalizedLightness - q;\n\n return [\n Math.round(hue2rgb(p, q, normalizedHue + 1 / 3) * 255),\n Math.round(hue2rgb(p, q, normalizedHue) * 255),\n Math.round(hue2rgb(p, q, normalizedHue - 1 / 3) * 255)\n ];\n}\n\n/**\n * Converts RGBA channel values to a hex color string, omitting the alpha suffix when fully opaque.\n *\n * @param {number} r The red channel value, 0–255.\n * @param {number} g The green channel value, 0–255.\n * @param {number} b The blue channel value, 0–255.\n * @param {number} alpha The alpha value from 0 to 1.\n * @return {string} A hex color string like \"#rrggbb\" or \"#rrggbbaa\".\n */\nfunction rgbaToHex (r, g, b, alpha = 1) {\n const rgbHex = [r, g, b].map((channel) => {\n const value = Math.max(0, Math.min(255, Math.round(channel)));\n return value.toString(16).padStart(2, '0');\n }).join('');\n const normalizedAlpha = Math.max(0, Math.min(1, alpha));\n const alphaByte = Math.round(normalizedAlpha * 255);\n const alphaHex = alphaByte === 255 ? '' : alphaByte.toString(16).padStart(2, '0');\n return '#' + rgbHex + alphaHex;\n}\n\n/**\n * Finds the shortest CSS representation of an RGBA color by comparing\n * the full hex, shortened hex (collapsed digit pairs), and any matching\n * named color keyword. Prefers hex when representations tie in length.\n *\n * @param {number} r The red channel value, 0–255.\n * @param {number} g The green channel value, 0–255.\n * @param {number} b The blue channel value, 0–255.\n * @param {number} alpha The alpha value from 0 to 1.\n * @return {string} The shortest CSS color string.\n */\nfunction shortestColor (r, g, b, alpha = 1) {\n r = Math.max(0, Math.min(255, Math.round(r)));\n g = Math.max(0, Math.min(255, Math.round(g)));\n b = Math.max(0, Math.min(255, Math.round(b)));\n alpha = Math.max(0, Math.min(1, alpha));\n\n const fullHex = rgbaToHex(r, g, b, alpha);\n\n // Try collapsing identical hex digit pairs: #rrggbbaa → #rgba, #rrggbb → #rgb\n let shortest = fullHex;\n const match8 = fullHex.match(/^#([0-9a-f])\\1([0-9a-f])\\2([0-9a-f])\\3([0-9a-f])\\4$/);\n if (match8) {\n shortest = '#' + match8[1] + match8[2] + match8[3] + match8[4];\n } else {\n const match6 = fullHex.match(/^#([0-9a-f])\\1([0-9a-f])\\2([0-9a-f])\\3$/);\n if (match6) {\n shortest = '#' + match6[1] + match6[2] + match6[3];\n }\n }\n\n // Check named colors (only fully opaque colors have named equivalents)\n const alphaByte = Math.round(alpha * 255);\n if (alphaByte === 255) {\n const key = r + ',' + g + ',' + b;\n const name = rgbToShortestName.get(key);\n if (name && name.length < shortest.length) {\n shortest = name;\n }\n }\n\n return shortest;\n}\n\n/**\n * Converts HWB (hue, whiteness, blackness) color values to RGB channel values in the 0–255 range.\n *\n * @param {number} hue The hue angle in degrees.\n * @param {number} whiteness The whiteness as a fraction from 0 to 1.\n * @param {number} blackness The blackness as a fraction from 0 to 1.\n * @return {Array} An array of [r, g, b] channel values, each 0–255.\n */\nfunction hwbToRgbChannels (hue, whiteness, blackness) {\n let w = Math.max(0, Math.min(1, whiteness));\n let b = Math.max(0, Math.min(1, blackness));\n\n if (w + b >= 1) {\n const gray = Math.round((w / (w + b)) * 255);\n return [gray, gray, gray];\n }\n\n const [r, g, bl] = hslToRgbChannels(hue, 1, 0.5);\n const ratio = 1 - w - b;\n return [\n Math.round(r / 255 * ratio * 255 + w * 255),\n Math.round(g / 255 * ratio * 255 + w * 255),\n Math.round(bl / 255 * ratio * 255 + w * 255)\n ];\n}\n\n/**\n * Converts a gamma-encoded sRGB component to linear light using the sRGB transfer function.\n *\n * @param {number} c The gamma-encoded sRGB component, 0 to 1.\n * @return {number} The linearized component value.\n */\nfunction linearize (c) {\n return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n}\n\n/**\n * Applies sRGB gamma encoding to a linear-light component, the inverse of linearize.\n *\n * @param {number} c The linear-light component, 0 to 1.\n * @return {number} The gamma-encoded sRGB component value.\n */\nfunction delinearize (c) {\n return c <= 0.0031308 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;\n}\n\n/**\n * Converts sRGB color components (0–1) to the OKLab perceptual color space.\n *\n * @param {number} r The red component, 0 to 1.\n * @param {number} g The green component, 0 to 1.\n * @param {number} b The blue component, 0 to 1.\n * @return {object} An object with L, a, b OKLab components.\n */\nfunction srgbToOklab (r, g, b) {\n const lr = linearize(r);\n const lg = linearize(g);\n const lb = linearize(b);\n\n const l_ = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);\n const m_ = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);\n const s_ = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);\n\n return {\n L: 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_,\n a: 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_,\n b: 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_\n };\n}\n\n/**\n * Converts OKLab color components to unclamped linear sRGB, used for gamut-boundary checking.\n *\n * @param {number} L The OKLab lightness component.\n * @param {number} a The OKLab green-red axis component.\n * @param {number} b The OKLab blue-yellow axis component.\n * @return {object} An object with r, g, b linear sRGB components (may exceed 0–1).\n */\nfunction oklabToLinearSrgb (L, a, b) {\n const l_ = L + 0.3963377774 * a + 0.2158037573 * b;\n const m_ = L - 0.1055613458 * a - 0.0638541728 * b;\n const s_ = L - 0.0894841775 * a - 1.2914855480 * b;\n\n const l = l_ * l_ * l_;\n const m = m_ * m_ * m_;\n const s = s_ * s_ * s_;\n\n return {\n r: +4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n g: -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n b: -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s\n };\n}\n\n/**\n * Converts OKLab color components to clamped, gamma-encoded sRGB (0–1).\n *\n * @param {number} L The OKLab lightness component.\n * @param {number} a The OKLab green-red axis component.\n * @param {number} b The OKLab blue-yellow axis component.\n * @return {object} An object with r, g, b sRGB components, each clamped to 0–1.\n */\nfunction oklabToSrgb (L, a, b) {\n const linear = oklabToLinearSrgb(L, a, b);\n return {\n r: Math.max(0, Math.min(1, delinearize(linear.r))),\n g: Math.max(0, Math.min(1, delinearize(linear.g))),\n b: Math.max(0, Math.min(1, delinearize(linear.b)))\n };\n}\n\n/**\n * Converts OKLab color components to the OKLCH cylindrical representation.\n *\n * @param {number} L The OKLab lightness component.\n * @param {number} a The OKLab green-red axis component.\n * @param {number} b The OKLab blue-yellow axis component.\n * @return {object} An object with L (lightness), C (chroma), H (hue in degrees).\n */\nfunction oklabToOklch (L, a, b) {\n const C = Math.sqrt(a * a + b * b);\n let H = Math.atan2(b, a) * (180 / Math.PI);\n if (H < 0) {\n H += 360;\n }\n return { L, C, H };\n}\n\n/**\n * Converts OKLCH cylindrical color components back to OKLab rectangular coordinates.\n *\n * @param {number} L The OKLCH lightness component.\n * @param {number} C The chroma value.\n * @param {number} H The hue angle in degrees.\n * @return {object} An object with L, a, b OKLab components.\n */\nfunction oklchToOklab (L, C, H) {\n const hRad = H * Math.PI / 180;\n return {\n L,\n a: C * Math.cos(hRad),\n b: C * Math.sin(hRad)\n };\n}\n\n/**\n * Interpolates between two hue angles along the shorter arc, per the CSS Color specification.\n *\n * @param {number} h1 The first hue angle in degrees.\n * @param {number} h2 The second hue angle in degrees.\n * @param {number} t The interpolation factor from 0 to 1.\n * @return {number} The interpolated hue angle in degrees, normalized to 0–360.\n */\nfunction interpolateHueShorter (h1, h2, t) {\n let diff = h2 - h1;\n if (diff > 180) {\n diff -= 360;\n }\n if (diff < -180) {\n diff += 360;\n }\n let result = h1 + diff * t;\n return ((result % 360) + 360) % 360;\n}\n\n/**\n * Parse a hex color string to [r, g, b, a].\n *\n * @param {string} hex The hex color string (3, 4, 6, or 8 hex digits, with or without leading #).\n * @return {Array|null} An [r, g, b, a] array (r,g,b: 0–255, a: 0–1), or null for invalid lengths.\n */\nfunction parseHex (hex) {\n // Strip leading # from hex string\n hex = hex.replace(/^#/, '');\n if (hex.length === 3) {\n return [parseInt(hex[0] + hex[0], 16), parseInt(hex[1] + hex[1], 16), parseInt(hex[2] + hex[2], 16), 1];\n }\n if (hex.length === 4) {\n return [parseInt(hex[0] + hex[0], 16), parseInt(hex[1] + hex[1], 16), parseInt(hex[2] + hex[2], 16), parseInt(hex[3] + hex[3], 16) / 255];\n }\n if (hex.length === 6) {\n return [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16), 1];\n }\n if (hex.length === 8) {\n return [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16), parseInt(hex.slice(6, 8), 16) / 255];\n }\n return null;\n}\n\n/**\n * Parse a CSS color string to [r, g, b, a] (r,g,b: 0-255, a: 0-1) or null if unresolvable.\n *\n * @param {string} colorString The CSS color string (named, hex, rgb, rgba, hsl, hsla, or hwb).\n * @return {Array|null} An [r, g, b, a] array, or null if the color cannot be parsed.\n */\nfunction parseColor (colorString) {\n let normalized = colorString.trim().toLowerCase();\n\n // Handle 'none' keyword in channels\n normalized = normalized.replace(/\\bnone\\b/g, '0');\n\n // Named color\n if (namedColors[normalized]) {\n return [...namedColors[normalized], 1];\n }\n\n // Hex\n if (normalized.startsWith('#')) {\n return parseHex(normalized);\n }\n\n // rgb() / rgba() space syntax\n let match = normalized.match(/^rgba?\\(\\s*(-?[\\d.]+)\\s+(-?[\\d.]+)\\s+(-?[\\d.]+)(?:\\s*\\/\\s*(-?[\\d.]+%?))?\\s*\\)$/);\n if (match) {\n const r = Math.round(parseFloat(match[1]));\n const g = Math.round(parseFloat(match[2]));\n const b = Math.round(parseFloat(match[3]));\n return [r, g, b, Math.max(0, Math.min(1, parseAlphaString(match[4])))];\n }\n\n // rgb() / rgba() comma syntax\n match = normalized.match(/^rgba?\\(\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)(?:\\s*,\\s*(-?[\\d.]+%?))?\\s*\\)$/);\n if (match) {\n const r = Math.round(parseFloat(match[1]));\n const g = Math.round(parseFloat(match[2]));\n const b = Math.round(parseFloat(match[3]));\n return [r, g, b, Math.max(0, Math.min(1, parseAlphaString(match[4])))];\n }\n\n // hsl() / hsla() space syntax\n match = normalized.match(/^hsla?\\(\\s*(-?[\\d.]+)\\s+([\\d.]+)%\\s+([\\d.]+)%(?:\\s*\\/\\s*(-?[\\d.]+%?))?\\s*\\)$/);\n if (match) {\n const [r, g, b] = hslToRgbChannels(parseFloat(match[1]), parseFloat(match[2]) / 100, parseFloat(match[3]) / 100);\n return [r, g, b, Math.max(0, Math.min(1, parseAlphaString(match[4])))];\n }\n\n // hsl() / hsla() comma syntax\n match = normalized.match(/^hsla?\\(\\s*(-?[\\d.]+)\\s*,\\s*([\\d.]+)%\\s*,\\s*([\\d.]+)%(?:\\s*,\\s*(-?[\\d.]+%?))?\\s*\\)$/);\n if (match) {\n const [r, g, b] = hslToRgbChannels(parseFloat(match[1]), parseFloat(match[2]) / 100, parseFloat(match[3]) / 100);\n return [r, g, b, Math.max(0, Math.min(1, parseAlphaString(match[4])))];\n }\n\n // hwb()\n match = normalized.match(/^hwb\\(\\s*(-?[\\d.]+)\\s+([\\d.]+)%\\s+([\\d.]+)%(?:\\s*\\/\\s*(-?[\\d.]+%?))?\\s*\\)$/);\n if (match) {\n const [r, g, b] = hwbToRgbChannels(parseFloat(match[1]), parseFloat(match[2]) / 100, parseFloat(match[3]) / 100);\n return [r, g, b, Math.max(0, Math.min(1, parseAlphaString(match[4])))];\n }\n\n return null;\n}\n\n/**\n * Convert [r, g, b] (0-255) to OKLab {L, a, b}.\n *\n * @param {number} r The red channel value, 0–255.\n * @param {number} g The green channel value, 0–255.\n * @param {number} b The blue channel value, 0–255.\n * @return {object} An object with L, a, b OKLab components.\n */\nfunction rgbToOklab (r, g, b) {\n return srgbToOklab(r / 255, g / 255, b / 255);\n}\n\n/**\n * Convert [r, g, b] (0-255) to OKLCH {L, C, H}.\n *\n * @param {number} r The red channel value, 0–255.\n * @param {number} g The green channel value, 0–255.\n * @param {number} b The blue channel value, 0–255.\n * @return {object} An object with L (lightness), C (chroma), H (hue in degrees).\n */\nfunction rgbToOklch (r, g, b) {\n const lab = rgbToOklab(r, g, b);\n return oklabToOklch(lab.L, lab.a, lab.b);\n}\n\n/**\n * Convert OKLab {L, a, b} to [r, g, b] (0-255).\n *\n * @param {number} L The OKLab lightness component.\n * @param {number} a The OKLab green-red axis component.\n * @param {number} b The OKLab blue-yellow axis component.\n * @return {Array} An [r, g, b] array with channel values 0–255.\n */\nfunction oklabToRgb (L, a, b) {\n const srgb = oklabToSrgb(L, a, b);\n return [Math.round(srgb.r * 255), Math.round(srgb.g * 255), Math.round(srgb.b * 255)];\n}\n\n/**\n * Format an OKLCH result as a minified string.\n *\n * @param {number} L The lightness component.\n * @param {number} C The chroma component.\n * @param {number} H The hue angle in degrees.\n * @param {number|undefined} alpha The alpha value from 0 to 1, or undefined for fully opaque.\n * @return {string} A minified oklch() function string.\n */\nfunction formatOklch (L, C, H, alpha) {\n const fmtL = roundCompactNumber(L, 3);\n const fmtC = roundCompactNumber(C, 3);\n const fmtH = roundCompactNumber(H, 1);\n if (alpha !== undefined && alpha < 1) {\n return 'oklch(' + fmtL + ' ' + fmtC + ' ' + fmtH + '/' + roundCompactNumber(alpha, 3) + ')';\n }\n return 'oklch(' + fmtL + ' ' + fmtC + ' ' + fmtH + ')';\n}\n\n/**\n * Detect which channel indices have 'none' in a raw color function string.\n *\n * @param {string} rawColorStr The raw CSS color function string (e.g. \"rgb(none 0 0)\").\n * @return {Array} An array of zero-based channel indices where 'none' was found.\n */\nfunction findNoneChannels (rawColorStr) {\n const indices = [];\n // Match rgb/rgba/hsl/hsla/hwb function calls and extract their arguments\n const functionMatch = rawColorStr.match(/\\b(?:rgba?|hsla?|hwb)\\(([^)]*)\\)/i);\n if (functionMatch) {\n // Split arguments on whitespace, commas, or slash separators\n const parts = functionMatch[1].trim().split(/[\\s,/]+/).map((part) => {\n return part.trim();\n }).filter((part) => {\n return part.length > 0;\n });\n parts.forEach((part, index) => {\n if (part.toLowerCase() === 'none') {\n indices.push(index);\n }\n });\n }\n return indices;\n}\n\n/**\n * Evaluate an N-color (3+) color-mix() expression. Returns a minified CSS color string or null.\n *\n * @param {string} colorSpace The interpolation color space (\"srgb\", \"oklab\", or \"oklch\").\n * @param {Array} args The raw argument strings for each color.\n * @return {string|null} A minified CSS color string, or null if the expression cannot be evaluated.\n */\nfunction evaluateNColorMix (colorSpace, args) {\n const parsedArgs = [];\n for (const arg of args) {\n const parsed = parseColorMixArg(arg.trim());\n if (!parsed) {\n return null;\n }\n parsedArgs.push(parsed);\n }\n\n // If any color is unresolvable (var(), currentcolor), whitespace-strip only\n if (parsedArgs.some((parsedArg) => {\n return !parsedArg.color;\n })) {\n return normalizeUnresolvableNColorMix(colorSpace, parsedArgs);\n }\n\n const percentages = normalizeNColorPercentages(parsedArgs);\n const percentageSum = percentages.reduce((sum, value) => {\n return sum + value;\n }, 0);\n\n // All-zero percentages → transparent black\n if (percentageSum === 0) {\n return rgbaToHex(0, 0, 0, 0);\n }\n\n let alphaMultiplier = 1;\n if (percentageSum < 100) {\n alphaMultiplier = percentageSum / 100;\n } else if (percentageSum > 100) {\n for (let i = 0; i < percentages.length; i++) {\n percentages[i] = percentages[i] / percentageSum * 100;\n }\n }\n\n // Compute weights\n const totalPercentage = percentages.reduce((sum, value) => {\n return sum + value;\n }, 0);\n const weights = percentages.map((value) => {\n return value / totalPercentage;\n });\n const colors = parsedArgs.map((parsedArg) => {\n return parsedArg.color;\n });\n\n if (colorSpace === 'srgb') {\n return mixNColorsSrgb(colors, weights, alphaMultiplier);\n }\n\n if (colorSpace === 'oklab') {\n return mixNColorsOklab(colors, weights, alphaMultiplier);\n }\n\n return null;\n}\n\n/**\n * Normalize percentages for an N-color color-mix() expression.\n * When no percentages are specified, each color gets an equal share of 100%.\n * When some are unspecified, the remaining percentage is split equally among them.\n *\n * @param {Array} parsedArgs The parsed color-mix arguments.\n * @return {Array} An array of normalized percentage values.\n */\nfunction normalizeNColorPercentages (parsedArgs) {\n const percentages = parsedArgs.map((parsedArg) => {\n return parsedArg.percentage;\n });\n if (percentages.every((value) => {\n return value === null;\n })) {\n const equalWeight = 100 / parsedArgs.length;\n return parsedArgs.map(() => {\n return equalWeight;\n });\n }\n const specifiedSum = percentages.reduce((sum, value) => {\n return sum + (value !== null ? value : 0);\n }, 0);\n const unspecifiedCount = percentages.filter((value) => {\n return value === null;\n }).length;\n if (unspecifiedCount > 0) {\n const remaining = Math.max(0, 100 - specifiedSum);\n const percentagePerUnspecified = remaining / unspecifiedCount;\n return percentages.map((value) => {\n return value !== null ? value : percentagePerUnspecified;\n });\n }\n return percentages;\n}\n\n/**\n * Build a whitespace-stripped color-mix() string for an unresolvable N-color expression.\n *\n * @param {string} colorSpace The interpolation color space.\n * @param {Array} parsedArgs The parsed color-mix arguments.\n * @return {string} A whitespace-stripped color-mix() expression.\n */\nfunction normalizeUnresolvableNColorMix (colorSpace, parsedArgs) {\n const parts = parsedArgs.map((parsedArg) => {\n const rawColor = parsedArg.raw.trim();\n const percentageString = parsedArg.percentage !== null ? ' ' + parsedArg.percentage + '%' : '';\n return rawColor + percentageString;\n });\n return 'color-mix(in ' + colorSpace + ',' + parts.join(',') + ')';\n}\n\n/**\n * Mix N colors in the sRGB color space using weighted averages.\n *\n * @param {Array} colors Array of [r, g, b, a] color arrays.\n * @param {Array} weights Array of weight values for each color.\n * @param {number} alphaMultiplier Multiplier for the final alpha channel.\n * @return {string} A hex color string.\n */\nfunction mixNColorsSrgb (colors, weights, alphaMultiplier) {\n let r = 0;\n let g = 0;\n let b = 0;\n let alpha = 0;\n for (let i = 0; i < colors.length; i++) {\n r += colors[i][0] * weights[i];\n g += colors[i][1] * weights[i];\n b += colors[i][2] * weights[i];\n alpha += colors[i][3] * weights[i];\n }\n return rgbaToHex(Math.round(r), Math.round(g), Math.round(b), alpha * alphaMultiplier);\n}\n\n/**\n * Mix N colors in the OKLab color space using weighted averages.\n *\n * @param {Array} colors Array of [r, g, b, a] color arrays.\n * @param {Array} weights Array of weight values for each color.\n * @param {number} alphaMultiplier Multiplier for the final alpha channel.\n * @return {string} A hex color string.\n */\nfunction mixNColorsOklab (colors, weights, alphaMultiplier) {\n const oklabValues = colors.map((color) => {\n return rgbToOklab(color[0], color[1], color[2]);\n });\n let L = 0;\n let a = 0;\n let b = 0;\n let alpha = 0;\n for (let i = 0; i < oklabValues.length; i++) {\n L += oklabValues[i].L * weights[i];\n a += oklabValues[i].a * weights[i];\n b += oklabValues[i].b * weights[i];\n alpha += colors[i][3] * weights[i];\n }\n alpha *= alphaMultiplier;\n const rgb = oklabToRgb(L, a, b);\n return rgbaToHex(rgb[0], rgb[1], rgb[2], alpha >= 1 ? 1 : alpha);\n}\n\n/**\n * Evaluate a color-mix() expression. Returns a minified CSS color string or null.\n *\n * @param {string} expr The full color-mix() expression string.\n * @return {string|null} A minified CSS color string, or null if the expression cannot be evaluated.\n */\nfunction evaluateColorMix (expr) {\n // Parse: color-mix(in <space> [<hue-method>], <color> [<p>%], <color> [<p>%])\n // We need to handle nested parentheses for inner color functions\n const inner = extractBalancedArgs(expr, 'color-mix');\n if (!inner) {\n return null;\n }\n\n // Parse the interpolation method\n const inMatch = inner.match(/^in\\s+(srgb|oklch|oklab)(?:\\s+shorter\\s+hue)?\\s*,\\s*/i);\n if (!inMatch) {\n return null;\n }\n\n const colorSpace = inMatch[1].toLowerCase();\n const rest = inner.slice(inMatch[0].length);\n\n // Split color arguments (handling nested parens)\n const args = splitColorMixArgs(rest);\n if (args.length < 2) {\n return null;\n }\n\n // N-color path (3+ colors)\n if (args.length > 2) {\n return evaluateNColorMix(colorSpace, args);\n }\n\n // Parse each argument: \"<color> [<percentage>]\"\n const parsed1 = parseColorMixArg(args[0].trim());\n const parsed2 = parseColorMixArg(args[1].trim());\n if (!parsed1 || !parsed2) {\n return null;\n }\n\n // Check for unresolvable colors (var(), currentcolor, etc.)\n if (!parsed1.color || !parsed2.color) {\n // Can still do normalization but not computation\n return normalizeColorMix(colorSpace, parsed1, parsed2);\n }\n\n // Normalize percentages per CSS spec\n let p1 = parsed1.percentage;\n let p2 = parsed2.percentage;\n\n if (p1 === null && p2 === null) {\n p1 = 50;\n p2 = 50;\n } else if (p1 === null) {\n p1 = 100 - p2;\n } else if (p2 === null) {\n p2 = 100 - p1;\n }\n\n let alphaMultiplier = 1;\n const pSum = p1 + p2;\n if (pSum === 0) {\n return null;\n }\n\n if (pSum < 100) {\n alphaMultiplier = pSum / 100;\n } else if (pSum > 100) {\n p1 = p1 / pSum * 100;\n p2 = p2 / pSum * 100;\n }\n\n // Trivial cases\n if (p1 === 0) {\n return rgbaToHex(parsed2.color[0], parsed2.color[1], parsed2.color[2], parsed2.color[3]);\n }\n if (p2 === 0) {\n return rgbaToHex(parsed1.color[0], parsed1.color[1], parsed1.color[2], parsed1.color[3]);\n }\n\n // CSS spec: 'none' channels are missing — fill from the other color before mixing\n const nones1 = findNoneChannels(parsed1.raw);\n const nones2 = findNoneChannels(parsed2.raw);\n for (const idx of nones1) {\n if (idx < parsed1.color.length) {\n parsed1.color[idx] = parsed2.color[idx];\n }\n }\n for (const idx of nones2) {\n if (idx < parsed2.color.length) {\n parsed2.color[idx] = parsed1.color[idx];\n }\n }\n\n const t1 = p1 / (p1 + p2);\n const t2 = p2 / (p1 + p2);\n const [r1, g1, b1, a1] = parsed1.color;\n const [r2, g2, b2, a2] = parsed2.color;\n\n if (colorSpace === 'srgb') {\n const r = Math.round(r1 * t1 + r2 * t2);\n const g = Math.round(g1 * t1 + g2 * t2);\n const b = Math.round(b1 * t1 + b2 * t2);\n const a = (a1 * t1 + a2 * t2) * alphaMultiplier;\n return rgbaToHex(r, g, b, a);\n }\n\n if (colorSpace === 'oklab') {\n const lab1 = rgbToOklab(r1, g1, b1);\n const lab2 = rgbToOklab(r2, g2, b2);\n const L = lab1.L * t1 + lab2.L * t2;\n const a = lab1.a * t1 + lab2.a * t2;\n const b = lab1.b * t1 + lab2.b * t2;\n const alpha = (a1 * t1 + a2 * t2) * alphaMultiplier;\n // Check if result fits in sRGB gamut\n const rgb = oklabToRgb(L, a, b);\n if (alpha >= 1) {\n return rgbaToHex(rgb[0], rgb[1], rgb[2], 1);\n }\n return rgbaToHex(rgb[0], rgb[1], rgb[2], alpha);\n }\n\n if (colorSpace === 'oklch') {\n const lch1 = rgbToOklch(r1, g1, b1);\n const lch2 = rgbToOklch(r2, g2, b2);\n const L = lch1.L * t1 + lch2.L * t2;\n const C = lch1.C * t1 + lch2.C * t2;\n const H = interpolateHueShorter(lch1.H, lch2.H, t2);\n const alpha = (a1 * t1 + a2 * t2) * alphaMultiplier;\n return formatOklch(L, C, H, alpha);\n }\n\n return null;\n}\n\n/**\n * Extract the balanced content inside a function call.\n *\n * @param {string} expr The expression string containing the function call.\n * @param {string} funcName The function name to locate (e.g. \"color-mix\").\n * @return {string|null} The content between the matching parentheses, or null if not found.\n */\nfunction extractBalancedArgs (expr, funcName) {\n const prefix = funcName + '(';\n const start = expr.indexOf(prefix);\n if (start === -1) {\n return null;\n }\n let depth = 1;\n let position = start + prefix.length;\n while (position < expr.length && depth > 0) {\n if (expr[position] === '(') {\n depth++;\n } else if (expr[position] === ')') {\n depth--;\n }\n position++;\n }\n return expr.slice(start + prefix.length, position - 1);\n}\n\n/**\n * Split color-mix arguments at top-level commas (handling nested parens).\n *\n * @param {string} str The color arguments string, with arguments separated by commas.\n * @return {Array} An array of argument strings split at each top-level comma.\n */\nfunction splitColorMixArgs (str) {\n const args = [];\n let depth = 0;\n let start = 0;\n for (let position = 0; position < str.length; position++) {\n if (str[position] === '(') {\n depth++;\n } else if (str[position] === ')') {\n depth--;\n } else if (str[position] === ',' && depth === 0) {\n args.push(str.slice(start, position));\n start = position + 1;\n }\n }\n args.push(str.slice(start));\n return args;\n}\n\n/**\n * Parse a single color-mix argument: \"<color> [<percentage>]\" or \"<percentage> <color>\".\n *\n * @param {string} arg The color-mix argument string to parse.\n * @return {object|null} An object with color (Array or null), percentage (number or null), raw (string), and hasVar (boolean), or null if unparseable.\n */\nfunction parseColorMixArg (arg) {\n arg = arg.trim();\n\n // Try: percentage at end, e.g. \"red 50%\" or \"rgb(0 0 0)50%\"\n let match = arg.match(/^(.+?)\\s*(\\d+(?:\\.\\d+)?)%\\s*$/);\n if (match) {\n const colorStr = match[1].trim();\n const percentage = parseFloat(match[2]);\n const color = parseColor(colorStr);\n // Check if color contains var() or currentcolor (cannot be evaluated statically)\n return { color, percentage, raw: colorStr, hasVar: /var\\(|currentcolor/i.test(colorStr) };\n }\n\n // Try: percentage at start, e.g. \"50% red\"\n match = arg.match(/^(\\d+(?:\\.\\d+)?)%\\s+(.+)$/);\n if (match) {\n const colorStr = match[2].trim();\n const percentage = parseFloat(match[1]);\n const color = parseColor(colorStr);\n // Check if color contains var() or currentcolor (cannot be evaluated statically)\n return { color, percentage, raw: colorStr, hasVar: /var\\(|currentcolor/i.test(colorStr) };\n }\n\n // No percentage\n const color = parseColor(arg);\n // Check if color contains var() or currentcolor (cannot be evaluated statically)\n return { color, percentage: null, raw: arg, hasVar: /var\\(|currentcolor/i.test(arg) };\n}\n\n/**\n * Normalize a color-mix expression when we can't fully compute it.\n *\n * @param {string} colorSpace The interpolation color space (\"srgb\", \"oklab\", or \"oklch\").\n * @param {object} parsed1 The parsed first color argument with color, percentage, and raw fields.\n * @param {object} parsed2 The parsed second color argument with color, percentage, and raw fields.\n * @return {string} A normalized color-mix() expression with default percentages and color space elided.\n */\nfunction normalizeColorMix (colorSpace, parsed1, parsed2) {\n // Normalize percentages: strip explicit 50%/50% (the defaults)\n let p1Str = '';\n let p2Str = '';\n if (parsed1.percentage !== null && parsed1.percentage !== 50) {\n p1Str = ' ' + parsed1.percentage + '%';\n }\n if (parsed2.percentage !== null && parsed2.percentage !== 50) {\n p2Str = ' ' + parsed2.percentage + '%';\n }\n\n // Use the raw color strings (but try to minify known colors)\n let c1 = parsed1.raw;\n let c2 = parsed2.raw;\n if (parsed1.color) {\n c1 = rgbaToHex(parsed1.color[0], parsed1.color[1], parsed1.color[2], parsed1.color[3]);\n }\n if (parsed2.color) {\n c2 = rgbaToHex(parsed2.color[0], parsed2.color[1], parsed2.color[2], parsed2.color[3]);\n }\n\n // oklab is the default interpolation method per CSS Color 5 — elide it\n const spacePrefix = colorSpace === 'oklab' ? '' : 'in ' + colorSpace + ',';\n return 'color-mix(' + spacePrefix + c1 + p1Str + ',' + c2 + p2Str + ')';\n}\n\n/**\n * Convert a standalone oklab() value to hex if it fits in sRGB gamut; returns null if out-of-gamut.\n *\n * @param {number} L The OKLab lightness component.\n * @param {number} a The OKLab green-red axis component.\n * @param {number} b The OKLab blue-yellow axis component.\n * @param {number} alpha The alpha value from 0 to 1.\n * @return {string|null} A hex color string, or null if the color is outside the sRGB gamut.\n */\nfunction convertOklabToHex (L, a, b, alpha) {\n const linear = oklabToLinearSrgb(L, a, b);\n // Out-of-gamut check on unclamped linear sRGB channels\n if (linear.r < -0.002 || linear.r > 1.002 || linear.g < -0.002 || linear.g > 1.002 || linear.b < -0.002 || linear.b > 1.002) {\n return null;\n }\n const r = Math.round(delinearize(Math.max(0, Math.min(1, linear.r))) * 255);\n const g = Math.round(delinearize(Math.max(0, Math.min(1, linear.g))) * 255);\n const bl = Math.round(delinearize(Math.max(0, Math.min(1, linear.b))) * 255);\n return rgbaToHex(r, g, bl, alpha !== undefined ? alpha : 1);\n}\n\n/**\n * Handle color(from ...) relative color syntax for simple identity cases.\n *\n * @param {string} expr The color(from ...) expression string.\n * @return {string|null} A hex color string if the relative color is a simple identity transform, or null otherwise.\n */\nfunction evaluateRelativeColor (expr) {\n // Match: color(from <base-color> srgb r g b [/ <alpha>]) identity transform pattern\n const match = expr.match(/^color\\(\\s*from\\s+(.+?)\\s+srgb\\s+r\\s+g\\s+b(?:\\s*\\/\\s*([\\d.]+%?))?\\s*\\)$/i);\n if (!match) {\n return null;\n }\n const baseColor = parseColor(match[1]);\n if (!baseColor) {\n return null;\n }\n const alpha = parseAlphaString(match[2], baseColor[3]);\n return rgbaToHex(baseColor[0], baseColor[1], baseColor[2], alpha);\n}\n\nexport {\n hslToRgbChannels,\n rgbaToHex,\n hwbToRgbChannels,\n namedColors,\n parseColor,\n parseHex,\n evaluateColorMix,\n convertOklabToHex,\n evaluateRelativeColor,\n shortestColor,\n srgbToOklab,\n oklabToSrgb,\n oklabToOklch,\n oklchToOklab,\n rgbToOklab,\n rgbToOklch,\n oklabToRgb\n};\n","/**\n * @file Parses and minifies CSS gradient function calls by splitting arguments, normalizing default directions, and removing redundant stop positions.\n */\n\n/**\n * Splits a gradient function's argument string at top-level commas, correctly handling nested parentheses.\n *\n * @param {string} argumentString The raw gradient arguments string.\n * @return {Array} An array of trimmed argument strings.\n */\nfunction splitGradientArgs (argumentString) {\n const parts = [];\n let depth = 0;\n let current = '';\n for (const character of argumentString) {\n if (character === '(') {\n depth++;\n } else if (character === ')') {\n depth--;\n }\n if (character === ',' && depth === 0) {\n parts.push(current.trim());\n current = '';\n } else {\n current += character;\n }\n }\n if (current.trim() || parts.length) {\n parts.push(current.trim());\n }\n return parts;\n}\n\n/**\n * Optimizes gradient arguments by removing default direction or shape keywords and trimming redundant 0% or 100% stop positions from the first and last stops.\n *\n * @param {string} func The gradient function name (e.g. \"linear-gradient\").\n * @param {string} argsStr The raw comma-separated gradient arguments string.\n * @return {string} The optimized gradient arguments string.\n */\nfunction processGradientArgs (func, argsStr) {\n const args = splitGradientArgs(argsStr);\n const functionLower = func.toLowerCase();\n\n if (functionLower.includes('linear')) {\n if (args.length > 1) {\n const firstDirection = args[0].toLowerCase().replace(/\\s+/g, ' ').trim();\n if (firstDirection === 'to bottom' || firstDirection === '180deg') {\n args.shift();\n } else if (firstDirection === 'to top') {\n args[0] = '0deg';\n } else if (firstDirection === 'to right') {\n args[0] = '90deg';\n } else if (firstDirection === 'to left') {\n args[0] = '270deg';\n } else if (firstDirection === 'to top right' || firstDirection === 'to right top') {\n args[0] = '45deg';\n } else if (firstDirection === 'to bottom right' || firstDirection === 'to right bottom') {\n args[0] = '135deg';\n } else if (firstDirection === 'to bottom left' || firstDirection === 'to left bottom') {\n args[0] = '225deg';\n } else if (firstDirection === 'to top left' || firstDirection === 'to left top') {\n args[0] = '315deg';\n }\n }\n } else if (functionLower.includes('radial')) {\n if (args.length > 1) {\n const firstShape = args[0].toLowerCase().replace(/\\s+/g, ' ').trim();\n if (firstShape === 'ellipse at center' || firstShape === 'circle at center') {\n args.shift();\n }\n }\n }\n\n if (args.length > 0) {\n // Remove default 0% stop position from the first gradient stop\n args[0] = args[0].replace(/^(.*\\S)\\s+0%$/, '$1');\n // Remove default 100% stop position from the last gradient stop\n args[args.length - 1] = args[args.length - 1].replace(/^(.*\\S)\\s+100%$/, '$1');\n }\n\n return args.join(',');\n}\n\n/**\n * Finds and minifies all gradient function calls within a CSS value string, applying argument optimization to each one.\n *\n * @param {string} value The CSS value string potentially containing gradient functions.\n * @return {string} The value string with all gradient calls minified.\n */\nfunction minifyGradients (value) {\n let result = '';\n let position = 0;\n while (position < value.length) {\n const rest = value.slice(position);\n // Match gradient function names: linear-gradient, radial-gradient, conic-gradient, and their repeating- variants\n const gradientMatch = rest.match(/^((?:repeating-)?(?:linear|radial|conic)-gradient)\\(/i);\n if (gradientMatch) {\n const func = gradientMatch[1];\n let depth = 1;\n let end = position + func.length + 1;\n while (end < value.length && depth > 0) {\n if (value[end] === '(') {\n depth++;\n } else if (value[end] === ')') {\n depth--;\n }\n end++;\n }\n const argsStr = value.slice(position + func.length + 1, end - 1);\n result += func + '(' + processGradientArgs(func, argsStr) + ')';\n position = end;\n } else {\n result += value[position];\n position++;\n }\n }\n return result;\n}\n\nexport { minifyGradients };\n","/**\n * @file Simplifies CSS math functions (calc, min, max) by folding constant expressions, flattening nested calcs, and converting absolute lengths to pixels.\n */\n\nimport { calc } from '@csstools/css-calc';\n\nimport {\n convertAbsoluteLengthToPx,\n formatDimension,\n roundCompactNumber\n} from './shared.js';\n\n/**\n * Attempts to simplify a calc() expression by combining like-unit terms and evaluating pure arithmetic, returning the simplified string or null if folding is not possible.\n *\n * @param {string} expression The expression inside calc() to attempt folding.\n * @return {string|null} The simplified expression, or null if it cannot be folded.\n */\nfunction tryFoldCalcExpression (expression) {\n let expr = expression.trim();\n let previous;\n\n do {\n previous = expr;\n // Remove innermost non-nested parentheses (flatten simple grouping)\n expr = expr.replace(/\\(([^()]+)\\)/g, '$1');\n // Fold: <number> * <number><unit> → computed result in same unit\n expr = expr.replace(/(-?(?:\\d*\\.\\d+|\\d+))\\s*\\*\\s*(-?(?:\\d*\\.\\d+|\\d+))(px|pt|pc|in|cm|mm|q|%)/gi, (match, a, b, unit) => {\n return formatDimension(parseFloat(a) * parseFloat(b), unit);\n });\n // Fold: <number><unit> * <number> → computed result in same unit\n expr = expr.replace(/(-?(?:\\d*\\.\\d+|\\d+))(px|pt|pc|in|cm|mm|q|%)\\s*\\*\\s*(-?(?:\\d*\\.\\d+|\\d+))/gi, (match, a, unit, b) => {\n return formatDimension(parseFloat(a) * parseFloat(b), unit);\n });\n // Fold: <number><unit> / <number> → computed result in same unit\n expr = expr.replace(/(-?(?:\\d*\\.\\d+|\\d+))(px|pt|pc|in|cm|mm|q)\\s*\\/\\s*(-?(?:\\d*\\.\\d+|\\d+))/gi, (match, value, unit, divisor) => {\n return formatDimension(parseFloat(value) / parseFloat(divisor), unit);\n });\n // Collapse zero-with-unit terms (e.g. 0px, 0%) to plain 0 or remove them\n expr = expr.replace(/(^|[+-])\\s*0(?:px|pt|pc|in|cm|mm|q|%)\\b/g, (match, sign) => {\n if (sign && sign !== '+') {\n return sign + ' 0';\n }\n return '';\n });\n // Remove additive zero terms\n expr = expr.replace(/\\+\\s*0\\b/g, '');\n // Remove subtractive zero terms\n expr = expr.replace(/-\\s*0\\b/g, '');\n // Collapse whitespace\n expr = expr.replace(/\\s+/g, ' ').trim();\n } while (expr !== previous);\n\n // Simplify trivial identity division: 1 / 1 / <dimension> → <dimension>\n if (/^1\\s*\\/\\s*1\\s*\\/\\s*(-?(?:\\d*\\.\\d+|\\d+)(?:px|pt|pc|in|cm|mm|q))$/i.test(expr)) {\n return expr.replace(/^1\\s*\\/\\s*1\\s*\\/\\s*/i, '');\n }\n\n // Remove all whitespace for validation\n const normalized = expr.replace(/\\s+/g, '');\n // Validate that the expression is a simple sequence of signed terms with optional units\n if (!/^[+-]?(?:\\d*\\.\\d+|\\d+)(?:[a-z%]+)?(?:[+-](?:\\d*\\.\\d+|\\d+)(?:[a-z%]+)?)*$/i.test(normalized)) {\n return null;\n }\n\n // Extract each signed term with its optional unit\n const terms = normalized.match(/[+-]?(?:\\d*\\.\\d+|\\d+)(?:[a-z%]+)?/gi) || [];\n const totals = new Map();\n\n for (const term of terms) {\n // Parse each term into sign, number, and unit parts\n const match = term.match(/^([+-]?)(\\d*\\.\\d+|\\d+)([a-z%]+)?$/i);\n if (!match) {\n return null;\n }\n const [, sign, rawNumber, rawUnit = ''] = match;\n let number = parseFloat(rawNumber) * (sign === '-' ? -1 : 1);\n let unit = rawUnit.toLowerCase();\n\n if (unit && unit !== '%' && unit !== 'px') {\n const pxValue = convertAbsoluteLengthToPx(number, unit);\n if (pxValue === null) {\n return null;\n }\n number = pxValue;\n unit = 'px';\n }\n\n totals.set(unit, (totals.get(unit) || 0) + number);\n }\n\n const orderedUnits = ['%', '', 'px', ...[...totals.keys()].filter((unit) => {\n return !['%', '', 'px'].includes(unit);\n }).sort()];\n const outputTerms = [];\n\n for (const unit of orderedUnits) {\n if (!totals.has(unit)) {\n continue;\n }\n const value = totals.get(unit);\n if (Math.abs(value) < 1e-12) {\n continue;\n }\n outputTerms.push({ unit, value });\n }\n\n if (!outputTerms.length) {\n return '0';\n }\n\n if (outputTerms.length === 1) {\n const { unit, value } = outputTerms[0];\n if (unit) {\n return roundCompactNumber(value) + unit;\n }\n return roundCompactNumber(value);\n }\n\n const [first, ...rest] = outputTerms;\n let result = roundCompactNumber(first.value) + first.unit;\n for (const term of rest) {\n const sign = term.value < 0 ? '-' : '+';\n result += ' ' + sign + ' ' + roundCompactNumber(Math.abs(term.value)) + term.unit;\n }\n return 'calc(' + result + ')';\n}\n\n/**\n * Simplifies calc(), min(), and max() expressions within a CSS value string using the `@csstools`/css-calc library, falling back to the original value on failure.\n *\n * @param {string} value The CSS value string containing math functions to simplify.\n * @param {string} property The CSS property name, used for context-aware simplification.\n * @param {string} originalValue The original unmodified value to fall back to if simplification produces an invalid result.\n * @return {string} The value with math functions simplified where possible.\n */\nfunction normalizeMathFunctions (value, property, originalValue = '') {\n let result = value;\n\n // Unwrap calc(1 / (1 / x)) → x (double-reciprocal identity)\n result = result.replace(/calc\\(\\s*1\\s*\\/\\s*\\(\\s*1\\s*\\/\\s*([^()]+)\\s*\\)\\s*\\)/gi, (match, inner) => {\n return inner.trim();\n });\n // Flatten calc(calc(a) ± b) → calc(a ± b)\n result = result.replace(/calc\\(\\s*calc\\(([^()]+)\\)\\s*([+-])\\s*([^()]+)\\s*\\)/gi, (match, inner, operator, tail) => {\n return 'calc(' + inner + ' ' + operator + ' ' + tail + ')';\n });\n // Unwrap calc(calc(x)) → calc(x)\n result = result.replace(/calc\\(\\s*calc\\(([^()]+)\\)\\s*\\)/gi, (match, inner) => {\n return 'calc(' + inner + ')';\n });\n\n // Simplify min()/max() expressions using @csstools/css-calc\n result = result.replace(/\\b(min|max)\\(([^()]+)\\)/gi, (match) => {\n try {\n const simplified = calc(match);\n return typeof simplified === 'string' ? simplified : match;\n } catch {\n return match;\n }\n });\n\n // Simplify calc() expressions using constant folding and @csstools/css-calc\n result = result.replace(/calc\\(([^()]+)\\)/gi, (match, inner) => {\n // Collapse whitespace inside calc expression\n const compactInner = inner.replace(/\\s+/g, ' ').trim();\n // Preserve percent-times-number expressions (e.g. 50%*2 or 2*50%) — just strip inner spaces\n if (/^(?:-?(?:\\d*\\.\\d+|\\d+)%\\s*\\*\\s*-?(?:\\d*\\.\\d+|\\d+)|-?(?:\\d*\\.\\d+|\\d+)\\s*\\*\\s*-?(?:\\d*\\.\\d+|\\d+)%)$/i.test(compactInner)) {\n // Remove whitespace around multiplication/division operators\n return 'calc(' + compactInner.replace(/\\s*([*/])\\s*/g, '$1') + ')';\n }\n // Preserve percent/number division expressions (e.g. 100%/3) — just strip inner spaces\n if (/^\\d+(?:\\.\\d+)?%\\s*\\/\\s*\\d+(?:\\.\\d+)?$/i.test(compactInner)) {\n // Remove whitespace around division operator\n return 'calc(' + compactInner.replace(/\\s*\\/\\s*/g, '/') + ')';\n }\n\n const folded = tryFoldCalcExpression(compactInner);\n if (folded) {\n return folded;\n }\n\n try {\n const simplified = calc(match);\n if (typeof simplified !== 'string') {\n return match;\n }\n // If simplified to a bare percentage but original had division, preserve the calc form\n if (/^-?(?:\\d+|\\d*\\.\\d+)%$/.test(simplified) && /%\\s*\\//.test(match)) {\n return 'calc(' + compactInner.replace(/\\s*\\/\\s*/g, '/') + ')';\n }\n return simplified;\n } catch {\n return match;\n }\n });\n\n // When calc() folded to an absolute-length unit (pt, pc, in, cm, mm, q), convert to pixels\n if (originalValue.includes('calc(') && /^-?(?:\\d+|\\d*\\.\\d+)(pt|pc|in|cm|mm|q)$/i.test(result)) {\n // Extract the absolute-length unit from the folded result\n const [, unit] = result.match(/^-?(?:\\d+|\\d*\\.\\d+)(pt|pc|in|cm|mm|q)$/i);\n const numeric = parseFloat(result);\n const pxValue = convertAbsoluteLengthToPx(numeric, unit);\n if (pxValue !== null) {\n result = roundCompactNumber(pxValue) + 'px';\n }\n }\n\n // Round results with excessive decimal places (4+ digits after the decimal)\n result = result.replace(/(-?(?:\\d+|\\d*\\.\\d+)\\.\\d{4,})([a-z%]+)/gi, (match, number, unit) => {\n return roundCompactNumber(number) + unit;\n });\n return result;\n}\n\n/**\n * Simplifies a standalone calc() value by flattening nested calc expressions, converting absolute length units to pixels, and folding constant terms.\n *\n * @param {string} value The CSS value string that may be a standalone calc() expression.\n * @return {string} The simplified value, or the original value if simplification is not applicable.\n */\nfunction simplifyStandaloneCalc (value) {\n // Check if value starts with calc( and ends with )\n if (!/^calc\\(/i.test(value) || !value.endsWith(')')) {\n return value;\n }\n let inner = value.slice(5, -1).trim();\n\n // Preserve percent-times-number expressions, only stripping whitespace around operators\n if (/^(?:-?(?:\\d*\\.\\d+|\\d+)%\\s*\\*\\s*-?(?:\\d*\\.\\d+|\\d+)|-?(?:\\d*\\.\\d+|\\d+)\\s*\\*\\s*-?(?:\\d*\\.\\d+|\\d+)%)$/i.test(inner.replace(/\\s+/g, ' ').trim())) {\n return 'calc(' + inner.replace(/\\s*([*/])\\s*/g, '$1') + ')';\n }\n\n // If no nested function calls and no multiplication/division involving parens, try flattening\n if (!/[A-Za-z-]+\\(/.test(inner) && !/[*/]\\s*\\(|\\)\\s*[*/]/.test(inner)) {\n // Remove all parentheses and collapse whitespace for folding\n const flattened = inner.replace(/[()]/g, '').replace(/\\s+/g, ' ').trim();\n const foldedFlattened = tryFoldCalcExpression(flattened);\n if (foldedFlattened) {\n return foldedFlattened;\n }\n }\n\n let previous;\n\n do {\n previous = inner;\n // Fold innermost parenthesized sub-expressions that aren't function calls\n inner = inner.replace(/(^|[^A-Za-z-])\\(([^()]+)\\)/g, (match, prefix, content) => {\n const trimmed = content.trim();\n const folded = tryFoldCalcExpression(trimmed);\n if (folded) {\n if (folded.startsWith('calc(') && folded.endsWith(')')) {\n return prefix + trimmed;\n }\n return prefix + folded;\n }\n return prefix + trimmed;\n });\n } while (inner !== previous);\n\n const folded = tryFoldCalcExpression(inner);\n if (folded) {\n return folded;\n }\n\n // Collapse whitespace and check for percent-division expressions\n const compactInner = inner.replace(/\\s+/g, ' ').trim();\n // Preserve percent/number division, just strip whitespace around the operator\n if (/^\\d+(?:\\.\\d+)?%\\s*\\/\\s*\\d+(?:\\.\\d+)?$/i.test(compactInner)) {\n return 'calc(' + compactInner.replace(/\\s*\\/\\s*/g, '/') + ')';\n }\n\n // Default: strip whitespace around multiplication/division operators\n return 'calc(' + compactInner.replace(/\\s*([*/])\\s*/g, '$1') + ')';\n}\n\nexport {\n normalizeMathFunctions,\n simplifyStandaloneCalc\n};\n","/**\n * @file Validates and optimizes CSS `quotes` property values by detecting\n * invalid odd-count string tokens and normalizing all-empty-string pairs to `none`.\n */\n\n/**\n * Extracts the inner contents of all quoted string tokens from a raw CSS\n * `quotes` property value. Returns an empty array when the value contains\n * no string tokens (e.g. keyword values like `none` or `auto`).\n *\n * @param {string} rawValue The raw CSS value string for a `quotes` declaration.\n * @return {Array} An array of the inner string contents of each quoted token.\n */\nfunction extractQuotedStringTokens (rawValue) {\n const tokens = [];\n // Match double-quoted or single-quoted strings, handling backslash-escaped characters inside\n const stringTokenPattern = /\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"|'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)'/g;\n let tokenMatch;\n while ((tokenMatch = stringTokenPattern.exec(rawValue)) !== null) {\n const innerContent = tokenMatch[1] ?? tokenMatch[2];\n tokens.push(innerContent);\n }\n return tokens;\n}\n\n/**\n * Determines whether a `quotes` declaration has an odd number of string\n * values, which is invalid per the CSS specification and silently ignored\n * by browsers.\n *\n * @param {string} rawValue The raw CSS value string for a `quotes` declaration.\n * @return {boolean} True if the value contains an odd number of quoted string tokens.\n */\nfunction hasInvalidQuotesCount (rawValue) {\n const tokens = extractQuotedStringTokens(rawValue);\n if (tokens.length === 0) {\n return false;\n }\n return tokens.length % 2 !== 0;\n}\n\n/**\n * Determines whether a `quotes` declaration consists entirely of pairs\n * of empty strings, making it functionally equivalent to `quotes: none`.\n *\n * @param {string} rawValue The raw CSS value string for a `quotes` declaration.\n * @return {boolean} True if the value is an even number of empty quoted strings.\n */\nfunction isQuotesNoneEquivalent (rawValue) {\n const tokens = extractQuotedStringTokens(rawValue);\n if (tokens.length === 0 || tokens.length % 2 !== 0) {\n return false;\n }\n return tokens.every((token) => {\n return token === '';\n });\n}\n\nexport {\n hasInvalidQuotesCount,\n isQuotesNoneEquivalent\n};\n","/**\n * @file Minifies CSS transform values by simplifying individual transform functions, collapsing axes, and removing identity components.\n */\n\nimport {\n normalizeScaleComponent,\n roundCompactNumber\n} from './shared.js';\n\n/**\n * Checks if a transform function argument represents a zero value, regardless of what CSS unit is attached.\n *\n * @param {string} value The transform argument string to test.\n * @return {boolean} True if the value is zero with any unit.\n */\nfunction isZeroTransformValue (value) {\n return /^[-+]?0(?:[a-z%]+)?$/i.test(value.trim());\n}\n\n/**\n * Splits a CSS function's comma-separated argument string into an array, correctly handling nested parentheses.\n *\n * @param {string} value The raw arguments string inside the function parentheses.\n * @return {Array} An array of trimmed argument strings.\n */\nfunction splitFunctionArguments (value) {\n const parts = [];\n let depth = 0;\n let current = '';\n for (const character of value) {\n if (character === '(') {\n depth++;\n }\n if (character === ')') {\n depth--;\n }\n if (character === ',' && depth === 0) {\n parts.push(current.trim());\n current = '';\n } else {\n current += character;\n }\n }\n if (current.trim() || parts.length) {\n parts.push(current.trim());\n }\n return parts;\n}\n\n/**\n * Parses a CSS transform value string into an array of objects, each containing a function name and its raw arguments string.\n *\n * @param {string} value The full CSS transform value string.\n * @return {Array|null} An array of { name, args } objects, or null if the string cannot be parsed.\n */\nfunction splitTransformFunctions (value) {\n const parts = [];\n let position = 0;\n while (position < value.length) {\n // Skip whitespace between transform functions\n while (position < value.length && /\\s/.test(value[position])) {\n position++;\n }\n if (position >= value.length) {\n break;\n }\n const nameStart = position;\n // Consume alphanumeric and hyphen characters for the function name\n while (position < value.length && /[A-Za-z0-9-]/.test(value[position])) {\n position++;\n }\n if (nameStart === position || value[position] !== '(') {\n return null;\n }\n const name = value.slice(nameStart, position);\n let depth = 1;\n let end = position + 1;\n while (end < value.length && depth > 0) {\n if (value[end] === '(') {\n depth++;\n }\n if (value[end] === ')') {\n depth--;\n }\n end++;\n }\n if (depth !== 0) {\n return null;\n }\n parts.push({ name, args: value.slice(position + 1, end - 1) });\n position = end;\n }\n return parts;\n}\n\n/**\n * Minifies a single CSS transform function by simplifying 3D functions to 2D equivalents, collapsing redundant axes, and normalizing scale percentages.\n *\n * @param {string} name The transform function name (e.g. \"translate3d\", \"scale\").\n * @param {string} args The raw comma-separated arguments string.\n * @return {string} The minified transform function call string.\n */\nfunction minifyTransformFunction (name, args) {\n const lowerName = name.toLowerCase();\n const parts = splitFunctionArguments(args);\n\n if (lowerName === 'rotate' && parts.length === 1) {\n // Convert turn units to degrees (e.g. 0.5turn → 180deg)\n const angle = parts[0].replace(/^(-?(?:\\d+|\\d*\\.\\d+))turn$/i, (_, turns) => {\n return roundCompactNumber(parseFloat(turns) * 360) + 'deg';\n });\n return 'rotate(' + angle + ')';\n }\n\n if (lowerName === 'translate3d' && parts.length === 3) {\n const [x, y, z] = parts;\n if (isZeroTransformValue(y) && isZeroTransformValue(z)) {\n return 'translate(' + x + ')';\n }\n if (isZeroTransformValue(x) && isZeroTransformValue(z)) {\n return 'translateY(' + y + ')';\n }\n if (isZeroTransformValue(x) && isZeroTransformValue(y)) {\n return 'translateZ(' + z + ')';\n }\n return name + '(' + parts.join(',') + ')';\n }\n\n if (lowerName === 'translate' && parts.length === 2) {\n const [x, y] = parts;\n if (isZeroTransformValue(x)) {\n return 'translateY(' + y + ')';\n }\n if (isZeroTransformValue(y)) {\n return 'translate(' + x + ')';\n }\n return name + '(' + parts.join(',') + ')';\n }\n\n if (lowerName === 'scale') {\n const normalized = parts.map(normalizeScaleComponent);\n if (normalized.length === 1) {\n return 'scale(' + normalized[0] + ')';\n }\n if (normalized.length === 2) {\n const [x, y] = normalized;\n if (x === y) {\n return 'scale(' + x + ')';\n }\n if (y === '1') {\n return 'scaleX(' + x + ')';\n }\n if (x === '1') {\n return 'scaleY(' + y + ')';\n }\n return 'scale(' + normalized.join(',') + ')';\n }\n }\n\n if (lowerName === 'scale3d' && parts.length === 3) {\n const normalized = parts.map(normalizeScaleComponent);\n const [x, y, z] = normalized;\n if (z === '1') {\n return minifyTransformFunction('scale', x + ',' + y);\n }\n if (y === '1' && z === '1') {\n return 'scaleX(' + x + ')';\n }\n if (x === '1' && z === '1') {\n return 'scaleY(' + y + ')';\n }\n if (x === '1' && y === '1') {\n return 'scaleZ(' + z + ')';\n }\n return 'scale3d(' + normalized.join(',') + ')';\n }\n\n if (lowerName === 'rotatez' && parts.length === 1) {\n return 'rotate(' + parts[0] + ')';\n }\n\n if (lowerName === 'rotate3d' && parts.length === 4) {\n const [x, y, z, angle] = parts;\n if (x === '1' && y === '0' && z === '0') {\n return 'rotateX(' + angle + ')';\n }\n if (x === '0' && y === '1' && z === '0') {\n return 'rotateY(' + angle + ')';\n }\n if (x === '0' && y === '0' && z === '1') {\n return 'rotate(' + angle + ')';\n }\n return name + '(' + parts.join(',') + ')';\n }\n\n if (lowerName.startsWith('scale')) {\n return name + '(' + parts.map(normalizeScaleComponent).join(',') + ')';\n }\n\n return name + '(' + parts.join(',') + ')';\n}\n\n/**\n * Minifies an entire CSS transform value by parsing each function call and applying per-function optimizations.\n *\n * @param {string} value The full CSS transform value string.\n * @return {string} The minified transform value, or the original value if parsing fails.\n */\nfunction minifyTransformValue (value) {\n if (!value || value === 'none') {\n return value;\n }\n const functions = splitTransformFunctions(value);\n if (!functions) {\n return value;\n }\n return functions.map(({ name, args }) => {\n return minifyTransformFunction(name, args);\n }).join(' ');\n}\n\nexport { minifyTransformValue };\n","/**\n * @file Optimizes CSS unicode-range values by deduplicating, merging overlapping\n * and adjacent ranges, collapsing consecutive single values into ranges, and\n * applying wildcard compression.\n */\n\n/**\n * Parses a single unicode-range token into a numeric start/end pair.\n * Handles single values (U+1F170), explicit ranges (U+2000-2002),\n * and wildcard notation (U+4??).\n *\n * @param {string} token A trimmed unicode-range token.\n * @return {object|null} Object with numeric start and end, or null if unparseable.\n */\nfunction parseUnicodeRangeToken (token) {\n const trimmed = token.trim();\n\n // Match wildcard notation: U+ followed by optional hex prefix then one or more ?\n const wildcardMatch = trimmed.match(/^U\\+([0-9a-fA-F]*)(\\?+)$/i);\n if (wildcardMatch) {\n const prefix = wildcardMatch[1] || '';\n const wildcardCount = wildcardMatch[2].length;\n const start = parseInt(prefix + '0'.repeat(wildcardCount), 16);\n const end = parseInt(prefix + 'F'.repeat(wildcardCount), 16);\n return { start, end };\n }\n\n // Match explicit range: U+XXXX-YYYY\n const rangeMatch = trimmed.match(/^U\\+([0-9a-fA-F]+)-([0-9a-fA-F]+)$/i);\n if (rangeMatch) {\n return {\n start: parseInt(rangeMatch[1], 16),\n end: parseInt(rangeMatch[2], 16)\n };\n }\n\n // Match single code point: U+XXXX\n const singleMatch = trimmed.match(/^U\\+([0-9a-fA-F]+)$/i);\n if (singleMatch) {\n const codePoint = parseInt(singleMatch[1], 16);\n return { start: codePoint, end: codePoint };\n }\n\n return null;\n}\n\n/**\n * Sorts ranges by start value and merges any that overlap or are adjacent\n * (where the gap between them is zero or negative after +1 adjustment).\n *\n * @param {Array} ranges Array of {start, end} objects.\n * @return {Array} New array of merged {start, end} objects.\n */\nfunction mergeOverlappingRanges (ranges) {\n if (ranges.length <= 1) {\n return ranges.map((range) => {\n return { start: range.start, end: range.end };\n });\n }\n\n const sorted = [...ranges].sort((rangeA, rangeB) => {\n return rangeA.start - rangeB.start || rangeB.end - rangeA.end;\n });\n\n const merged = [{ start: sorted[0].start, end: sorted[0].end }];\n for (let index = 1; index < sorted.length; index++) {\n const current = sorted[index];\n const previous = merged[merged.length - 1];\n\n if (current.start <= previous.end + 1) {\n previous.end = Math.max(previous.end, current.end);\n } else {\n merged.push({ start: current.start, end: current.end });\n }\n }\n\n return merged;\n}\n\n/**\n * Attempts to express a numeric range as wildcard notation (e.g. U+5??).\n * Wildcards are only possible when the suffix of the start is all zeros\n * and the suffix of the end is all F's, meaning the range covers an\n * entire block aligned to a power-of-16 boundary.\n *\n * @param {number} start The range start code point.\n * @param {number} end The range end code point.\n * @return {string|null} Wildcard string like \"U+5??\", or null if not representable.\n */\nfunction tryWildcardNotation (start, end) {\n if (start > end) {\n return null;\n }\n\n const startHex = start.toString(16).toUpperCase();\n const endHex = end.toString(16).toUpperCase();\n const digitCount = Math.max(startHex.length, endHex.length);\n const paddedStart = startHex.padStart(digitCount, '0');\n const paddedEnd = endHex.padStart(digitCount, '0');\n\n let commonPrefixLength = 0;\n while (commonPrefixLength < digitCount && paddedStart[commonPrefixLength] === paddedEnd[commonPrefixLength]) {\n commonPrefixLength++;\n }\n\n const startSuffix = paddedStart.slice(commonPrefixLength);\n const endSuffix = paddedEnd.slice(commonPrefixLength);\n\n // Wildcard requires suffix to span the full 0-F range (all zeros to all F's)\n const suffixIsAllZeros = /^0+$/.test(startSuffix);\n const suffixIsAllFs = /^F+$/i.test(endSuffix);\n if (startSuffix.length > 0 && suffixIsAllZeros && suffixIsAllFs) {\n const wildcardCount = digitCount - commonPrefixLength;\n // Strip leading zeros from the fixed-width prefix\n const prefix = paddedStart.slice(0, commonPrefixLength).replace(/^0+/, '');\n return 'U+' + prefix + '?'.repeat(wildcardCount);\n }\n\n return null;\n}\n\n/**\n * Formats a single merged range back into the shortest valid unicode-range token.\n * Tries wildcard notation first, then falls back to explicit range or single value.\n *\n * @param {number} start The range start code point.\n * @param {number} end The range end code point.\n * @return {string} The formatted unicode-range token.\n */\nfunction formatUnicodeRange (start, end) {\n const wildcardForm = tryWildcardNotation(start, end);\n if (wildcardForm) {\n return wildcardForm;\n }\n\n const startHex = start.toString(16).toUpperCase();\n if (start === end) {\n return 'U+' + startHex;\n }\n\n const endHex = end.toString(16).toUpperCase();\n return 'U+' + startHex + '-' + endHex;\n}\n\n/**\n * Optimizes a CSS unicode-range value by parsing all tokens, merging\n * overlapping/adjacent/duplicate ranges, and re-encoding with the\n * shortest possible notation (wildcards where applicable).\n *\n * @param {string} value The raw unicode-range CSS value (comma-separated tokens).\n * @return {string} The optimized unicode-range value.\n */\nfunction optimizeUnicodeRange (value) {\n const tokens = value.split(',');\n\n const ranges = [];\n for (const token of tokens) {\n const parsed = parseUnicodeRangeToken(token);\n if (parsed) {\n ranges.push(parsed);\n }\n }\n\n if (ranges.length === 0) {\n return value;\n }\n\n const merged = mergeOverlappingRanges(ranges);\n\n const formatted = merged.map((range) => {\n return formatUnicodeRange(range.start, range.end);\n });\n return formatted.join(',');\n}\n\nexport { optimizeUnicodeRange };\n","/**\n * @file Minifies CSS declaration values by applying color conversion, math simplification, shorthand compression, and other property-specific optimizations.\n */\n\nimport { resolveUnicodeEscape } from '../utilities.js';\n\nimport {\n convertOklabToHex,\n evaluateColorMix,\n evaluateRelativeColor,\n hslToRgbChannels,\n hwbToRgbChannels,\n parseHex,\n rgbaToHex,\n shortestColor\n} from './colors.js';\nimport { minifyGradients } from './gradients.js';\nimport {\n normalizeMathFunctions,\n simplifyStandaloneCalc\n} from './math.js';\nimport { namedColors } from './named-colors.js';\nimport { isQuotesNoneEquivalent } from './quotes.js';\nimport {\n collapseShorthandParts,\n normalizeScaleComponent,\n parseAlphaString,\n roundCompactNumber\n} from './shared.js';\nimport { minifyTransformValue } from './transforms.js';\nimport { optimizeUnicodeRange } from './unicode-range.js';\n\n/**\n * Map of position-area two-keyword values to their single-keyword equivalents.\n * Per CSS spec, `center center` is redundant with `center`, etc.\n *\n * @type {{[key: string]: string}}\n */\nconst POSITION_AREA_SHORTHANDS = {\n 'center center': 'center',\n 'top center': 'top',\n 'bottom center': 'bottom',\n 'center top': 'top',\n 'center bottom': 'bottom',\n 'left center': 'left',\n 'right center': 'right'\n};\n\n/**\n * Regex matching hex color tokens (#rgb, #rgba, #rrggbb, #rrggbbaa) and CSS named\n * color keywords. Hex patterns are ordered longest-first to avoid partial matches.\n * Named colors are sorted longest-first so longer names like `darkslategray` are\n * matched before shorter substrings.\n *\n * @type {RegExp}\n */\nconst COLOR_TOKEN_PATTERN = new RegExp(\n '#[0-9a-fA-F]{8}(?![0-9a-fA-F])|' +\n '#[0-9a-fA-F]{6}(?![0-9a-fA-F])|' +\n '#[0-9a-fA-F]{4}(?![0-9a-fA-F])|' +\n '#[0-9a-fA-F]{3}(?![0-9a-fA-F])|' +\n '\\\\b(?:' +\n Object.keys(namedColors).sort((a, b) => {\n return b.length - a.length;\n }).join('|') +\n ')\\\\b',\n 'gi'\n);\n\n/**\n * Replaces every hex color and named color keyword in a CSS value segment with\n * the shortest equivalent representation, comparing full hex, shortened hex,\n * and any matching named color keyword.\n *\n * @param {string} segment A CSS value segment (outside strings and urls).\n * @return {string} The segment with all colors shortened to their minimal form.\n */\nfunction shortenColorValues (segment) {\n // Match \"color-mix(\" as a whole word, case-insensitive\n const hasColorMix = /\\bcolor-mix\\(/i.test(segment);\n return segment.replace(COLOR_TOKEN_PATTERN, (match) => {\n let channels;\n if (match.startsWith('#')) {\n channels = parseHex(match);\n } else {\n if (hasColorMix) {\n return match;\n }\n const rgb = namedColors[match.toLowerCase()];\n if (rgb) {\n channels = [rgb[0], rgb[1], rgb[2], 1];\n }\n }\n if (!channels) {\n return match;\n }\n return shortestColor(channels[0], channels[1], channels[2], channels[3]);\n });\n}\n\n/**\n * Applies a replacer function only to segments of a CSS value that are outside quoted strings and url() functions, preserving those literal segments unchanged.\n *\n * @param {string} value The full CSS value string.\n * @param {function(string): string} replacer A function called with each non-string, non-url segment, returning the replacement string.\n * @return {string} The value with the replacer applied to all eligible segments.\n */\nfunction replaceOutsideStringsAndUrls (value, replacer) {\n let result = '';\n let index = 0;\n\n const consumeQuoted = (start) => {\n const quote = value[start];\n let end = start + 1;\n while (end < value.length) {\n if (value[end] === '\\\\') {\n end += 2;\n continue;\n }\n if (value[end] === quote) {\n end++;\n break;\n }\n end++;\n }\n return end;\n };\n\n const startsUrl = (start) => {\n return value.slice(start, start + 4).toLowerCase() === 'url(';\n };\n\n while (index < value.length) {\n if (value[index] === '\"' || value[index] === '\\'') {\n const end = consumeQuoted(index);\n result += value.slice(index, end);\n index = end;\n continue;\n }\n\n if (startsUrl(index)) {\n let depth = 1;\n let end = index + 4;\n while (end < value.length && depth > 0) {\n if (value[end] === '\"' || value[end] === '\\'') {\n end = consumeQuoted(end);\n continue;\n }\n if (value[end] === '(') {\n depth++;\n }\n if (value[end] === ')') {\n depth--;\n }\n end++;\n }\n result += value.slice(index, end);\n index = end;\n continue;\n }\n\n const start = index;\n while (index < value.length && value[index] !== '\"' && value[index] !== '\\'' && !startsUrl(index)) {\n index++;\n }\n result += replacer(value.slice(start, index));\n }\n\n return result;\n}\n\n/**\n * Normalizes whitespace, quotes, and unicode escapes in a CSS value string.\n *\n * @param {string} val The raw CSS value string to normalize.\n * @param {string} property The CSS property name, used for context-aware quote handling.\n * @return {string} The value with whitespace collapsed, quotes normalized, and unicode escapes resolved.\n */\nfunction normalizeWhitespaceAndQuotes (val, property) {\n // Unescape unicode (skip control characters — they must stay escaped in CSS strings)\n val = val.replace(/\\\\([0-9a-fA-F]{1,6})\\s?/g, (match, hex) => {\n return resolveUnicodeEscape(hex) ?? match;\n });\n // Normalize single-quoted strings to double-quoted\n val = val.replace(/'((?:[^'\\\\]|\\\\.)*?)'/g, '\"$1\"');\n\n // Remove space between string literals\n val = val.replace(/(\"(?:[^\"\\\\]|\\\\.)*\")\\s+(?=\")/g, '$1');\n\n // Whitespace minification\n val = val.replace(/\\s*!\\s*important/i, '!important');\n // val = val.replace(/\\s*([+*/=])\\s*/g, '$1');\n // Strip whitespace around commas\n val = val.replace(/\\s*([,])\\s*/g, '$1');\n // Match quoted strings (to skip them) or parentheses with surrounding whitespace (to strip whitespace)\n val = val.replace(/(\"[^\"]*\"|'[^']*')|\\s*([()])\\s*/g, (match, str, paren) => {\n if (str) {\n return str;\n }\n return paren;\n });\n\n // Strip quotes from simple strings (like \"Custom\", \"image.png\"), but not for content where quoted strings are semantically distinct\n if (property !== 'content' && property !== 'font-feature-settings' && property !== 'font-variation-settings') {\n // Match a boundary (start, whitespace, comma, open-paren), then a quoted simple value (alphanumeric, dots, slashes, hyphens), then a boundary lookahead\n val = val.replace(/(^|\\s|,|\\()(\"|')([a-zA-Z0-9_./-]+)\\2(?=\\s|,|$|\\)|!)/g, (match, before, quote, inner) => {\n // Keep quotes around CSS generic font-family keywords — unquoted they mean something different\n if (property === 'font-family' && /^(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|math|emoji|fangsong|ui-serif|ui-sans-serif|ui-monospace|ui-rounded)$/i.test(inner)) {\n return before + '\"' + inner + '\"';\n }\n return before + inner;\n });\n }\n\n return val;\n}\n\n/**\n * Converts CSS color functions (rgb, hsl, hwb, oklab, color-mix, etc.) to their\n * shortest hex equivalents and applies hex shortening.\n *\n * @param {string} val The CSS value string with potential color functions.\n * @return {string} The value with color functions converted to hex where shorter.\n */\nfunction convertColorsToHex (val) {\n // Evaluate color-mix() expressions (before space minification to avoid nested-paren issues)\n if (/\\bcolor-mix\\(/i.test(val)) {\n const result = evaluateColorMix(val);\n if (result) {\n val = result;\n }\n }\n\n // Handle color(from ...) relative color syntax (identity case)\n if (/\\bcolor\\(\\s*from\\b/i.test(val)) {\n const result = evaluateRelativeColor(val);\n if (result) {\n val = result;\n }\n }\n\n // Minify whitespace and numeric precision inside wide-gamut and functional color notations\n val = val.replace(/\\b(oklab|oklch|lch|lab|color|hwb)\\((.*?)\\)/gi, (match, func, inner) => {\n // Collapse whitespace to single space\n let minified = inner.replace(/\\s+/g, ' ');\n // Remove space after commas\n minified = minified.replace(/, /g, ',');\n // Remove spaces around slash separator (alpha delimiter)\n minified = minified.replace(/ \\/ /g, '/');\n // Strip leading zeros from decimal numbers (e.g. 0.5 → .5)\n minified = minified.replace(/\\b0+(\\.[\\d]+)/g, '$1');\n // Strip leading zeros from decimals preceded by a keyword (e.g. srgb 0.5 → srgb .5)\n minified = minified.replace(/([A-Za-z]) 0+(\\.[\\d]+)/g, '$1 $2');\n // Check if function uses a wide-gamut color space requiring higher numeric precision\n const useWidePrecision = func.toLowerCase() === 'color' && /\\b(srgb-linear|xyz-d65|xyz-d50|xyz)\\b/i.test(inner);\n // Round numbers with 3+ decimal places, using context-aware precision\n minified = minified.replace(/(^|[\\s(,/-])(-?\\d*\\.\\d{3,})/g, (match, before, num) => {\n const isAlpha = before === '/';\n const absoluteValue = Math.abs(parseFloat(num));\n // Check if function is a Lab/LCH color notation with a large channel value (less precision needed)\n const isLargeLabValue = /^(?:lch|lab|oklch|oklab)$/i.test(func) && absoluteValue >= 10;\n let precision;\n if (isAlpha) {\n precision = 3;\n } else if (isLargeLabValue) {\n precision = 1;\n } else if (useWidePrecision) {\n precision = 4;\n } else {\n precision = 3;\n }\n const factor = Math.pow(10, precision);\n const roundedNum = Math.round(parseFloat(num) * factor) / factor;\n // Strip trailing zeros and trailing decimal point from the rounded number\n let rounded = roundedNum.toFixed(precision).replace(/0+$/, '').replace(/\\.$/, '');\n if (rounded.startsWith('0.')) {\n rounded = rounded.substring(1);\n }\n if (rounded.startsWith('-0.')) {\n rounded = '-' + rounded.substring(2);\n }\n return before + rounded;\n });\n return func + '(' + minified.trim() + ')';\n });\n\n // Convert in-gamut oklab() to hex when it produces a shorter representation\n val = val.replace(/\\boklab\\(\\s*(-?(?:\\d+|\\d*\\.\\d+))\\s+(-?(?:\\d+|\\d*\\.\\d+))\\s+(-?(?:\\d+|\\d*\\.\\d+))(?:\\s*\\/\\s*(-?(?:\\d+|\\d*\\.\\d+)%?))?\\s*\\)/gi, (match, lStr, aStr, bStr, alphaStr) => {\n const alpha = parseAlphaString(alphaStr);\n const hex = convertOklabToHex(parseFloat(lStr), parseFloat(aStr), parseFloat(bStr), alpha);\n if (!hex) {\n return match; // out-of-gamut: keep native oklab form\n }\n if (hex.length < match.length) {\n return hex;\n }\n return match;\n });\n\n // Handle 'none' keyword in rgb/hsl functions (CSS Color Level 4: treated as 0)\n val = val.replace(/\\b(rgba?|hsla?)\\([^)]*\\)/gi, (match) => {\n return match.replace(/\\bnone\\b/gi, '0');\n });\n\n // hwb() → hex (percent signs optional for whiteness/blackness, values always treated as percentages)\n val = val.replace(/\\bhwb\\(\\s*(-?(?:\\d+|\\d*\\.\\d+))\\s+((?:\\d+|\\d*\\.\\d+))%?\\s+((?:\\d+|\\d*\\.\\d+))%?(?:\\s*\\/\\s*(-?(?:\\d+|\\d*\\.\\d+)%?))?\\s*\\)/gi, (match, hStr, wStr, bStr, aStr) => {\n const [r, g, b] = hwbToRgbChannels(parseFloat(hStr), parseFloat(wStr) / 100, parseFloat(bStr) / 100);\n return rgbaToHex(r, g, b, parseAlphaString(aStr));\n });\n\n // rgb()/rgba() space syntax → hex, case-insensitive (handles decimals and any alpha)\n val = val.replace(/\\brgba?\\(\\s*(-?(?:\\d+|\\d*\\.\\d+))\\s+(-?(?:\\d+|\\d*\\.\\d+))\\s+(-?(?:\\d+|\\d*\\.\\d+))(?:\\s*\\/\\s*(-?(?:\\d+|\\d*\\.\\d+)%?))?\\s*\\)/gi, (match, rStr, gStr, bStr, aStr) => {\n const r = Math.round(parseFloat(rStr));\n const g = Math.round(parseFloat(gStr));\n const b = Math.round(parseFloat(bStr));\n return rgbaToHex(r, g, b, parseAlphaString(aStr));\n });\n\n // hsl()/hsla() space syntax → hex, case-insensitive (percent signs optional, values always treated as percentages)\n val = val.replace(/\\bhsla?\\(\\s*(-?(?:\\d+|\\d*\\.\\d+))\\s+((?:\\d+|\\d*\\.\\d+))%?\\s+((?:\\d+|\\d*\\.\\d+))%?(?:\\s*\\/\\s*(-?(?:\\d+|\\d*\\.\\d+)%?))?\\s*\\)/gi, (match, hStr, sStr, lStr, aStr) => {\n const [r, g, b] = hslToRgbChannels(parseFloat(hStr), parseFloat(sStr) / 100, parseFloat(lStr) / 100);\n return rgbaToHex(r, g, b, parseAlphaString(aStr));\n });\n\n // rgba() comma syntax → hex, case-insensitive (handles any alpha)\n val = val.replace(/\\brgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(-?(?:\\d+|\\d*\\.\\d+)%?)\\s*\\)/gi, (match, rStr, gStr, bStr, aStr) => {\n const r = parseInt(rStr, 10);\n const g = parseInt(gStr, 10);\n const b = parseInt(bStr, 10);\n return rgbaToHex(r, g, b, parseAlphaString(aStr));\n });\n\n // hsla() comma syntax → hex, case-insensitive (percent signs optional, values always treated as percentages)\n val = val.replace(/\\bhsla\\(\\s*(-?(?:\\d+|\\d*\\.\\d+))\\s*,\\s*((?:\\d+|\\d*\\.\\d+))%?\\s*,\\s*((?:\\d+|\\d*\\.\\d+))%?\\s*,\\s*(-?(?:\\d+|\\d*\\.\\d+)%?)\\s*\\)/gi, (match, hStr, sStr, lStr, aStr) => {\n const [r, g, b] = hslToRgbChannels(parseFloat(hStr), parseFloat(sStr) / 100, parseFloat(lStr) / 100);\n return rgbaToHex(r, g, b, parseAlphaString(aStr));\n });\n\n // hsl()/hsla() comma syntax without alpha → hex, case-insensitive (percent signs optional, values always treated as percentages)\n val = val.replace(/\\bhsla?\\(\\s*(-?(?:\\d+|\\d*\\.\\d+))\\s*,\\s*((?:\\d+|\\d*\\.\\d+))%?\\s*,\\s*((?:\\d+|\\d*\\.\\d+))%?\\s*\\)/gi, (match, hStr, sStr, lStr) => {\n const [r, g, b] = hslToRgbChannels(parseFloat(hStr), parseFloat(sStr) / 100, parseFloat(lStr) / 100);\n return rgbaToHex(r, g, b, 1);\n });\n\n // rgb() comma syntax → hex, case-insensitive\n val = val.replace(/\\brgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)/gi, (match, r, g, b) => {\n return rgbaToHex(parseInt(r, 10), parseInt(g, 10), parseInt(b, 10), 1);\n });\n return val;\n}\n\n/**\n * Map from background-position keyword names to their equivalent percent values.\n *\n * @type {{[key: string]: string}}\n */\nconst POSITION_KEYWORD_TO_PERCENT = {\n left: '0',\n center: '50%',\n right: '100%',\n top: '0',\n bottom: '100%'\n};\n\n/**\n * Converts background-position keyword values to their shorter percent\n * equivalents when possible. Single Y-axis keywords (top, bottom) and\n * multi-value offset syntax (3 or 4 values) are left unchanged.\n *\n * @param {string} value The background-position value string.\n * @return {string} The value with keywords converted to percents where shorter.\n */\nfunction convertBackgroundPositionKeywords (value) {\n // Split on whitespace to determine the number of position parts\n const parts = value.split(/\\s+/);\n\n // 3 or 4 value syntax uses keyword offsets, retain keywords\n if (parts.length >= 3) {\n return value;\n }\n\n if (parts.length === 1) {\n const keyword = parts[0].toLowerCase();\n // Y-axis-only keywords (top, bottom) can't be expressed as a single X-axis percent\n const isYAxisOnly = keyword === 'top' || keyword === 'bottom';\n if (isYAxisOnly) {\n return value;\n }\n if (POSITION_KEYWORD_TO_PERCENT[keyword] !== undefined) {\n return POSITION_KEYWORD_TO_PERCENT[keyword];\n }\n return value;\n }\n\n if (parts.length === 2) {\n const firstKeyword = parts[0].toLowerCase();\n const secondKeyword = parts[1].toLowerCase();\n const firstIsPositionKeyword = POSITION_KEYWORD_TO_PERCENT[firstKeyword] !== undefined;\n const secondIsPositionKeyword = POSITION_KEYWORD_TO_PERCENT[secondKeyword] !== undefined;\n\n if (firstIsPositionKeyword && secondIsPositionKeyword) {\n const firstPercent = POSITION_KEYWORD_TO_PERCENT[firstKeyword];\n const secondPercent = POSITION_KEYWORD_TO_PERCENT[secondKeyword];\n // Collapse to single value when Y is center (50%), since a single value defaults Y to 50%\n if (secondPercent === '50%') {\n return firstPercent;\n }\n return firstPercent + ' ' + secondPercent;\n }\n }\n\n return value;\n}\n\n/**\n * Converts millisecond time values to seconds when the result is a\n * shorter string. Values of 0ms become 0s (time must keep a unit),\n * and values at or below 99ms stay in milliseconds (shorter representation).\n *\n * @param {string} value The CSS value string potentially containing ms time values.\n * @return {string} The value with eligible ms times converted to seconds.\n */\nfunction convertMillisecondsToSeconds (value) {\n // Match numeric values followed by the \"ms\" unit at word boundaries\n return value.replace(/\\b(\\d+(?:\\.\\d+)?)ms\\b/gi, (match, amount) => {\n const milliseconds = parseFloat(amount);\n if (milliseconds === 0) {\n return '0s';\n }\n // Keep ms for values at or below 99ms (ms representation is shorter)\n if (milliseconds <= 99) {\n return match;\n }\n return roundCompactNumber(milliseconds / 1000) + 's';\n });\n}\n\n/**\n * Applies property-specific optimizations to a CSS value (transition, flex, font,\n * background, display, scale, border-radius, shorthand collapsing, etc.).\n *\n * @param {string} val The CSS value string after generic minification.\n * @param {string} property The CSS property name.\n * @return {string} The value with property-specific optimizations applied.\n */\nfunction applyPropertyOptimizations (val, property) {\n if (property === 'font-weight') {\n // Replace font-weight keyword \"bold\" with its numeric equivalent\n val = val.replace(/\\bbold\\b/gi, '700');\n // Replace font-weight keyword \"normal\" with its numeric equivalent\n val = val.replace(/\\bnormal\\b/gi, '400');\n }\n\n // Convert ms to s for time-related properties when the seconds form is shorter\n const isTimeProperty = (\n property === 'transition' ||\n property === 'transition-duration' ||\n property === 'transition-delay' ||\n property === 'animation' ||\n property === 'animation-duration' ||\n property === 'animation-delay'\n );\n if (isTimeProperty) {\n val = convertMillisecondsToSeconds(val);\n }\n\n // Transition: remove \" 0s\" duration (transition: all 0s -> transition: all)\n if (property === 'transition') {\n // Remove zero-second duration from transition shorthand\n val = val.replace(/\\s+0s/g, ' ');\n // Remove leading zero-pixel value from transition shorthand\n val = val.replace(/^0px\\s*/, '');\n // Replace cubic-bezier functions with their equivalent named timing-function keywords\n val = val.replace(/cubic-bezier\\(0,0,1,1\\)/g, 'linear');\n val = val.replace(/cubic-bezier\\(\\.25,\\.1,\\.25,1\\)/g, 'ease');\n val = val.replace(/cubic-bezier\\(\\.42,0,1,1\\)/g, 'ease-in');\n val = val.replace(/cubic-bezier\\(0,0,\\.58,1\\)/g, 'ease-out');\n val = val.trim();\n }\n\n if (property === 'animation') {\n // Replace steps() functions with their equivalent named timing-function keywords\n val = val.replace(/steps\\(1,start\\)/g, 'step-start');\n val = val.replace(/steps\\(1,end\\)/g, 'step-end');\n }\n\n // Flex: remove \" 0px\" from flex shorthand (flex: 0 0 0px -> flex: 0 0)\n if (property === 'flex') {\n // Remove trailing zero-pixel basis value\n val = val.replace(/\\s+0px/g, ' ');\n // Remove leading zero-pixel value\n val = val.replace(/^0px\\s*/, '');\n // Remove trailing zero\n val = val.replace(/\\s+0$/, '');\n // Remove standalone zero-pixel value\n val = val.replace(/^0px$/, '');\n val = val.trim();\n }\n\n // Initial values\n if (val === 'initial') {\n if (['opacity', 'z-index', 'flex-grow', 'flex-shrink', 'order', 'line-height', 'zoom'].includes(property)) {\n // Just leaving them or mapping some: opacity: initial -> opacity: 1\n if (property === 'opacity') {\n val = '1';\n }\n if (property === 'z-index') {\n val = 'auto';\n }\n }\n if (['margin', 'padding'].includes(property)) {\n val = '0';\n }\n if (['min-width', 'min-height'].includes(property)) {\n val = 'auto';\n }\n }\n\n if (property === 'background' && val === 'none') {\n val = '0 0';\n }\n\n if (property === 'display') {\n if (val === 'block flow') {\n val = 'block';\n }\n if (val === 'inline flow-root') {\n val = 'inline-block';\n }\n }\n\n if (property === 'background-repeat') {\n if (val === 'no-repeat no-repeat') {\n val = 'no-repeat';\n }\n if (val === 'repeat no-repeat') {\n val = 'repeat-x';\n }\n if (val === 'no-repeat repeat') {\n val = 'repeat-y';\n }\n }\n\n if (property === 'background-position') {\n val = convertBackgroundPositionKeywords(val);\n }\n\n // Check if border value starts with a style keyword, and reorder to canonical width-style-color order\n if (property === 'border' && /^(?:solid|dashed|dotted|double|groove|ridge|inset|outset|hidden|none)\\s+/i.test(val)) {\n // Reorder border shorthand from style-width-color to width-style-color\n val = val.replace(/^((?:solid|dashed|dotted|double|groove|ridge|inset|outset|hidden|none))\\s+([^\\s]+)\\s+(.+)$/i, '$2 $1 $3');\n }\n\n if (property === 'flex-flow') {\n // Reorder flex-flow from wrap-direction to direction-wrap (canonical order)\n val = val.replace(/^(nowrap|wrap|wrap-reverse)\\s+(row|row-reverse|column|column-reverse)$/i, '$2 $1');\n }\n\n if (property === 'font-family') {\n // Strip quotes from simple multi-word font family names that don't require quoting\n val = val.replace(/\"([A-Za-z0-9-]+(?: [A-Za-z0-9-]+)+)\"/g, '$1');\n const seenFamilies = new Set();\n val = val.split(',').map((part) => {\n return part.trim();\n }).filter(Boolean).filter((part) => {\n const lowercaseName = part.toLowerCase();\n if (seenFamilies.has(lowercaseName)) {\n return false;\n }\n seenFamilies.add(lowercaseName);\n return true;\n }).join(',');\n }\n\n if (property === 'grid-template-areas') {\n // Normalize each quoted grid-template-areas row string\n val = val.replace(/\"([^\"]*)\"/g, (match, inner) => {\n // Collapse whitespace to single space within grid row\n let normalized = inner.replace(/\\s+/g, ' ').trim();\n // Collapse consecutive dots (null cell tokens) to a single dot\n normalized = normalized.replace(/(^| )\\.{2,}(?= |$)/g, '$1.');\n return '\"' + normalized + '\"';\n });\n }\n\n if (property === 'font-size') {\n // Convert point (pt) font-size values to their pixel (px) equivalent\n val = val.replace(/^(-?(?:\\d+|\\d*\\.\\d+))pt$/i, (match, amount) => {\n return roundCompactNumber(parseFloat(amount) * (96 / 72)) + 'px';\n });\n }\n\n // Simplify clamp() where all three arguments are identical (e.g. clamp(1rem,1rem,1rem) → 1rem)\n val = val.replace(/\\bclamp\\(([^,]+),\\1,\\1\\)/gi, '$1');\n\n // Convert display-p3 neutral grays to sRGB (equal channels are identical across gamuts)\n val = val.replace(/\\bcolor\\(display-p3\\s+([\\d.]+)\\s+\\1\\s+\\1(?:\\s*\\/\\s*(-?(?:\\d+|\\d*\\.\\d+)%?))?\\s*\\)/gi, (match, channelStr, alphaStr) => {\n const channelValue = parseFloat(channelStr);\n const r = Math.round(channelValue * 255);\n return rgbaToHex(r, r, r, parseAlphaString(alphaStr));\n });\n\n // Shorten all color tokens (second pass after property-specific color evaluations)\n val = replaceOutsideStringsAndUrls(val, shortenColorValues);\n\n // Remove space before hex colors (second pass after color evaluations)\n val = replaceOutsideStringsAndUrls(val, (segment) => {\n return segment.replace(/\\s+#([0-9a-fA-F]{3,8})\\b/gi, '#$1');\n });\n if (property !== 'transform' && property !== 'background' && property !== 'src') {\n // Restore space after close-paren when followed by an alphanumeric, hash, or hyphen\n val = val.replace(/\\)(?=[0-9a-zA-Z#-])/g, ') ');\n }\n\n if (property === 'font') {\n // Split font shorthand on whitespace\n const parts = val.split(/\\s+/);\n // Find the font-size part: contains a digit and a recognized CSS length/percentage unit\n const sizeIndex = parts.findIndex((part) => {\n return /\\d/.test(part) && /(?:px|em|rem|%|pt|pc|vw|vh|vmin|vmax|ch|ex|cm|mm|in|lh|rlh)/i.test(part);\n });\n if (sizeIndex > 0) {\n val = [...parts.slice(0, sizeIndex).filter((part) => {\n return part !== 'normal' && part !== '400';\n }), ...parts.slice(sizeIndex)].join(' ');\n }\n }\n\n if (property === 'background' && val !== 'none') {\n const normalized = val\n // Remove default \"0 0\" background-position values\n .replace(/(?:^|\\s)0(?:%|px)? 0(?:%|px)?(?=\\s|$)/g, ' ')\n // Remove \"0 0\" background-position after a close-paren (e.g. after url())\n .replace(/\\)0(?:%|px)? 0(?:%|px)?(?=\\s|$)/g, ') ')\n // Remove default \"repeat\" background-repeat keyword (excluding compound values like no-repeat)\n .replace(/(?<!-)\\brepeat\\b(?!-)/g, ' ')\n // Remove default \"scroll\" background-attachment keyword\n .replace(/\\bscroll\\b/g, ' ')\n // Remove default \"none\" background-image keyword\n .replace(/\\bnone\\b/g, ' ')\n // Collapse whitespace to single space\n .replace(/\\s+/g, ' ')\n .trim();\n if (normalized) {\n val = normalized;\n }\n }\n\n if (property === 'border') {\n // Remove default \"medium\" border-width keyword\n val = val.replace(/\\bmedium\\s+/g, '');\n }\n\n if (property === 'outline') {\n // Restore missing space between outline-style and a color keyword when they are adjacent\n val = val.replace(/\\b(solid|dashed|dotted|double|groove|ridge|inset|outset|hidden|none)(red|green|olive|tan|transparent)\\b/g, '$1 $2');\n }\n\n if (property === 'transform') {\n val = minifyTransformValue(val);\n // Remove whitespace between consecutive transform functions\n val = val.replace(/\\)\\s+(?=[a-z-]+\\()/gi, ')');\n }\n\n if (property === 'scale') {\n // Split scale value on whitespace into individual axis components\n const parts = val.split(/\\s+/).filter(Boolean).map(normalizeScaleComponent);\n if (parts.length === 2 && parts[0] === parts[1]) {\n val = parts[0];\n } else if (parts.length === 3 && parts[2] === '1') {\n if (parts[0] === parts[1]) {\n val = parts[0];\n } else {\n val = parts[0] + ' ' + parts[1];\n }\n } else {\n val = parts.join(' ');\n }\n }\n\n // Replace multiple spaces\n val = val.replace(/\\s+/g, ' ');\n\n // Shorthands: margin, padding, border-width, border-style, border-color, inset\n // Check if property supports box-model shorthand collapsing (4 → 3 → 2 → 1 values)\n if (/^(margin|padding|inset|border-width|border-style|border-color|gap|overflow)$/.test(property)) {\n val = collapseShorthandParts(val.split(' ')).join(' ');\n }\n\n if (property === 'border-radius') {\n const segments = val.split('/').map((segment) => {\n return segment.trim();\n }).filter(Boolean).map((segment) => {\n // Split each segment on whitespace and collapse redundant parts\n return collapseShorthandParts(segment.split(/\\s+/)).join(' ');\n });\n val = segments.join('/');\n }\n\n return val;\n}\n\n/**\n * Minifies a CSS declaration's value by applying color conversion, math simplification, shorthand compression, gradient optimization, and other property-specific optimizations.\n *\n * @param {object} declaration The CSS declaration object with property and value fields.\n * @return {string} The minified value string.\n */\nfunction minifyValue (declaration) {\n if (declaration.property === 'position-area') {\n const shorthand = POSITION_AREA_SHORTHANDS[declaration.value];\n if (shorthand) {\n return shorthand;\n }\n }\n if (declaration.property === 'quotes' && isQuotesNoneEquivalent(declaration.value)) {\n return 'none';\n }\n let val = declaration.value;\n\n if (typeof val === 'string') {\n val = val.trim();\n val = normalizeWhitespaceAndQuotes(val, declaration.property);\n\n // Instead of unconditionally removing spaces around + and - and *, handle math vs non-math\n // Collapse spaces around division operator\n val = val.replace(/ \\/ /g, '/');\n // Remove whitespace around * and / operators (safe outside calc context)\n val = val.replace(/\\s*([*/])\\s*/g, '$1');\n val = normalizeMathFunctions(val, declaration.property, declaration.value || '');\n val = simplifyStandaloneCalc(val);\n // Simplify calc() expressions containing zero-percent additive terms\n val = val.replace(/calc\\(([^()]+)\\)/gi, (match, inner) => {\n // Collapse whitespace inside calc expression\n const compactInner = inner.replace(/\\s+/g, ' ').trim();\n // Extract all percentage terms from the expression\n const percentTerms = compactInner.match(/[+-]?\\s*(?:\\d*\\.\\d+|\\d+)%/g) || [];\n const hasNonZeroPercent = percentTerms.some((term) => {\n return Math.abs(parseFloat(term)) > 0;\n });\n if (!hasNonZeroPercent) {\n return match;\n }\n // Remove trailing \"+ 0%\" and leading \"0% +\" additive identity terms\n return 'calc(' + compactInner.replace(/\\s*\\+\\s*0%(?=\\s*$)/g, '').replace(/^0%\\s*\\+\\s*/g, '').trim() + ')';\n });\n\n // Zeros and Decimals\n if (declaration.property !== 'initial-value') {\n // Strip units from zero values (0px → 0, 0em → 0, etc.) at a value boundary\n val = val.replace(/(^|\\s|,|\\()0(?:px|em|rem|vw|vh|cm|mm|in|pt|pc|ex|ch|vmin|vmax)(?=\\s|,|$|\\)|!)/g, '$10');\n }\n val = val.replace(/(^|\\s|,|\\()(-?)0+(\\.\\d+)/g, '$1$2$3'); // e.g. 0.5 -> .5, -0.5 -> -.5\n\n // If value is a standalone number with optional unit, round it compactly\n if (/^[+-]?(?:\\d+|\\d*\\.\\d+)([a-z%]+)?$/i.test(val)) {\n const [, rawNumber, rawUnit = ''] = val.match(/^([+-]?(?:\\d+|\\d*\\.\\d+))([a-z%]+)?$/i);\n val = roundCompactNumber(rawNumber, 4) + rawUnit;\n }\n\n // Remove space before hex colors\n val = replaceOutsideStringsAndUrls(val, (segment) => {\n segment = segment.replace(/\\s+#([0-9a-fA-F]{3,8})\\b/gi, '#$1');\n // Lowercase hex color tokens for consistency and shorter output\n segment = segment.replace(/#([0-9a-fA-F]{3,8})\\b/gi, (m) => {\n return m.toLowerCase();\n });\n return segment;\n });\n\n // Convert color functions to hex equivalents\n val = convertColorsToHex(val);\n\n // Shorten all color tokens (hex and named) to their shortest representation\n val = replaceOutsideStringsAndUrls(val, shortenColorValues);\n\n // Property-specific optimizations\n val = applyPropertyOptimizations(val, declaration.property);\n }\n\n // Gradient optimizations\n // Check if value contains a gradient function\n if (/gradient\\(/.test(val)) {\n val = minifyGradients(val);\n }\n\n // Unicode range optimization: dedup, merge overlapping/adjacent, wildcard compression\n if (declaration.property === 'unicode-range') {\n val = optimizeUnicodeRange(val);\n }\n\n return val;\n}\n\nexport { minifyValue };\n","/**\n * @file Defines lookup tables mapping CSS shorthand properties to their constituent longhand properties and override relationships.\n */\n\nconst shorthandMap = {\n margin: ['margin-top', 'margin-right', 'margin-bottom', 'margin-left'],\n padding: ['padding-top', 'padding-right', 'padding-bottom', 'padding-left'],\n inset: ['top', 'right', 'bottom', 'left'],\n overflow: ['overflow-x', 'overflow-y'],\n gap: ['row-gap', 'column-gap'],\n flex: ['flex-grow', 'flex-shrink', 'flex-basis'],\n outline: ['outline-width', 'outline-style', 'outline-color'],\n 'border-radius': ['border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius'],\n 'border-width': ['border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width'],\n 'border-style': ['border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style'],\n 'border-color': ['border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color'],\n border: ['border-top', 'border-right', 'border-bottom', 'border-left', 'border-width', 'border-style', 'border-color'],\n 'border-image': ['border-image-source', 'border-image-slice', 'border-image-repeat'],\n 'border-top': ['border-top-width', 'border-top-style', 'border-top-color'],\n 'border-right': ['border-right-width', 'border-right-style', 'border-right-color'],\n 'border-bottom': ['border-bottom-width', 'border-bottom-style', 'border-bottom-color'],\n 'border-left': ['border-left-width', 'border-left-style', 'border-left-color'],\n background: ['background-color', 'background-image', 'background-repeat', 'background-position', 'background-attachment'],\n 'text-decoration': ['text-decoration-line', 'text-decoration-style', 'text-decoration-color'],\n 'place-items': ['align-items', 'justify-items'],\n 'place-content': ['align-content', 'justify-content'],\n 'place-self': ['align-self', 'justify-self'],\n columns: ['column-width', 'column-count'],\n 'list-style': ['list-style-position', 'list-style-image', 'list-style-type'],\n 'margin-inline': ['margin-inline-start', 'margin-inline-end'],\n 'margin-block': ['margin-block-start', 'margin-block-end'],\n 'padding-inline': ['padding-inline-start', 'padding-inline-end'],\n 'padding-block': ['padding-block-start', 'padding-block-end'],\n 'inset-inline': ['inset-inline-start', 'inset-inline-end'],\n 'inset-block': ['inset-block-start', 'inset-block-end'],\n 'border-inline': ['border-inline-start', 'border-inline-end', 'border-inline-width', 'border-inline-style', 'border-inline-color'],\n 'border-block': ['border-block-start', 'border-block-end', 'border-block-width', 'border-block-style', 'border-block-color'],\n 'border-inline-width': ['border-inline-start-width', 'border-inline-end-width'],\n 'border-block-width': ['border-block-start-width', 'border-block-end-width'],\n transition: ['transition-property', 'transition-duration', 'transition-timing-function', 'transition-delay'],\n animation: ['animation-name', 'animation-duration', 'animation-timing-function', 'animation-delay', 'animation-iteration-count', 'animation-direction', 'animation-fill-mode', 'animation-play-state'],\n mask: ['mask-image', 'mask-repeat', 'mask-size'],\n 'position-try': ['position-try-order', 'position-try-fallbacks'],\n font: ['font-style', 'font-weight', 'font-size', 'line-height', 'font-family']\n};\n\nconst shorthandOverrideMap = {\n border: ['border-image', 'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset', 'border-image-repeat'],\n font: ['font-variant', 'font-variant-alternates', 'font-variant-caps', 'font-variant-east-asian', 'font-variant-ligatures', 'font-variant-numeric', 'font-variant-position'],\n mask: ['mask-border', 'mask-border-source', 'mask-border-slice', 'mask-border-width', 'mask-border-outset', 'mask-border-repeat', 'mask-border-mode']\n};\n\nexport {\n shorthandMap,\n shorthandOverrideMap\n};\n","/**\n * @file Deduplicates, merges, and optimizes CSS declarations by collapsing longhand properties into shorthands and removing overridden values.\n */\n\nimport { minifyValue } from '../value/minify.js';\nimport { hasInvalidQuotesCount } from '../value/quotes.js';\nimport { collapseShorthandParts } from '../value/shared.js';\n\nimport {\n shorthandMap,\n shorthandOverrideMap\n} from './config.js';\n\n/**\n * Reorders declarations so that shorthands appear before any related longhands they would override, preventing cascade issues in the minified output.\n *\n * @param {Array} declarations The array of CSS declaration objects to reorder.\n * @return {Array} A new array with declarations in the corrected order.\n */\nfunction orderDeclarations (declarations) {\n const ordered = [...declarations];\n const moveBefore = (prop, beforeProp) => {\n const fromIndex = ordered.findIndex((declaration) => {\n return declaration?.property === prop;\n });\n const toIndex = ordered.findIndex((declaration) => {\n return declaration?.property === beforeProp;\n });\n if (fromIndex === -1 || toIndex === -1 || fromIndex < toIndex) {\n return;\n }\n const [item] = ordered.splice(fromIndex, 1);\n ordered.splice(toIndex, 0, item);\n };\n\n moveBefore('border', 'border-image');\n moveBefore('font', 'font-feature-settings');\n moveBefore('font', 'font-variant-ligatures');\n moveBefore('font', 'font-kerning');\n moveBefore('font', 'font-variation-settings');\n moveBefore('mask', 'mask-border');\n moveBefore('margin', 'margin-top');\n moveBefore('margin', 'margin-right');\n moveBefore('margin', 'margin-bottom');\n moveBefore('margin', 'margin-left');\n\n return ordered;\n}\n\n/**\n * Determines which longhand properties are present and eligible for merging into a given shorthand. Returns null when the required longhands for the shorthand are not all available.\n *\n * @param {string} shorthand The CSS shorthand property name.\n * @param {Array} longhands The expected longhand property names for this shorthand.\n * @param {Array} declarations The current array of CSS declaration objects.\n * @return {Array|null} The list of longhand names to merge, or null if merging is not possible.\n */\nfunction getMergeProps (shorthand, longhands, declarations) {\n const presentLonghands = longhands.filter((longhand) => {\n return declarations.some((declaration) => {\n return declaration.property === longhand;\n });\n });\n if (presentLonghands.length === 0) {\n return null;\n }\n if (shorthand === 'font') {\n const hasRequiredFontProps = presentLonghands.includes('font-size') && presentLonghands.includes('font-family');\n if (hasRequiredFontProps) {\n return presentLonghands;\n }\n return null;\n }\n if (shorthand === 'background') {\n const hasBackgroundProp = presentLonghands.includes('background-color') || presentLonghands.includes('background-image');\n if (hasBackgroundProp) {\n return presentLonghands;\n }\n return null;\n }\n if (shorthand === 'mask') {\n if (presentLonghands.includes('mask-image')) {\n return presentLonghands;\n }\n return null;\n }\n if (shorthand === 'border-image') {\n if (presentLonghands.includes('border-image-source')) {\n return presentLonghands;\n }\n return null;\n }\n if (shorthand === 'border') {\n const hasAllBorderParts = (\n presentLonghands.includes('border-width') &&\n presentLonghands.includes('border-style') &&\n presentLonghands.includes('border-color')\n );\n if (hasAllBorderParts) {\n return ['border-width', 'border-style', 'border-color'];\n }\n return null;\n }\n if (shorthand === 'flex') {\n const hasAllFlexParts = (\n presentLonghands.includes('flex-grow') &&\n presentLonghands.includes('flex-shrink') &&\n presentLonghands.includes('flex-basis')\n );\n if (hasAllFlexParts) {\n return ['flex-grow', 'flex-shrink', 'flex-basis'];\n }\n return null;\n }\n if (presentLonghands.length === longhands.length) {\n return longhands;\n }\n return null;\n}\n\n/**\n * Get all longhands that a shorthand would override.\n *\n * @param {string} shorthandProp The CSS shorthand property name.\n * @return {Array} A deduplicated array of all longhand property names that the shorthand overrides, including nested longhands.\n */\nfunction getOverriddenLonghands (shorthandProp) {\n const direct = shorthandMap[shorthandProp] || [];\n const overrides = shorthandOverrideMap[shorthandProp] || [];\n const all = [...direct, ...overrides];\n for (const prop of direct) {\n const nested = shorthandMap[prop] || [];\n all.push(...nested);\n }\n return [...new Set(all)];\n}\n\n/**\n * Check if a value contains var() - don't merge if it does (safest approach).\n *\n * @param {string} value The minified CSS value string to check.\n * @return {boolean} True if the value contains a var() with a fallback comma.\n */\nfunction hasVarFallback (value) {\n // Match var() containing a comma (indicating a fallback value)\n return /var\\([^)]*,/.test(value);\n}\n\n/**\n * Determines whether a value containing var() references can safely be merged into a shorthand. Values with fallback commas or unregistered custom properties are not mergeable.\n *\n * @param {string} value The minified CSS value string to check.\n * @param {object} context The minification context with registered custom property data.\n * @return {boolean} True if the value is safe to merge into a shorthand.\n */\nfunction canMergeVarValue (value, context) {\n // Check if the value contains any var() reference\n const containsVar = /var\\(/.test(value);\n if (!containsVar || hasVarFallback(value)) {\n return !hasVarFallback(value);\n }\n // Extract all var() references with their custom property names\n const matches = [...value.matchAll(/var\\((--[A-Za-z0-9_-]+)\\)/g)];\n if (!matches.length) {\n return false;\n }\n return matches.every(([, propertyName]) => {\n return context.registeredCustomProperties.has(propertyName);\n });\n}\n\n/**\n * Try to merge longhand properties into a shorthand.\n *\n * @param {Array} properties The longhand property names to merge.\n * @param {Array} declarations The CSS declaration objects to draw values from.\n * @param {string} shorthandName The target shorthand property name.\n * @param {object} context The minification context with registered custom property data.\n * @return {string|null} The merged shorthand value string, or null if merging is not possible.\n */\nfunction tryMergeToShorthand (properties, declarations, shorthandName = '', context) {\n if (properties.length < 2) {\n return null;\n }\n\n const values = properties.map((property) => {\n const declaration = declarations.find((candidate) => {\n return candidate.property === property;\n });\n if (declaration) {\n return minifyValue(declaration);\n }\n return null;\n });\n\n // If any value is null, can't merge\n const hasNullValue = values.some((value) => {\n return value === null;\n });\n if (hasNullValue) {\n return null;\n }\n\n // Don't merge if any value has var() with fallback or unknown custom properties\n const hasUnmergeableVar = values.some((value) => {\n return !canMergeVarValue(value, context);\n });\n if (hasUnmergeableVar) {\n return null;\n }\n\n // Check if all values have the same !important status\n const importantFlags = values.map((value) => {\n return value.includes('!important');\n });\n const allImportant = importantFlags.every((flag) => {\n return flag;\n });\n const noneImportant = importantFlags.every((flag) => {\n return !flag;\n });\n\n // Allow mixed important flags for margin/padding/inset - merge without !important on shorthand\n // For other properties, mixed important flags are not allowed\n const allowsMixedImportant = (\n shorthandName === 'margin' ||\n shorthandName === 'padding' ||\n shorthandName === 'inset' ||\n shorthandName === 'position-try'\n );\n if (!allImportant && !noneImportant && !allowsMixedImportant) {\n return null;\n }\n\n const cleanValues = values.map((value) => {\n return value\n .replace('!important', '')\n .trim();\n });\n const valueMap = new Map(properties.map((property, index) => {\n return [property, cleanValues[index]];\n }));\n\n // For margin/padding with mixed important, don't use !important on the shorthand\n // Only use !important if ALL values have it\n const useImportant = allImportant;\n const importantSuffix = useImportant ? '!important' : '';\n\n if (shorthandName === 'position-try') {\n const order = valueMap.get('position-try-order');\n const fallbacks = valueMap.get('position-try-fallbacks');\n if (order === 'normal' && fallbacks) {\n return fallbacks + importantSuffix;\n }\n return null;\n }\n\n if (shorthandName === 'transition') {\n const transitionProperty = valueMap.get('transition-property');\n const duration = valueMap.get('transition-duration');\n const timing = valueMap.get('transition-timing-function');\n const delay = valueMap.get('transition-delay');\n if (!transitionProperty || !duration) {\n return null;\n }\n const result = [transitionProperty, duration];\n if (timing && timing !== 'ease') {\n result.push(timing);\n }\n if (delay && delay !== '0' && delay !== '0s') {\n result.push(delay);\n }\n return result.join(' ') + importantSuffix;\n }\n\n if (shorthandName === 'animation') {\n const animationName = valueMap.get('animation-name');\n const duration = valueMap.get('animation-duration');\n if (!animationName || !duration) {\n return null;\n }\n const result = [animationName, duration];\n const timing = valueMap.get('animation-timing-function');\n const delay = valueMap.get('animation-delay');\n const iteration = valueMap.get('animation-iteration-count');\n const direction = valueMap.get('animation-direction');\n const fillMode = valueMap.get('animation-fill-mode');\n const playState = valueMap.get('animation-play-state');\n if (timing && timing !== 'ease') {\n result.push(timing);\n }\n if (delay && delay !== '0' && delay !== '0s') {\n result.push(delay);\n }\n if (iteration && iteration !== '1') {\n result.push(iteration);\n }\n if (direction && direction !== 'normal') {\n result.push(direction);\n }\n if (fillMode && fillMode !== 'none') {\n result.push(fillMode);\n }\n if (playState && playState !== 'running') {\n result.push(playState);\n }\n return result.join(' ') + importantSuffix;\n }\n\n if (shorthandName === 'background') {\n const color = valueMap.get('background-color');\n const image = valueMap.get('background-image');\n const repeat = valueMap.get('background-repeat');\n const position = valueMap.get('background-position');\n const attachment = valueMap.get('background-attachment');\n const result = [];\n if (color && color !== 'transparent') {\n result.push(color);\n }\n if (image && image !== 'none') {\n result.push(image);\n }\n if (position && position !== '0 0' && position !== '0% 0%') {\n result.push(position);\n }\n if (repeat && repeat !== 'repeat') {\n result.push(repeat);\n }\n if (attachment && attachment !== 'scroll') {\n result.push(attachment);\n }\n if (!result.length) {\n return null;\n }\n return result.join(' ') + importantSuffix;\n }\n\n if (shorthandName === 'mask') {\n const image = valueMap.get('mask-image');\n const repeat = valueMap.get('mask-repeat');\n const size = valueMap.get('mask-size');\n if (!image) {\n return null;\n }\n let result = image;\n if (repeat) {\n result += ' ' + repeat;\n }\n if (size) {\n result += '/' + size;\n }\n return result + importantSuffix;\n }\n\n if (shorthandName === 'border-image') {\n const source = valueMap.get('border-image-source');\n const slice = valueMap.get('border-image-slice');\n const repeat = valueMap.get('border-image-repeat');\n if (!source) {\n return null;\n }\n const result = [source];\n if (slice) {\n result.push(slice);\n }\n if (repeat) {\n result.push(repeat);\n }\n return result.join(' ') + importantSuffix;\n }\n\n if (shorthandName === 'text-decoration') {\n const line = valueMap.get('text-decoration-line');\n const style = valueMap.get('text-decoration-style');\n const color = valueMap.get('text-decoration-color');\n if (!line) {\n return null;\n }\n const result = [line];\n if (style && style !== 'solid') {\n result.push(style);\n }\n if (color && color !== 'currentcolor') {\n result.push(color);\n }\n return result.join(' ') + importantSuffix;\n }\n\n if (shorthandName === 'columns') {\n return cleanValues.join(' ') + importantSuffix;\n }\n\n if (shorthandName === 'list-style') {\n const position = valueMap.get('list-style-position');\n const image = valueMap.get('list-style-image');\n const type = valueMap.get('list-style-type');\n const result = [];\n if (position && position !== 'outside') {\n result.push(position);\n }\n if (image && image !== 'none') {\n result.push(image);\n }\n if (type && type !== 'disc') {\n result.push(type);\n }\n const joined = result.join(' ') || 'inside';\n return joined + importantSuffix;\n }\n\n if (shorthandName === 'font') {\n const fontSize = valueMap.get('font-size');\n const fontFamily = valueMap.get('font-family');\n if (!fontSize || !fontFamily) {\n return null;\n }\n const result = [];\n const fontStyle = valueMap.get('font-style');\n const fontWeight = valueMap.get('font-weight');\n const lineHeight = valueMap.get('line-height');\n if (fontStyle && fontStyle !== 'normal') {\n result.push(fontStyle);\n }\n if (fontWeight && fontWeight !== '400' && fontWeight !== 'normal') {\n result.push(fontWeight);\n }\n if (lineHeight) {\n result.push(fontSize + '/' + lineHeight);\n } else {\n result.push(fontSize);\n }\n result.push(fontFamily);\n return result.join(' ') + importantSuffix;\n }\n\n if (shorthandName === 'flex') {\n const grow = valueMap.get('flex-grow');\n const shrink = valueMap.get('flex-shrink');\n const basis = valueMap.get('flex-basis');\n if (!grow || !shrink || !basis) {\n return null;\n }\n return [grow, shrink, basis].join(' ') + importantSuffix;\n }\n\n // Build shorthand value\n if (properties.length === 2) {\n // For 2-value shorthands (logical properties)\n if (cleanValues[0] === cleanValues[1]) {\n return cleanValues[0] + importantSuffix;\n }\n return cleanValues.join(' ') + importantSuffix;\n }\n\n if (properties.length === 4) {\n // For 4-value shorthands (margin, padding, inset, etc.)\n // Collapse redundant values: top right bottom left → fewer values when sides match\n return collapseShorthandParts([...cleanValues]).join(' ') + importantSuffix;\n }\n\n // For border shorthand (3 values: width, style, color)\n const isBorderLikeShorthand = (\n properties.length === 3 &&\n (properties.includes('border-width') || properties.includes('outline-width')) &&\n properties.some((property) => {\n // Check if one longhand ends with \"-style\" (e.g. border-style, outline-style)\n return /-style$/.test(property);\n }) &&\n properties.some((property) => {\n // Check if one longhand ends with \"-color\" (e.g. border-color, outline-color)\n return /-color$/.test(property);\n })\n );\n if (isBorderLikeShorthand) {\n return cleanValues.join(' ') + importantSuffix;\n }\n\n return null;\n}\n\n/**\n * Deduplicates, merges, and optimizes CSS declarations within a rule block. Removes overridden longhands, collapses longhands into shorthands, and preserves intentional fallbacks.\n *\n * @param {Array} declarations The array of CSS declaration objects to process.\n * @param {object} context The minification context with registered custom property data.\n * @return {Array} A new array of optimized and reordered declaration objects.\n */\nfunction processDeclarations (declarations, context) {\n let result = [];\n\n for (let declaration of declarations) {\n if (declaration.type === 'rule' || declaration.type === 'media') {\n result.push(declaration);\n continue;\n }\n\n const propertyName = declaration.property;\n if (!propertyName) {\n continue;\n }\n\n if (propertyName === 'quotes' && hasInvalidQuotesCount(declaration.value)) {\n continue;\n }\n\n let minifiedValue = minifyValue(declaration);\n\n let previousIndex = -1;\n for (let i = result.length - 1; i >= 0; i--) {\n if (result[i].property === propertyName) {\n previousIndex = i;\n break;\n }\n }\n\n // Also check if there's a prefixed version we can replace\n let prefixedIndex = -1;\n if (!propertyName.startsWith('-')) {\n for (let i = result.length - 1; i >= 0; i--) {\n const isPrefixedMatch = (\n result[i].property &&\n result[i].property.endsWith(propertyName) &&\n result[i].property.startsWith('-')\n );\n if (isPrefixedMatch) {\n prefixedIndex = i;\n break;\n }\n }\n }\n\n if (prefixedIndex !== -1) {\n let prefixedValue = minifyValue(result[prefixedIndex]);\n if (minifiedValue === prefixedValue) {\n result.splice(prefixedIndex, 1);\n // Re-adjust previousIndex if we removed an item before it\n if (previousIndex > prefixedIndex) {\n previousIndex--;\n }\n }\n }\n\n if (previousIndex !== -1) {\n const previousValue = minifyValue(result[previousIndex]);\n\n if (previousValue.includes('!important') && !minifiedValue.includes('!important')) {\n continue;\n }\n\n // Fallbacks for custom variables or older browser functions should be kept\n const currentUsesModernSyntax = (\n minifiedValue.includes('calc(') ||\n minifiedValue.includes('env(') ||\n minifiedValue.includes('var(') ||\n minifiedValue.includes('-webkit-')\n );\n const previousUsesModernSyntax = (\n previousValue.includes('calc(') ||\n previousValue.includes('env(') ||\n previousValue.includes('var(') ||\n previousValue.includes('-webkit-')\n );\n if (currentUsesModernSyntax && !previousUsesModernSyntax) {\n result.push(declaration);\n continue;\n }\n\n // Otherwise override previous identical property\n result.splice(previousIndex, 1);\n }\n\n result.push(declaration);\n }\n\n // Handle shorthand merging\n\n // First, remove longhand properties that are overridden by existing shorthands\n const propertiesToRemove = new Set();\n for (let i = 0; i < result.length; i++) {\n const declaration = result[i];\n if (declaration.property && shorthandMap[declaration.property]) {\n // This is a shorthand, check if any longhands come before it\n const overridden = getOverriddenLonghands(declaration.property);\n for (const longhandProperty of overridden) {\n const longhandIndex = result.findIndex((candidate, index) => {\n return candidate.property === longhandProperty && index < i;\n });\n if (longhandIndex !== -1) {\n propertiesToRemove.add(longhandProperty);\n }\n }\n }\n }\n\n result = result.filter((declaration) => {\n return !propertiesToRemove.has(declaration.property);\n });\n\n // Try to merge remaining longhands into shorthands\n let changed = true;\n while (changed) {\n changed = false;\n const mergedProperties = new Set();\n const newDeclarations = [];\n\n for (const [shorthand, longhands] of Object.entries(shorthandMap)) {\n const shorthandAlreadyExists = result.some((declaration) => {\n return declaration.property === shorthand;\n });\n if (shorthandAlreadyExists) {\n continue;\n }\n\n const mergeableProperties = getMergeProps(shorthand, longhands, result);\n if (!mergeableProperties) {\n continue;\n }\n const relevantDeclarations = result.filter((declaration) => {\n return mergeableProperties.includes(declaration.property);\n });\n const mergedValue = tryMergeToShorthand(mergeableProperties, relevantDeclarations, shorthand, context);\n if (!mergedValue) {\n continue;\n }\n\n newDeclarations.push({ property: shorthand, value: mergedValue });\n const isMarginPaddingInset = (\n shorthand === 'margin' ||\n shorthand === 'padding' ||\n shorthand === 'inset'\n );\n const someAreImportant = relevantDeclarations.some((declaration) => {\n return minifyValue(declaration).includes('!important');\n });\n const allAreImportant = relevantDeclarations.every((declaration) => {\n return minifyValue(declaration).includes('!important');\n });\n const hasMixedImportant = someAreImportant && !allAreImportant;\n\n if (isMarginPaddingInset && hasMixedImportant) {\n for (const property of mergeableProperties) {\n const declaration = relevantDeclarations.find((candidate) => {\n return candidate.property === property;\n });\n if (declaration && !minifyValue(declaration).includes('!important')) {\n mergedProperties.add(property);\n }\n }\n } else {\n for (const property of mergeableProperties) {\n mergedProperties.add(property);\n }\n }\n }\n\n if (newDeclarations.length) {\n result = result.filter((declaration) => {\n return !mergedProperties.has(declaration.property);\n });\n result = [...result, ...newDeclarations];\n changed = true;\n }\n }\n\n return orderDeclarations(result);\n}\n\nexport { processDeclarations };\n","/**\n * @file Converts parsed CSS AST rule nodes into minified CSS strings, handling all CSS at-rule types, selectors, declarations, and nesting.\n */\n\nimport { processDeclarations } from '../declarations/process.js';\nimport { minifyValue } from '../value/minify.js';\n\nimport {\n canUnwrapSupports,\n normalizeMedia,\n normalizeSupports,\n unescapeIdent,\n unescapeSelector\n} from './normalize.js';\n\n/**\n * Renders an array of CSS declaration objects as a minified semicolon-separated string, filtering out whitespace entries.\n *\n * @param {Array} declarations The declaration objects to render.\n * @return {string} A semicolon-joined \"property:value\" string.\n */\nfunction stringifyDeclarations (declarations) {\n return declarations\n .filter((declaration) => {\n return declaration.type !== 'whitespace';\n })\n .map((declaration) => {\n return [declaration.property, ':', minifyValue(declaration)].join('');\n })\n .join(';');\n}\n\n/**\n * Recursively stringifies child rules into a concatenated minified CSS string.\n *\n * @param {Array} rules The child AST rule nodes to stringify.\n * @param {object} context The minification context.\n * @return {string} The concatenated minified CSS for all child rules.\n */\nfunction stringifyChildRules (rules, context) {\n return (rules || []).map((childRule) => {\n return stringifyRule(childRule, context);\n }).join('');\n}\n\n/**\n * Splits a parameter string by commas while respecting nested parentheses,\n * so commas inside function calls within default values are not treated as separators.\n *\n * @param {string} parameterString The comma-separated parameter string to split.\n * @return {Array} An array of individual parameter strings.\n */\nfunction splitParametersByComma (parameterString) {\n const parameters = [];\n let currentParameter = '';\n let parenthesisDepth = 0;\n for (const character of parameterString) {\n if (character === '(') {\n parenthesisDepth++;\n } else if (character === ')') {\n parenthesisDepth--;\n }\n if (character === ',' && parenthesisDepth === 0) {\n parameters.push(currentParameter);\n currentParameter = '';\n } else {\n currentParameter += character;\n }\n }\n parameters.push(currentParameter);\n return parameters;\n}\n\n/**\n * Minifies a `@function` prelude (signature) by collapsing whitespace around\n * parameter separators (commas) and default value delimiters (colons).\n *\n * @param {string} prelude The raw `@function` prelude string (e.g. \"--tint(--color, --amount: 10%)\").\n * @return {string} The minified prelude (e.g. \"--tint(--color,--amount:10%)\").\n */\nfunction minifyFunctionPrelude (prelude) {\n const trimmedPrelude = prelude.trim();\n const openParenIndex = trimmedPrelude.indexOf('(');\n if (openParenIndex === -1) {\n return trimmedPrelude;\n }\n const functionName = trimmedPrelude.slice(0, openParenIndex);\n const closeParenIndex = trimmedPrelude.lastIndexOf(')');\n const innerContent = trimmedPrelude.slice(openParenIndex + 1, closeParenIndex);\n const parameters = splitParametersByComma(innerContent);\n const minifiedParameters = parameters.map((parameter) => {\n // Collapse whitespace around the colon separating parameter name from default value\n return parameter.trim().replace(/\\s*:\\s*/, ':');\n });\n return functionName + '(' + minifiedParameters.join(',') + ')';\n}\n\n/**\n * Stringifies a generic `at-rule` AST node into minified CSS, with specialized\n * prelude minification for `@function` rules and generic whitespace handling\n * for other unknown at-rules.\n *\n * @param {object} rule The AST at-rule node with name, prelude, and rules.\n * @param {object} context The minification context.\n * @return {string} The minified at-rule CSS string, or empty string if body is empty.\n */\nfunction stringifyAtRule (rule, context) {\n let minifiedPrelude;\n if (rule.name === 'function') {\n minifiedPrelude = minifyFunctionPrelude(rule.prelude || '');\n } else {\n // Collapse runs of whitespace to a single space for generic at-rules\n minifiedPrelude = (rule.prelude || '').trim().replace(/\\s+/g, ' ');\n }\n\n const bodyItems = (rule.rules || []).filter((item) => {\n return item.type !== 'whitespace';\n });\n if (bodyItems.length === 0) {\n return '';\n }\n\n const declarations = bodyItems.filter((item) => {\n return item.type === 'declaration' && item.property;\n });\n const nestedRules = bodyItems.filter((item) => {\n return item.type !== 'declaration';\n });\n\n const renderedDeclarations = stringifyDeclarations(declarations);\n const renderedNestedRules = stringifyChildRules(nestedRules, context);\n const body = [renderedDeclarations, renderedNestedRules].filter(Boolean).join('');\n if (!body) {\n return '';\n }\n\n const separator = minifiedPrelude ? ' ' : '';\n return '@' + rule.name + separator + minifiedPrelude + '{' + body + '}';\n}\n\n/**\n * Finds the index of the closing parenthesis that matches the opening\n * parenthesis at the given position in the string.\n *\n * @param {string} text The string to search within.\n * @param {number} openIndex The index of the opening parenthesis.\n * @return {number} The index of the matching closing parenthesis, or -1 if not found.\n */\nfunction findMatchingCloseParenthesis (text, openIndex) {\n let depth = 0;\n for (let index = openIndex; index < text.length; index++) {\n if (text[index] === '(') {\n depth++;\n } else if (text[index] === ')') {\n depth--;\n if (depth === 0) {\n return index;\n }\n }\n }\n return -1;\n}\n\n/**\n * Extracts the type selector or universal selector from the beginning of a\n * compound selector string, if one is present. A type selector is a bare\n * element name (e.g. `div`, `a`); the universal selector is `*`.\n *\n * @param {string} compoundSelector A single compound CSS selector string.\n * @return {string|null} The type or universal selector, or null if none is present.\n */\nfunction extractTypeSelector (compoundSelector) {\n // Match universal selector (*) or type selector (letter followed by alphanumeric chars or hyphens)\n const match = compoundSelector.match(/^(\\*|[a-zA-Z][a-zA-Z0-9-]*)/);\n if (match) {\n return match[0];\n }\n return null;\n}\n\n/**\n * Merges two simple/compound selectors into a single compound selector,\n * ensuring any type or universal selector appears first. Returns null when\n * merging is invalid because both sides contain a type or universal selector.\n *\n * @param {string} left The first selector to merge.\n * @param {string} right The second selector to merge.\n * @return {string|null} The merged compound selector, or null if the merge is invalid.\n */\nfunction mergeCompoundSelectors (left, right) {\n const leftTypeSelector = extractTypeSelector(left);\n const rightTypeSelector = extractTypeSelector(right);\n if (leftTypeSelector && rightTypeSelector) {\n return null;\n }\n // When the right side has a type selector, it must come first in the compound\n if (rightTypeSelector) {\n return right + left;\n }\n return left + right;\n}\n\n/**\n * Builds the cartesian product of two selector lists by merging every\n * combination of left and right selectors into compound selectors.\n * Returns null if any combination produces an invalid merge.\n *\n * @param {Array} leftParts Selectors from the first `:where()`.\n * @param {Array} rightParts Selectors from the second `:where()`.\n * @return {Array|null} The array of merged compound selectors, or null if any merge is invalid.\n */\nfunction buildWhereCartesianProduct (leftParts, rightParts) {\n const products = [];\n for (const leftSelector of leftParts) {\n for (const rightSelector of rightParts) {\n const merged = mergeCompoundSelectors(leftSelector.trim(), rightSelector.trim());\n if (merged === null) {\n return null;\n }\n products.push(merged);\n }\n }\n return products;\n}\n\n/**\n * Scans a selector string for adjacent `:where(A):where(B)` patterns and\n * merges them into a single `:where(AB)` (or `:where()` with the cartesian\n * product of their selector lists) when the merged form is strictly shorter.\n * Type selectors are correctly repositioned to the front of each merged\n * compound, and merges that would produce invalid compound selectors (two\n * type selectors) are skipped.\n *\n * @param {string} selector A minified CSS selector string.\n * @return {string} The selector with beneficial adjacent `:where()` merges applied.\n */\nfunction mergeAdjacentWherePseudoClasses (selector) {\n let result = selector;\n let position = 0;\n while (position < result.length) {\n const whereIndex = result.indexOf(':where(', position);\n if (whereIndex === -1) {\n break;\n }\n // Index of the '(' in the first ':where('\n const firstOpenParenthesis = whereIndex + 6;\n const firstCloseParenthesis = findMatchingCloseParenthesis(result, firstOpenParenthesis);\n if (firstCloseParenthesis === -1) {\n break;\n }\n const adjacentStart = firstCloseParenthesis + 1;\n const adjacentWhereTag = ':where(';\n if (result.slice(adjacentStart, adjacentStart + adjacentWhereTag.length) !== adjacentWhereTag) {\n position = firstCloseParenthesis + 1;\n continue;\n }\n // Index of the '(' in the second ':where('\n const secondOpenParenthesis = adjacentStart + 6;\n const secondCloseParenthesis = findMatchingCloseParenthesis(result, secondOpenParenthesis);\n if (secondCloseParenthesis === -1) {\n break;\n }\n const firstInnerContent = result.slice(firstOpenParenthesis + 1, firstCloseParenthesis);\n const secondInnerContent = result.slice(secondOpenParenthesis + 1, secondCloseParenthesis);\n const leftParts = splitParametersByComma(firstInnerContent);\n const rightParts = splitParametersByComma(secondInnerContent);\n const mergedParts = buildWhereCartesianProduct(leftParts, rightParts);\n if (mergedParts === null) {\n position = firstCloseParenthesis + 1;\n continue;\n }\n const originalFragment = result.slice(whereIndex, secondCloseParenthesis + 1);\n const mergedFragment = ':where(' + mergedParts.join(',') + ')';\n if (mergedFragment.length < originalFragment.length) {\n result = result.slice(0, whereIndex) + mergedFragment + result.slice(secondCloseParenthesis + 1);\n // Don't advance position; the merged result may be adjacent to another :where()\n } else {\n position = firstCloseParenthesis + 1;\n }\n }\n return result;\n}\n\n/**\n * Processes a bare `:is()` selector by merging `:link`+`:visited` into `:any-link`,\n * de-duplicating, sorting alphabetically, and conditionally expanding into individual\n * selectors when all parts are simple type/universal selectors with no modifications.\n *\n * @param {string} selector A minified CSS selector string.\n * @return {Array} An array of one or more processed selector strings.\n */\nfunction processIsSelector (selector) {\n // Replace :is(:link,:visited) and :is(:visited,:link) with :any-link\n selector = selector.replace(/:is\\(:link,:visited\\)/g, ':any-link');\n selector = selector.replace(/:is\\(:visited,:link\\)/g, ':any-link');\n // Only process bare :is() selectors (where :is() is the entire selector)\n if (!selector.startsWith(':is(')) {\n return [selector];\n }\n let depth = 0;\n let closingIndex = -1;\n for (let index = 4; index < selector.length; index++) {\n if (selector[index] === '(') {\n depth++;\n } else if (selector[index] === ')') {\n if (depth === 0) {\n closingIndex = index;\n break;\n }\n depth--;\n }\n }\n if (closingIndex !== selector.length - 1) {\n return [selector];\n }\n const content = selector.slice(4, -1);\n let parts = [];\n let currentPart = '';\n let parenDepth = 0;\n for (const character of content) {\n if (character === '(') {\n parenDepth++;\n } else if (character === ')') {\n parenDepth--;\n }\n if (character === ',' && parenDepth === 0) {\n parts.push(currentPart);\n currentPart = '';\n } else {\n currentPart += character;\n }\n }\n parts.push(currentPart);\n const originalCount = parts.length;\n // Replace :link + :visited with :any-link\n const hasLink = parts.includes(':link');\n const hasVisited = parts.includes(':visited');\n if (hasLink && hasVisited) {\n parts = parts.filter((part) => {\n return part !== ':link' && part !== ':visited';\n });\n if (!parts.includes(':any-link')) {\n parts.push(':any-link');\n }\n }\n // De-duplicate\n parts = [...new Set(parts)];\n // Sort alphabetically\n parts.sort();\n // Unwrap :is() with a single selector\n if (parts.length === 1) {\n return parts;\n }\n // Expand if all parts are simple type/universal selectors and no dedup/replacement occurred\n const allSimple = parts.every((part) => {\n return /^[a-z*][a-z0-9-]*$/i.test(part);\n });\n if (allSimple && parts.length === originalCount) {\n return parts;\n }\n return [':is(' + parts.join(',') + ')'];\n}\n\n/**\n * Removes spaces after commas only inside parenthesized groups (function\n * calls like `var()`, `calc()`), leaving top-level comma spacing intact.\n *\n * @param {string} value The whitespace-collapsed custom property value.\n * @return {string} The value with post-comma spaces removed inside function calls only.\n */\nfunction removeSpacesAfterCommasInsideFunctions (value) {\n let result = '';\n let parenthesisDepth = 0;\n for (let index = 0; index < value.length; index++) {\n const character = value[index];\n if (character === '(') {\n parenthesisDepth++;\n }\n if (character === ')') {\n parenthesisDepth--;\n }\n if (character === ',' && parenthesisDepth > 0) {\n result += ',';\n // Skip whitespace after the comma inside function calls\n while (index + 1 < value.length && value[index + 1] === ' ') {\n index++;\n }\n } else {\n result += character;\n }\n }\n return result;\n}\n\n/**\n * Strips leading zeros from decimal numbers in a custom property value\n * (e.g. `0.5` becomes `.5`, `-0.02em` becomes `-.02em`).\n *\n * @param {string} value The custom property value string.\n * @return {string} The value with leading zeros removed from decimals.\n */\nfunction stripLeadingZerosFromDecimals (value) {\n // Match a boundary (start, whitespace, comma, open-paren), optional sign, then leading zeros before a decimal\n return value.replace(/(^|\\s|,|\\()(-?)0+(\\.\\d+)/g, '$1$2$3');\n}\n\n/**\n * Collapses whitespace in a custom property value while preserving\n * token boundaries. Each whitespace sequence is reduced to a single\n * space, spaces after commas inside function calls are removed, and\n * leading zeros on decimal numbers are stripped.\n *\n * @param {string} value The raw custom property value string.\n * @return {string} The minified custom property value.\n */\nfunction collapseCustomPropertyWhitespace (value) {\n // Collapse all whitespace sequences (newlines, tabs, multiple spaces) to a single space\n let collapsed = value.replace(/\\s+/g, ' ');\n // Remove spaces after commas only inside function calls (e.g. var(--bar, 1.5) → var(--bar,1.5))\n collapsed = removeSpacesAfterCommasInsideFunctions(collapsed);\n // Strip leading zeros from decimals (e.g. 0.5 → .5, -0.02em → -.02em)\n collapsed = stripLeadingZerosFromDecimals(collapsed);\n return collapsed;\n}\n\n/**\n * Converts a parsed CSS AST rule node into a minified CSS string, dispatching to specialized handlers for each rule type including selectors, `@media`, `@keyframes`, `@layer`, and other at-rules.\n *\n * @param {object} rule The AST rule node to stringify.\n * @param {object} context The minification context with registered custom property data.\n * @param {boolean} nested Whether this rule is nested inside another rule, affecting spacing.\n * @return {string} The minified CSS string for this rule, or an empty string if the rule is empty.\n */\nfunction stringifyRule (rule, context, nested = false) {\n if (rule.type === 'rule') {\n let declarations = rule.declarations\n ?.filter((declaration) => {\n return declaration.type !== 'whitespace';\n }) || [];\n\n // Ignore empty rules (comments-only rules are also effectively empty)\n const isEffectivelyEmpty = (\n declarations.length === 0 ||\n declarations.every((declaration) => {\n return declaration.type === 'comment' && !declaration.comment?.startsWith('!');\n })\n );\n if (isEffectivelyEmpty) {\n return '';\n }\n\n let output = [];\n if (rule.selectors?.length) {\n let uniqueSelectors = [...new Set(rule.selectors)];\n // Minify spacing within selectors (e.g. inside :is(), :where(), etc)\n uniqueSelectors = uniqueSelectors.map((selector) => {\n let minified = unescapeSelector(selector);\n // Collapse whitespace to single space\n minified = minified.replace(/\\s+/g, ' ');\n // Strip whitespace around selector combinators and commas\n minified = minified.replace(/\\s*([,>+~])\\s*/g, '$1');\n // Strip whitespace inside parentheses for pseudo-class arguments\n minified = minified.replace(/\\(\\s+/g, '(').replace(/\\s+\\)/g, ')');\n // Simplify :nth-child(2n+1) to :nth-child(odd)\n minified = minified.replace(/:nth-child\\(2n\\s*\\+\\s*1\\)/g, ':nth-child(odd)');\n // Simplify :nth-child(2n+0) to :nth-child(2n)\n minified = minified.replace(/:nth-child\\(2n\\s*\\+\\s*0\\)/g, ':nth-child(2n)');\n // Simplify :nth-child(1n) to :nth-child(n)\n minified = minified.replace(/:nth-child\\(1n\\)/g, ':nth-child(n)');\n // Remove unnecessary leading + sign from :nth-child()\n minified = minified.replace(/:nth-child\\(\\+\\s*(\\d+)\\)/g, ':nth-child($1)');\n // Simplify :nth-child(0n+N) to :nth-child(N)\n minified = minified.replace(/:nth-child\\(0n\\s*\\+\\s*(\\d+)\\)/g, ':nth-child($1)');\n // Replace :nth-child(1) with :first-child\n minified = minified.replace(/:nth-child\\(1\\)/g, ':first-child');\n // Replace :nth-last-child(1) with :last-child\n minified = minified.replace(/:nth-last-child\\(1\\)/g, ':last-child');\n // Replace :nth-of-type(1) with :first-of-type\n minified = minified.replace(/:nth-of-type\\(1\\)/g, ':first-of-type');\n // Replace :nth-last-of-type(1) with :last-of-type\n minified = minified.replace(/:nth-last-of-type\\(1\\)/g, ':last-of-type');\n // Convert double-colon pseudo-elements to single-colon legacy form\n minified = minified.replace(/::before/g, ':before');\n minified = minified.replace(/::after/g, ':after');\n\n // Strip redundant universal selector `*` when it precedes an ID, class, or attribute selector\n minified = minified.replace(/\\*([#.[])/g, '$1');\n\n // Minify double-quoted attribute selectors: remove inner whitespace and escape when shorter\n minified = minified.replace(/\\[\\s*([^=]+)\\s*=\\s*\"(.*?)\"\\s*\\]/g, (match, attribute, value) => {\n // Escape special characters that require quoting (spaces, #, ., :, /), and compare lengths\n let escaped = value.replace(/([ #.:/])/g, '\\\\$1');\n if (escaped.length < value.length + 2) {\n return '[' + attribute + '=' + escaped + ']';\n }\n return '[' + attribute + '=\"' + value + '\"]';\n });\n // Minify single-quoted attribute selectors: remove inner whitespace and escape when shorter\n minified = minified.replace(/\\[\\s*([^=]+)\\s*=\\s*'(.*?)'\\s*\\]/g, (match, attribute, value) => {\n // Escape special characters that require quoting (spaces, #, ., :, /), and compare lengths\n let escaped = value.replace(/([ #.:/])/g, '\\\\$1');\n if (escaped.length < value.length + 2) {\n return '[' + attribute + '=' + escaped + ']';\n }\n return '[' + attribute + '=\"' + value + '\"]';\n });\n // Minify unquoted attribute selectors: quote when unescaping produces a shorter result\n minified = minified.replace(/\\[\\s*([^=]+)\\s*=\\s*([^\"'].*?)\\s*\\]/g, (match, attribute, value) => {\n // Unescape special characters (spaces, #, ., :, /) and compare with quoted form\n let unescaped = value.replace(/\\\\([ #.:/])/g, '$1');\n if (unescaped.length + 2 < value.length) {\n return '[' + attribute + '=\"' + unescaped + '\"]';\n }\n return '[' + attribute + '=' + value + ']';\n });\n\n // Minify logical combinations\n minified = minified.replace(/(?<=\\b(?:button|fieldset|form|input|select|textarea)):not\\(:invalid\\)/g, ':valid');\n minified = minified.replace(/:not\\(:dir\\(ltr\\)\\)/g, ':dir(rtl)');\n minified = minified.replace(/:not\\(:not\\((.*?)\\)\\)/g, '$1');\n minified = minified.replace(/:not\\(:enabled\\)/g, ':disabled');\n minified = minified.replace(/:not\\(:required\\)/g, ':optional');\n minified = minified.replace(/(^|[\\s,>+~])(a|area|link)(?:\\[.*?\\])*(?::where\\()?:not\\(:link\\)\\)?/g, (match) => {\n return match.replace(':not(:link)', ':visited');\n });\n // Remove redundant leading \"& \" nesting selector\n minified = minified.replace(/^& /, '');\n minified = mergeAdjacentWherePseudoClasses(minified);\n return minified;\n });\n uniqueSelectors = uniqueSelectors.flatMap(processIsSelector);\n uniqueSelectors = [...new Set(uniqueSelectors)];\n const headingSet = new Set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']);\n const isAllHeadings = (\n rule.selectors.length === 6 &&\n uniqueSelectors.length === 6 &&\n uniqueSelectors.every((selector) => {\n return headingSet.has(selector);\n })\n );\n if (isAllHeadings) {\n uniqueSelectors = [':heading'];\n }\n output.push(uniqueSelectors.join(','));\n }\n output.push('{');\n\n declarations = processDeclarations(declarations, context);\n\n // We need to properly output nested rules vs normal declarations.\n // Wait, the processDeclarations will now correctly keep 'rule' types because we push them in processDeclarations.\n // If we have `.foo { .bar { color: red; } }`, the inner rule is a declaration of type 'rule' with selectors: ['.bar'].\n // The previous stringifyRule recursively calls stringifyRule.\n\n let innerDeclarations = declarations.filter((declaration) => {\n return declaration.type !== 'rule' && declaration.type !== 'media';\n });\n let nestedRules = declarations.filter((declaration) => {\n return declaration.type === 'rule' || declaration.type === 'media';\n });\n\n let renderedDeclarations = innerDeclarations\n .map((declaration) => {\n if (!declaration.property) {\n return '';\n }\n const property = unescapeIdent(declaration.property);\n let value;\n if (property.startsWith('--')) {\n const syntax = context.registeredCustomPropertySyntax.get(property);\n if (syntax === '\"<color>\"') {\n value = minifyValue(declaration);\n } else {\n const rawValue = declaration.rawValue || declaration.value || '';\n const trimmedRawValue = rawValue.trim();\n if (trimmedRawValue === '') {\n value = ' ';\n // Preserve leading space for rgb() space-syntax values in custom properties\n } else if (/^rgb\\(\\s*\\d+\\s+\\d+\\s+\\d+\\s*\\)$/i.test(trimmedRawValue)) {\n value = ' ' + trimmedRawValue;\n } else {\n value = collapseCustomPropertyWhitespace(trimmedRawValue);\n // Prepend a space when value starts with a bare decimal point to avoid ambiguity after the colon\n if (value.startsWith('.')) {\n value = ' ' + value;\n }\n }\n }\n } else {\n value = minifyValue(declaration);\n }\n return [property, ':', value].join('');\n })\n .join(';');\n\n let renderedNested = nestedRules.map((nestedRule) => {\n return stringifyRule(nestedRule, context, true);\n }).join('');\n\n output.push(renderedDeclarations);\n if (renderedDeclarations && renderedNested && !renderedDeclarations.endsWith(';')) {\n output.push(';');\n }\n output.push(renderedNested);\n\n output.push('}');\n return output.join('');\n }\n\n if (rule.type === 'media') {\n const normalizedMedia = normalizeMedia(rule.media);\n let separator;\n if (nested && normalizedMedia.startsWith('(')) {\n separator = '';\n } else {\n separator = ' ';\n }\n const items = rule.rules || [];\n const mediaDeclarations = items.filter((item) => {\n return item.type === 'declaration' && item.property;\n });\n const subRules = items.filter((item) => {\n return item.type !== 'declaration';\n });\n const renderedDeclarations = mediaDeclarations.map((declaration) => {\n return [unescapeIdent(declaration.property), ':', minifyValue(declaration)].join('');\n }).join(';');\n const renderedRules = subRules.map((childRule) => {\n return stringifyRule(childRule, context, false);\n }).join('');\n const children = [renderedDeclarations, renderedRules].filter(Boolean).join('');\n if (!children) {\n return '';\n }\n return '@media' + separator + normalizedMedia + '{' + children + '}';\n }\n\n if (rule.type === 'starting-style') {\n const children = stringifyChildRules(rule.rules, context);\n if (!children) {\n return '';\n }\n return '@starting-style{' + children + '}';\n }\n\n if (rule.type === 'scope') {\n // Collapse whitespace around \"to\" keyword in @scope condition\n const scope = (rule.scope || '').trim().replace(/\\s+to\\s+/g, 'to ');\n const children = stringifyChildRules(rule.rules, context);\n if (!children) {\n return '';\n }\n return '@scope' + scope + '{' + children + '}';\n }\n\n if (rule.type === 'supports') {\n let supports = normalizeSupports(rule.supports);\n let children = stringifyChildRules(rule.rules, context);\n if (!children) {\n return '';\n }\n if (canUnwrapSupports(supports)) {\n return children;\n }\n // Check if @supports condition has adjacent logical operators that allow tight spacing\n const needsTightSpacing = supports.startsWith('(') && /\\)(?:and|or)\\s*\\(/.test(supports);\n let supportsSeparator;\n if (needsTightSpacing) {\n supportsSeparator = '';\n } else {\n supportsSeparator = ' ';\n }\n return '@supports' + supportsSeparator + supports + '{' + children + '}';\n }\n\n if (rule.type === 'keyframes') {\n let children = (rule.keyframes || [])\n .filter((keyframe) => {\n return keyframe.type === 'keyframe';\n })\n .map((keyframe) => {\n let output = [];\n let stopValues = keyframe.values.map((stopValue) => {\n if (stopValue === 'from') {\n return '0%';\n }\n if (stopValue === '100%') {\n return 'to';\n }\n return stopValue;\n });\n output.push(stopValues.join(','));\n output.push('{');\n const renderedKeyframeDeclarations = keyframe.declarations\n ?.filter((declaration) => {\n return declaration.type !== 'whitespace';\n })\n ?.map((declaration) => {\n return [declaration.property, ':', minifyValue(declaration)].join('');\n })\n .join(';') || '';\n output.push(renderedKeyframeDeclarations);\n output.push('}');\n return output.join('');\n }).join('');\n if (!children) {\n return '';\n }\n return '@keyframes ' + rule.name + '{' + children + '}';\n }\n\n if (rule.type === 'font-face') {\n let renderedDeclarations = stringifyDeclarations(rule.declarations || []);\n if (!renderedDeclarations) {\n return '';\n }\n return '@font-face{' + renderedDeclarations + '}';\n }\n\n if (rule.type === 'charset') {\n return '@charset ' + rule.charset + ';';\n }\n\n if (rule.type === 'import') {\n let importStatement = rule.import;\n // Unwrap url() with a quoted string to just the quoted string\n importStatement = importStatement.replace(/url\\(\\s*(\".*?\"|'.*?')\\s*\\)/g, '$1');\n // Unwrap url() with an unquoted path and add quotes\n importStatement = importStatement.replace(/url\\(\\s*(.*?)\\s*\\)/g, '\"$1\"');\n // Collapse whitespace in the import statement\n importStatement = importStatement.replace(/\\s+/g, ' ').trim();\n // Remove space immediately after the quoted URL path\n importStatement = importStatement.replace(/^(\".*?\"|'.*?') /, '$1');\n // Remove space between closing paren and next at-rule condition keyword\n importStatement = importStatement.replace(/\\) ([a-zA-Z])/g, ')$1');\n // Minify property:value pairs inside supports() by removing whitespace around colons\n importStatement = importStatement.replace(\n /supports\\(([^()]*)\\)/g,\n (fullMatch, content) => {\n return 'supports(' + content.replace(/\\s*:\\s*/g, ':') + ')';\n }\n );\n const startsWithQuote = importStatement.startsWith('\"') || importStatement.startsWith('\\'');\n let importSeparator;\n if (startsWithQuote) {\n importSeparator = '';\n } else {\n importSeparator = ' ';\n }\n return '@import' + importSeparator + importStatement + ';';\n }\n\n if (rule.type === 'layer') {\n if (rule.rules && rule.rules.length) {\n return '@layer ' + (rule.layer || '') + '{' + stringifyChildRules(rule.rules, context) + '}';\n } else {\n return '@layer ' + rule.layer + ';';\n }\n }\n\n if (rule.type === 'property') {\n let renderedDeclarations = stringifyDeclarations(rule.declarations || []);\n if (!renderedDeclarations) {\n return '';\n }\n return '@property ' + rule.name + '{' + renderedDeclarations + '}';\n }\n\n if (rule.type === 'container') {\n // Minify @container condition: collapse whitespace and strip spaces around punctuation\n let container = rule.container\n .replace(/\\s+/g, ' ')\n .replace(/\\s*([:,])\\s*/g, '$1')\n .replace(/\\s*([=<>])\\s*/g, '$1')\n .replace(/\\(\\s+/g, '(')\n .replace(/\\s+\\)/g, ')');\n // Convert min-width/max-width to range syntax (e.g. min-width:768px → width>=768px)\n container = container.replace(/min-width:(\\d+px)/gi, 'width>=$1').replace(/max-width:(\\d+px)/gi, 'width<=$1');\n let children = stringifyChildRules(rule.rules, context);\n if (!children) {\n return '';\n }\n let containerSeparator;\n if (container.startsWith('(')) {\n containerSeparator = '';\n } else {\n containerSeparator = ' ';\n }\n return '@container' + containerSeparator + container + '{' + children + '}';\n }\n\n if (rule.type === 'page') {\n const trimmedSelectors = (rule.selectors || []).map((selector) => {\n return selector.trim();\n }).filter(Boolean);\n const selectorString = trimmedSelectors.join(',');\n let pageSeparator = '';\n if (selectorString) {\n if (selectorString.startsWith(':')) {\n pageSeparator = '';\n } else {\n pageSeparator = ' ';\n }\n }\n const parts = (rule.declarations || [])\n .filter((declaration) => {\n return declaration.type !== 'whitespace';\n })\n .flatMap((declaration) => {\n if (declaration.type === 'page-margin-box' && declaration.name) {\n const innerDeclarations = (declaration.declarations || [])\n .filter((innerDeclaration) => {\n return innerDeclaration.type !== 'whitespace' && innerDeclaration.property;\n })\n .map((innerDeclaration) => {\n return [unescapeIdent(innerDeclaration.property), ':', minifyValue(innerDeclaration)].join('');\n })\n .join(';');\n if (innerDeclarations) {\n return ['@' + declaration.name + '{' + innerDeclarations + '}'];\n }\n return [];\n }\n if (declaration.property) {\n return [[unescapeIdent(declaration.property), ':', minifyValue(declaration)].join('')];\n }\n return [];\n });\n if (!parts.length) {\n return '';\n }\n return '@page' + pageSeparator + selectorString + '{' + parts.join(';') + '}';\n }\n\n if (rule.type === 'counter-style') {\n let renderedDeclarations = stringifyDeclarations(rule.declarations || []);\n if (!renderedDeclarations) {\n return '';\n }\n return '@counter-style ' + rule.name + '{' + renderedDeclarations + '}';\n }\n\n if (rule.type === 'position-try') {\n let renderedDeclarations = stringifyDeclarations(rule.declarations || []);\n if (!renderedDeclarations) {\n return '';\n }\n return '@position-try ' + rule.name + '{' + renderedDeclarations + '}';\n }\n\n if (rule.type === 'document') {\n const children = stringifyChildRules(rule.rules, context);\n if (!children) {\n return '';\n }\n const vendor = rule.vendor || '';\n const condition = (rule.document || '')\n .trim()\n // Remove spaces between document condition function calls (e.g. \"), \" → \",\")\n .replace(/\\)\\s*,\\s*/g, '),');\n return '@' + vendor + 'document ' + condition + '{' + children + '}';\n }\n\n if (rule.type === 'comment') {\n if (rule.comment.startsWith('!')) {\n return '/*' + rule.comment + '*/';\n }\n return '';\n }\n\n if (rule.type === 'at-rule') {\n return stringifyAtRule(rule, context);\n }\n\n return ''; // Ignore unknown for now\n}\n\nexport { stringifyRule };\n","/**\n * @file CSS minification entry point.\n */\n\nimport { parse } from '@node-projects/css-parser';\n\nimport { createMinifyContext } from './context.js';\nimport {\n analyzePositionTryRules,\n cleanPositionTryRules,\n collectRuleMetadata,\n filterRedundantCharsets,\n filterUnusedPositionTry\n} from './position-try.js';\nimport {\n neutralizeEscapeSequences,\n preprocessDeclarationBlocks,\n restoreEscapeSequences\n} from './preprocess.js';\nimport {\n deduplicateKeyframes,\n expandPureNestedRules,\n factorCommonParents,\n mergeByDeclarations,\n mergeLayerRules,\n mergeMediaRules,\n mergeSelectorRules,\n nestFlatRules,\n removeEmptyRules\n} from './rules/optimize.js';\nimport { stringifyRule } from './rules/stringify.js';\nimport { minifyValue } from './value/minify.js';\n\n/**\n * Splits a minified CSS selector list at top-level commas, respecting\n * parenthesized and bracketed groups so that commas inside pseudo-class\n * arguments like `:is(a, b)` are not treated as selector separators.\n *\n * @param {string} selectorList The comma-separated selector list string.\n * @return {Array} An array of individual selector strings.\n */\nfunction splitSelectorList (selectorList) {\n const selectors = [];\n let current = '';\n let depth = 0;\n for (const character of selectorList) {\n if (character === '(' || character === '[') {\n depth++;\n current += character;\n } else if (character === ')' || character === ']') {\n depth--;\n current += character;\n } else if (character === ',' && depth === 0) {\n selectors.push(current.trim());\n current = '';\n } else {\n current += character;\n }\n }\n const remaining = current.trim();\n if (remaining) {\n selectors.push(remaining);\n }\n return selectors;\n}\n\n/**\n * Deduplicates a minified CSS selector list string by splitting at top-level\n * commas, removing duplicate selectors, and rejoining with commas.\n *\n * @param {string} selectorList The comma-separated selector list string.\n * @return {string} The deduplicated selector list string.\n */\nfunction deduplicateSelectorList (selectorList) {\n const selectors = splitSelectorList(selectorList);\n const seen = new Set();\n const unique = selectors.filter((selector) => {\n if (seen.has(selector)) {\n return false;\n }\n seen.add(selector);\n return true;\n });\n return unique.join(',');\n}\n\n/**\n * Extracts the declaration body (from the opening brace to the end) of a\n * stringified CSS rule. Returns null for at-rules or strings without braces,\n * since those should not participate in selector merging.\n *\n * @param {string} ruleString A stringified CSS rule.\n * @return {string|null} The body substring starting at `{`, or null if not a simple rule.\n */\nfunction extractRuleBody (ruleString) {\n // At-rules start with @ and should not be merged by selector\n if (ruleString.startsWith('@')) {\n return null;\n }\n const braceIndex = ruleString.indexOf('{');\n if (braceIndex === -1) {\n return null;\n }\n return ruleString.slice(braceIndex);\n}\n\n/**\n * Normalizes a stringified CSS rule body for order-independent comparison\n * by sorting top-level declarations alphabetically. Bodies that contain\n * nested rules (additional `{` characters beyond the opening brace) are\n * returned as-is since their internal structure makes simple sorting unsafe.\n *\n * @param {string} body The rule body string starting with `{`.\n * @return {string} The body with declarations sorted, or the original body if it contains nested rules.\n */\nfunction normalizeBodyForComparison (body) {\n // Nested rules contain additional opening braces; skip normalization\n if (body.indexOf('{', 1) !== -1) {\n return body;\n }\n const inner = body.slice(1, -1);\n if (!inner) {\n return body;\n }\n const declarations = inner.split(';').filter(Boolean).sort();\n return '{' + declarations.join(';') + '}';\n}\n\n/**\n * Merges consecutive stringified rules that share an identical declaration\n * body into a single rule with comma-separated selectors. This catches\n * rules whose values only become identical after minification (e.g.\n * `#F00` and `rgb(255,0,0)` both minify to `red`).\n *\n * @param {Array} ruleStrings The array of stringified CSS rule strings.\n * @return {Array} A new array with adjacent identical-body rules merged.\n */\nfunction mergeAdjacentRulesWithIdenticalBodies (ruleStrings) {\n const result = [];\n for (const ruleString of ruleStrings) {\n if (!ruleString) {\n continue;\n }\n const lastResult = result[result.length - 1];\n if (lastResult) {\n const lastBody = extractRuleBody(lastResult);\n const currentBody = extractRuleBody(ruleString);\n const bodiesAreEquivalent = (\n lastBody &&\n currentBody &&\n normalizeBodyForComparison(lastBody) === normalizeBodyForComparison(currentBody)\n );\n if (bodiesAreEquivalent) {\n const lastSelector = lastResult.slice(0, lastResult.length - lastBody.length);\n const currentSelector = ruleString.slice(0, ruleString.length - currentBody.length);\n const combinedSelector = deduplicateSelectorList(lastSelector + ',' + currentSelector);\n result[result.length - 1] = combinedSelector + lastBody;\n continue;\n }\n }\n result.push(ruleString);\n }\n return result;\n}\n\n/**\n * Parses, optimizes, and minifies a CSS string by applying rule merging, declaration deduplication, value compression, and dead-code elimination.\n *\n * @param {string} input The raw CSS string to minify.\n * @return {string} The fully minified CSS string, or the original input if parsing fails.\n */\nexport const minifyCSS = function (input) {\n let source;\n if (typeof input === 'string') {\n source = input;\n } else {\n source = String(input ?? '');\n }\n let ast;\n const output = [];\n\n try {\n ast = parse(\n preprocessDeclarationBlocks(neutralizeEscapeSequences(source)),\n { preserveFormatting: true, silent: true }\n );\n } catch {\n return source;\n }\n\n const context = createMinifyContext();\n\n if (ast?.stylesheet?.rules) {\n const {\n positionTryRules,\n positionTryUsage\n } = collectRuleMetadata(ast.stylesheet.rules, context);\n\n analyzePositionTryRules(\n ast.stylesheet.rules,\n minifyValue,\n positionTryRules,\n positionTryUsage\n );\n cleanPositionTryRules(ast.stylesheet.rules);\n\n ast.stylesheet.rules = filterUnusedPositionTry(\n ast.stylesheet.rules,\n positionTryRules,\n positionTryUsage\n );\n ast.stylesheet.rules = filterRedundantCharsets(ast.stylesheet.rules);\n\n ast.stylesheet.rules = expandPureNestedRules(ast.stylesheet.rules);\n ast.stylesheet.rules = mergeLayerRules(ast.stylesheet.rules, mergeSelectorRules);\n ast.stylesheet.rules = mergeMediaRules(ast.stylesheet.rules, mergeSelectorRules);\n ast.stylesheet.rules = deduplicateKeyframes(ast.stylesheet.rules);\n\n const mergedRules = mergeSelectorRules(ast.stylesheet.rules);\n const declarationMergedRules = mergeByDeclarations(mergedRules);\n const nestedRules = nestFlatRules(declarationMergedRules);\n const nonEmptyRules = removeEmptyRules(nestedRules);\n const factoredRules = factorCommonParents(nonEmptyRules);\n const finalRules = nestFlatRules(factoredRules);\n\n for (const rule of finalRules) {\n output.push(stringifyRule(rule, context));\n }\n\n const mergedOutput = mergeAdjacentRulesWithIdenticalBodies(output);\n\n return restoreEscapeSequences(mergedOutput.join(''));\n }\n\n return source;\n};\n"],"mappings":"mFASA,SAAS,GAAuB,CAC9B,MAAO,CACL,2BAA4B,IAAI,IAChC,+BAAgC,IAAI,GACtC,CACF,CCHA,SAAS,EAAqB,EAAO,EAAS,CAC5C,IAAM,EAAmB,IAAI,IACvB,EAAmB,IAAI,IAE7B,IAAK,IAAM,KAAQ,EAAO,CACxB,GAAI,EAAK,OAAS,YAAc,EAAK,KAAM,CACzC,EAAQ,2BAA2B,IAAI,EAAK,IAAI,EAChD,IAAM,GAAqB,EAAK,cAAgB,CAAC,EAAA,CAAG,KAAM,GACjD,EAAY,OAAS,cAAgB,EAAY,WAAa,QACtE,EACG,GAAmB,OACrB,EAAQ,+BAA+B,IAAI,EAAK,KAAM,EAAkB,KAAK,CAEjF,CACA,GAAI,EAAK,OAAS,eAAgB,CAChC,IAAM,GAAgB,EAAK,cAAgB,CAAC,EAAA,CAAG,OAAQ,GAC9C,EAAY,OAAS,YAC7B,EACG,EAAa,OAAS,IACxB,EAAiB,IAAI,EAAK,KAAM,CAAY,EAC5C,EAAiB,IAAI,EAAK,KAAM,CAAC,EAErC,CACF,CAEA,MAAO,CACL,mBACA,kBACF,CACF,CAUA,SAAS,EAAyB,EAAO,EAAa,EAAkB,EAAkB,CACxF,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAK,OAAS,OAAQ,CACxB,IAAI,EAAmB,KACvB,IAAK,IAAM,KAAe,EAAK,cAAgB,CAAC,EAC1C,EAAY,OAAS,cAAgB,EAAY,WAAa,kBAChE,EAAmB,EAAY,CAAW,GAI9C,IAAK,IAAM,KAAe,EAAK,cAAgB,CAAC,EAAG,CAKjD,GAAI,EAHF,EAAY,OAAS,eAC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