"use strict";var e=require("@csstools/css-calc"),s=require("@csstools/css-parser-algorithms"),o=require("@csstools/css-tokenizer");const n=["asin(","acos(","atan(","atan2(","sin(","cos(","tan("];function calc(t){const r=o.tokenizer({css:t}),c=[];for(;!r.endOfFile();)c.push(r.nextToken());c.push(r.nextToken());const i=s.parseCommaSeparatedListOfComponentValues(c,{});let a=!1;for(let e=0;e<i.length;e++){const o=i[e];for(let e=0;e<o.length;e++){const t=o[e];if(s.isFunctionNode(t)&&n.includes(t.getName().toLowerCase()+"(")){a=!0;break}(s.isSimpleBlockNode(t)||s.isFunctionNode(t))&&t.walk(((e,o)=>{if("number"!=typeof o)return;const t=e.node;return s.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=>o.stringify(...e.tokens()))).join(""))).join(","):t}const creator=e=>{const s=Object.assign({preserve:!1},e);return{postcssPlugin:"postcss-trigonometric-functions",Declaration(e){if(!n.some((s=>e.value.toLowerCase().includes(s))))return;const o=calc(e.value);o!==e.value&&(e.cloneBefore({value:o}),s.preserve||e.remove())}}};creator.postcss=!0,module.exports=creator;
