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ACtB,MAAO,EAAY,MAAM,QAEjC,IAEG,UAMJ,MAAM,aAAe,IACxB,MAAM,EAAkB,IAAI,IAAI,IAC1B,EAAc,gBAAgB,EAAK,OAQzC,OANA,EAAY,SAAQ,IAChB,EAAY,SAAS,SAAQ,IACzB,EAAgB,IAAI,EAAQ,GAC9B,IAGC,CACH,MAAO,EAAK,QAAU,IAAI,OAC1B,SAAU,MAAM,KAAK,GACrB,MAAO,EACV,EAIL,MAAM,aAAe,CAAC,EAAU,CAAC,EAAG,EAAQ,IAAI,OAAU,CACtD,cAAe,SACf,KAAM,CAAC,EAAM,KACT,IAAK,EAAK,OAAS,IAAK,SAAQ,IAE5B,GAAkB,WAAd,EAAK,MAAmC,UAAd,EAAK,KAAkB,CACjD,MAAM,EAAW,IAAI,EAAQ,KAAK,CAAC,SAAU,UAC7C,WAAW,GAAM,SAAQ,IACrB,EAAM,IAAI,EAAK,IAAK,GACpB,EAAS,OAAO,CACZ,KAAM,EAAK,IACX,MAAO,EAAK,OACd,IAGF,EAAS,MAAM,OAAS,GACxB,EAAK,MAAM,OAAO,GAEtB,EAAK,QACT,MAEK,GAAkB,WAAd,EAAK,MAAmC,YAAd,EAAK,KAAoB,CACxD,MAAM,EAAU,aAAa,GACvB,EAAc,MAAM,KAAK,EAAM,UACrC,eAAe,EAAS,EAAa,EAAS,GAAS,SAAQ,IAC3D,EAAK,OAAO,EAAY,IAE5B,EAAK,QACT,IACF,IAKV,aAAa,SAAU,iBAGR","file":"/npm/lowcss@0.32.0/plugin.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/lowcss@0.32.0/plugin.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// @description map pseudo-variants to pseudo selector\nconst pseudos = {\n    \"active\": \"active\",\n    \"focus\": \"focus\",\n    \"focus-within\": \"focus-within\",\n    \"hover\": \"hover\",\n    \"visited\": \"visited\",\n    \"checked\": \"checked\",\n    \"disabled\": \"disabled\",\n    \"required\": \"required\",\n    \"first\": \"first-child\",\n    \"last\": \"last-child\",\n    \"odd\": \"nth-child(odd)\",\n    \"even\": \"nth-child(even)\",\n    \"group-hover\": \"hover\",\n    \"group-focus\": \"focus\",\n    \"group-focus-within\": \"focus-within\",\n    \"peer-hover\": \"hover\",\n    \"peer-focus\": \"focus\",\n    \"peer-focus-within\": \"focus-within\",\n};\n\n// @description default variant order\nconst variantOrder = [\n    \"default\",\n    \"responsive\",\n    \"print\",\n    \"first\",\n    \"last\",\n    \"odd\",\n    \"even\",\n    \"visited\",\n    \"required\",\n    \"group-hover\",\n    \"group-focus\",\n    \"group-focus-within\",\n    \"peer-hover\",\n    \"peer-focus\",\n    \"peer-focus-within\",\n    \"hover\",\n    \"focus\",\n    \"focus-within\",\n    \"checked\",\n    \"active\",\n    \"disabled\",\n];\n\n// @description converts a simple glob pattern into a regex\n// @example globToRegex(\"bg-*\") => /^bg-(.*?)$/\nconst globToRegex = (glob = \"\") => {\n    const escaped = glob.replace(/[-[\\]{}()+?.,\\\\^$|#\\s]/g, \"\\\\$&\");\n    return new RegExp(`^${escaped.replace(/\\*/g, \"(.*?)\")}$`);\n};\n\n// @description get the selector for the specified variant\n// @param {string} variant - variant to get the selector for\n// @return {string} selector - selector to replace\nexport const getSelector = (variant = \"\", selector = \"&\") => {\n    // 0. default variant or variant not defined\n    if (variant === \"default\" || !variant) {\n        return `.${selector}`;\n    }\n    const variantSelector = pseudos[variant] || variant;\n    // 1. check if the variant is a group variant\n    if (variant.startsWith(\"group-\")) {\n        return `.group:${variantSelector.replace(\"group-\", \"\")} .${variant}\\\\:${selector}`;\n    }\n    // 2. check if the variant is a peer variant\n    else if (variant.startsWith(\"peer-\")) {\n        return `.peer:${variantSelector.replace(\"peer-\", \"\")}~.${variant}\\\\:${selector}`;\n    }\n    // 3. otherwise, return it as a simple variant (hover, focus, etc.)\n    return `.${variant}\\\\:${selector}:${variantSelector}`;\n};\n\n// @description get the rules associated with a utility node\n// @param {Array} nodes - nodes to parse\n// @return {Array} rules - parsed utility rules\nconst getUtilityRules = (nodes, rules = [], nestedVariant = false) => {\n    nodes.forEach(node => {\n        // 1. @variant node --> parse the variants and recursively get the utility rules\n        if (node.type === \"atrule\" && node.name === \"variant\") {\n            if (nestedVariant) {\n                throw new Error(\"Nested '@variant' rules are not supported.\");\n            }\n            const variants = (node.params || \"default\").trim()\n                .split(\",\")\n                .map(variant => variant.trim())\n                .filter(variant => !!variant);\n            getUtilityRules(node.nodes, [], true).forEach(rule => {\n                return rules.push({\n                    ...rule,\n                    variants: Array.from(new Set(variants)),\n                });\n            });\n        }\n        // 2. basic utility rule node --> parse the selector and properties\n        else if (node.type === \"rule\" && !!node.selector && node.nodes.length > 0) {\n            // 2.1. get declarations defined on this rule\n            const declarations = node.nodes.filter(item => item.type === \"decl\");\n            if (declarations.length > 0) {\n                rules.push({\n                    selector: node.selector.trim(),\n                    variants: [\"default\"],\n                    properties: declarations.map(item => ({\n                        prop: item.prop.trim(),\n                        value: item.value.trim(),\n                    })),\n                });\n            }\n            // 2.2. nested rules? convert them into a flat list of rules\n            const nestedRules = node.nodes.filter(item => item.type === \"rule\" || item.type === \"atrule\");\n            getUtilityRules(nestedRules, [], nestedVariant).forEach(nestedRule => {\n                rules.push({\n                    ...nestedRule,\n                    selector: nestedRule.selector.replace(/&/g, node.selector.trim()),\n                });\n            });\n        }\n    });\n    return rules;\n};\n\n// @description compile a utility rule into postcss rules\n// @param {string} selector - selector to compile\n// @param {Array} properties - properties to compile\n// @param {object} ctx - context for the utility rule\n// @param {Array} theme - theme object to use for compilation\n// @param {object} postcss - postcss instance to use for compilation\nconst compile = (selector, properties, ctx, theme, postcss) => {\n    const rule = new postcss.Rule({selector: selector});\n    properties.forEach(property => {\n        rule.append({\n            prop: property.prop,\n            value: property.value.replaceAll(ctx.replace, ctx.value).replace(/value\\((.*?)\\)/g, (match, p1) => {\n                const themeItem = theme.find(themeItem => themeItem.key === p1);\n                return themeItem ? `var(${p1})` : match;\n            }),\n        });\n    });\n    return rule;\n};\n\n// @description get the context for a utility rule\n// @param {object} rule - utility rule to get the context for\n// @param {Array} theme - theme object to use for context\nconst getUtilityContext = (rule, theme) => {\n    const context = new Map();\n    // 1. if the rule selector includes an '*', we have a dynamic utility rule\n    if (rule.selector.includes(\"*\")) {\n        rule.properties.forEach(property => {\n            if (property.value.includes(\"value(--\")) {\n                const pattern = property.value.match(/value\\((.*?)\\)/)[1];\n                const patternRegex = globToRegex(pattern);\n                theme.forEach(item => {\n                    if (patternRegex.test(item.key) && !context.has(item.key)) {\n                        context.set(item.key, {\n                            key: item.key.match(patternRegex)[1],\n                            value: `var(${item.key})`,\n                            replace: `value(${pattern})`,\n                        });\n                    }\n                });\n            }\n        });\n    }\n    // 2. insert a single item to make sure that the utility is generated once\n    else {\n        context.set(\"default\", {key: \"\", value: \"\", replace: \"\"});\n    }\n    // 3. return the context as a simple array\n    return Array.from(context.values());\n};\n\n// @description get breakpoints in provided theme object\nconst getBreakpoints = (theme, breakpoints = {}) => {\n    const breakpointRegex = globToRegex(\"--breakpoint-*\");\n    theme.forEach(item => {\n        const match = item.key.match(breakpointRegex);\n        if (match) {\n            breakpoints[match[1]] = item.value;\n        }\n    });\n    return breakpoints;\n};\n\n// @description compile utility into postcss rules\n// @param {object} utility - utility object to compile\n// @param {object} theme - theme object to use for compilation\n// @param {object} postcss - postcss instance to use for compilation\nexport const compileUtility = (utility, theme = {}, postcss, options = {}) => {\n    const breakpoints = getBreakpoints(theme);\n    const variants = (options.variantOrder || variantOrder).filter(variant => {\n        return utility.variants.includes(variant);\n    });\n    return variants.map(variant => {\n        const utilityVariants = new Set(utility.variants);\n        return utility.rules.map(rule => {\n            if (!utilityVariants.has(variant)) {\n                return [];\n            }\n            return getUtilityContext(rule, theme).map(ctx => {\n                const selector = rule.selector.replace(\"*\", ctx.key);\n                // responsive variant\n                if (variant === \"responsive\") {\n                    return Object.keys(breakpoints).map(key => {\n                        const mediaRule = new postcss.AtRule({\n                            name: \"media\",\n                            params: `screen and (min-width: ${breakpoints[key]})`,\n                        });\n                        mediaRule.append(compile(`.${key}\\\\:${selector}`, rule.properties, ctx, theme, postcss));\n                        return mediaRule;\n                    });\n                }\n                // print variant\n                if (variant === \"print\") {\n                    const printRule = new postcss.AtRule({\n                        name: \"media\",\n                        params: \"print\",\n                    });\n                    printRule.append(compile(`.print\\\\:${selector}`, rule.properties, ctx, theme, postcss));\n                    return printRule;\n                }\n                // pseudo variant or default variant\n                return compile(getSelector(variant, selector), rule.properties, ctx, theme, postcss);\n            }).flat();\n        }).flat();\n    }).flat();\n};\n\n// @description parse theme rule\n// @param {object} rule - theme rule\n// @return {Array} theme - parsed theme variables\nexport const parseTheme = (rule, theme = []) => {\n    (rule.nodes || []).forEach(declaration => {\n        if (declaration.type === \"decl\" && declaration.prop.startsWith(\"--\")) {\n            theme.push({\n                type: \"global\",\n                key: declaration.prop.trim(),\n                value: declaration.value.trim(),\n            });\n        }\n    });\n    return theme;\n};\n\n// @description parse utility rule\n// @param {object} rule - utility rule\n// @return {object} parsed utility rule\nexport const parseUtility = rule => {\n    const utilityVariants = new Set([]);\n    const utiltyRules = getUtilityRules(rule.nodes);\n    // fill utility variants set with variants defined in rules\n    utiltyRules.forEach(utilityRule => {\n        utilityRule.variants.forEach(variant => {\n            utilityVariants.add(variant);\n        });\n    });\n    // return the parsed utility rule\n    return {\n        name: (rule.params || \"\").trim(),\n        variants: Array.from(utilityVariants),\n        rules: utiltyRules,\n    };\n};\n\n// @description plugin to generate lowcss styles\nconst lowCssPlugin = (options = {}, theme = new Map()) => ({\n    postcssPlugin: \"lowcss\",\n    Once: (root, postcss) => {\n        [...(root.nodes || [])].forEach(rule => {\n            // 1. check if the rule is a theme rule to extract the variables\n            if (rule.type === \"atrule\" && rule.name === \"theme\") {\n                const rootRule = new postcss.Rule({selector: \":root\"});\n                parseTheme(rule).forEach(item => {\n                    theme.set(item.key, item);\n                    rootRule.append({\n                        prop: item.key,\n                        value: item.value,\n                    });\n                });\n                // add the root rule to the root\n                if (rootRule.nodes.length > 0) {\n                    root.first.before(rootRule);\n                }\n                rule.remove();\n            }\n            // 2. check if the rule is an utility rule to generate the utility classes\n            else if (rule.type === \"atrule\" && rule.name === \"utility\") {\n                const utility = parseUtility(rule);\n                const themeValues = Array.from(theme.values());\n                compileUtility(utility, themeValues, postcss, options).forEach(utilityRule => {\n                    rule.before(utilityRule);\n                });\n                rule.remove();\n            }\n        });\n    },\n});\n\n// mark the plugin as a postcss plugin\nlowCssPlugin.postcss = true;\n\n// export the plugin\nexport default lowCssPlugin;\n"]}