import e from"../../../../../_virtual/index19.mjs";import{declarationValueIndex as t,atRuleParamIndex as s}from"../../utils/nodeFieldIndices.mjs";import{isRegExp as r,isString as o}from"../../utils/validateTypes.mjs";import{atRuleRegexes as i}from"../../utils/regexes.mjs";import m from"../../utils/isCustomProperty.mjs";import a from"../../utils/isStandardSyntaxProperty.mjs";import l from"../../utils/isVarFunction.mjs";import p from"../../utils/report.mjs";import u from"../../utils/ruleMessages.mjs";import n from"../../utils/validateOptions.mjs";const c="custom-property-pattern",d=u(c,{expected:(e,t)=>`Expected "${e}" to match pattern "${t}"`}),f=/var\(/i,x=u=>(x,j)=>{if(!n(j,c,{actual:u,possible:[r,o]}))return;const g=o(u)?new RegExp(u):u;function y(e){return!m(e)||!a(e)||g.test(e.slice(2))}function v(e,t,s){p({result:j,ruleName:c,message:d.expected,messageArgs:[t,u],node:s,index:e,endIndex:e+t.length})}x.walkDecls(s=>{const{prop:r,value:o}=s;if(f.test(o)){e(o).walk(e=>{if(!l(e))return;const{nodes:r}=e,o=r[0];o&&!y(o.value)&&v(t(s)+o.sourceIndex,o.value,s)})}y(r)||v(0,r,s)}),x.walkAtRules(i.propertyName,e=>{const{params:t}=e;y(t)||v(s(e),t,e)})};x.ruleName=c,x.messages=d,x.meta={url:"https://stylelint.io/user-guide/rules/custom-property-pattern"};export{x as default};