import e from"../../../../../_virtual/index22.mjs";import{isBoolean as t,isRegExp as s,isString as r}from"../../utils/validateTypes.mjs";import o from"../../utils/getRuleSelector.mjs";import i from"../../utils/isKeyframeSelector.mjs";import l from"../../utils/isStandardSyntaxRule.mjs";import n from"../../utils/isStandardSyntaxSelector.mjs";import a from"../../utils/parseSelector.mjs";import m from"../../utils/report.mjs";import u from"../../utils/ruleMessages.mjs";import c from"../../utils/validateOptions.mjs";const f="selector-class-pattern",p=u(f,{expected:(e,t)=>`Expected "${e}" to match pattern "${t}"`}),d=(u,d)=>(S,g)=>{if(!c(g,f,{actual:u,possible:[s,r]},{actual:d,possible:{resolveNestedSelectors:[t]},optional:!0}))return;const j=Boolean(d&&d.resolveNestedSelectors),v=r(u)?new RegExp(u):u;function y(e,t){e.walkClasses(e=>{const{value:s,sourceIndex:r}=e;if(v.test(s))return;const o=String(e).trim(),i=r+o.length;m({result:g,ruleName:f,message:p.expected,messageArgs:[o,u],node:t,index:r,endIndex:i})})}S.walkRules(t=>{if(l(t)&&!t.selectors.some(i))if(j&&function(e){for(const[t,s]of Array.from(e).entries()){if("&"!==s)continue;const r=e.charAt(t-1);if(r&&!x(r))return!0;const o=e.charAt(t+1);if(o&&!x(o))return!0}return!1}(t.selector))for(const s of e(o(t),t)){if(!n(s))continue;const e=a(s,g,t);e&&y(e,t)}else{const e=a(o(t),g,t);e&&y(e,t)}})};function x(e){return/[\s+>~]/.test(e)}d.ruleName=f,d.messages=p,d.meta={url:"https://stylelint.io/user-guide/rules/selector-class-pattern"};export{d as default};