"use strict";var e=require("@csstools/css-calc"),o=require("@csstools/css-parser-algorithms"),s=require("@csstools/css-tokenizer");const n=["mod(","rem(","round("];function calc(t){const r=s.tokenizer({css:t}),c=[];for(;!r.endOfFile();)c.push(r.nextToken());c.push(r.nextToken());const i=o.parseCommaSeparatedListOfComponentValues(c,{});let a=!1;for(let e=0;e<i.length;e++){const s=i[e];for(let e=0;e<s.length;e++){const t=s[e];if(o.isFunctionNode(t)&&n.includes(t.getName().toLowerCase()+"(")){a=!0;break}(o.isSimpleBlockNode(t)||o.isFunctionNode(t))&&t.walk(((e,s)=>{if("number"!=typeof s)return;const t=e.node;return o.isFunctionNode(t)&&n.includes(t.getName().toLowerCase()+"(")?(a=!0,!1):void 0}))}}return a?e.calcFromComponentValues(i,{precision:5,toCanonicalUnits:!0}).map((e=>e.map((e=>s.stringify(...e.tokens()))).join(""))).join(","):t}const creator=e=>{const o=Object.assign({preserve:!1,onInvalid:""},e);return{postcssPlugin:"postcss-stepped-value-functions",Declaration(e){if(!n.some((o=>e.value.toLowerCase().includes(o))))return;const s=calc(e.value);s!==e.value&&(e.cloneBefore({value:s}),o.preserve||e.remove())}}};creator.postcss=!0,module.exports=creator;
