import t from"../../../../../_virtual/index19.mjs";import{declarationValueIndex as e}from"../../utils/nodeFieldIndices.mjs";import s from"../../utils/getDeclarationValue.mjs";import i from"../../utils/isStandardSyntaxColorFunction.mjs";import{isValueFunction as a}from"../../utils/typeGuards.mjs";import r from"../../utils/report.mjs";import l from"../../utils/ruleMessages.mjs";import o from"../../utils/setDeclarationValue.mjs";import n from"../../utils/validateOptions.mjs";const u="color-function-alias-notation",m=l(u,{expected:(t,e)=>`Expected "${t}" to be "${e}"`}),p=/\b(?:rgba|hsla)\(/i,c=/\b(?:rgb|hsl)\(/i,d=/^(?:rgba|hsla)$/i,f=/^(?:rgb|hsl)$/i,h=l=>(h,g)=>{if(!n(g,u,{actual:l,possible:["with-alpha","without-alpha"]}))return;const x="with-alpha"===l?c:p,b="with-alpha"===l?f:d;h.walkDecls(n=>{if(!x.test(n.value))return;const p=t(s(n));p.walk(t=>{if(!a(t)||!i(t))return;const{value:s,sourceIndex:c}=t;if(!b.test(s))return;const d="with-alpha"===l?`${s}a`:s.slice(0,-1),f=e(n)+c,h=f+s.length;r({message:m.expected,messageArgs:[s,d],node:n,index:f,endIndex:h,result:g,ruleName:u,fix:{apply:()=>{t.value=d,o(n,p.toString())},node:n}})})})};h.ruleName=u,h.messages=m,h.meta={url:"https://stylelint.io/user-guide/rules/color-function-alias-notation",fixable:!0};export{h as default};