import{isAtRule as e,isRoot as t}from"../../utils/typeGuards.mjs";import{isString as r,isRegExp as s}from"../../utils/validateTypes.mjs";import i from"../../utils/isStandardSyntaxRule.mjs";import a from"../../utils/matchesStringOrRegExp.mjs";import l from"../../utils/report.mjs";import m from"../../utils/ruleMessages.mjs";import u from"../../utils/validateOptions.mjs";const n="rule-nesting-at-rule-required-list",o=m(n,{expected:(...e)=>`Expected rule to be nested in an at-rule matching pattern(s): ${e.map(e=>`"${e}"`).join(", ")}`}),p=m=>(p,f)=>{if(!u(f,n,{actual:m,possible:[r,s]}))return;const d=[m].flat();p.walkRules(r=>{i(r)&&(function(r,s){let i=r.parent;for(;i;){if(e(i)){const e=i.name;if(a(e,s))return!0}if(t(i))break;i=i.parent}return!1}(r,d)||l({message:o.expected,messageArgs:d,node:r,result:f,ruleName:n}))})};p.primaryOptionArray=!0,p.ruleName=n,p.messages=o,p.meta={url:"https://stylelint.io/user-guide/rules/rule-nesting-at-rule-required-list"};export{p as default};