import e from"postcss-value-parser";function hasFallback(e){const r=e.parent;if(!r)return!1;const o=e.prop.toLowerCase(),s=r.index(e);for(let e=0;e<s;e++){const s=r.nodes[e];if("decl"===s.type&&s.prop.toLowerCase()===o)return!0}return!1}const creator=r=>{const o=Object.assign({preserve:!1},r);return{postcssPlugin:"postcss-color-rebeccapurple",Declaration(r){if(!r.value.toLowerCase().includes("rebeccapurple"))return;if(hasFallback(r))return;const s=e(r.value);s.walk((e=>{"word"===e.type&&"rebeccapurple"===e.value.toLowerCase()&&(e.value="#639")}));const t=String(s);t!==r.value&&(r.cloneBefore({value:t}),o.preserve||r.remove())}}};creator.postcss=!0;export{creator as default};
