import{isBoolean as e,isRegExp as t,isString as s}from"../../utils/validateTypes.mjs";import r from"../../utils/getRuleSelector.mjs";import l from"../../utils/getStrippedSelectorSource.mjs";import o from"../../utils/isStandardSyntaxRule.mjs";import i from"../../utils/parseSelector.mjs";import m from"../../utils/report.mjs";import p from"../../utils/ruleMessages.mjs";import a from"../../utils/validateOptions.mjs";const n="selector-nested-pattern",u=p(n,{expected:(e,t)=>`Expected "${e}" to match pattern "${t}"`}),c=(p,c)=>(d,f)=>{if(!a(f,n,{actual:p,possible:[t,s]},{actual:c,possible:{splitList:[e]},optional:!0}))return;const g=s(p)?new RegExp(p):p,x=c&&c.splitList;function j(e,t,s,r){g.test(t)||m({result:f,ruleName:n,message:u.expected,messageArgs:[t,p],node:e,index:s,endIndex:r})}d.walkRules(e=>{if(e.parent&&"rule"!==e.parent.type)return;if(!o(e))return;const t=r(e);x?i(t,f,e)?.each(t=>{const{index:s,endIndex:r,selector:o}=l(t);j(e,o,s,r)}):j(e,t,0,t.length)})};c.ruleName=n,c.messages=u,c.meta={url:"https://stylelint.io/user-guide/rules/selector-nested-pattern"};export{c as default};