import e from"../../../../../_virtual/index20.mjs";import{isString as t,isRegExp as s}from"../../utils/validateTypes.mjs";import r from"../../utils/flattenNestedSelectorsForRule.mjs";import o from"../../utils/getStrippedSelectorSource.mjs";import i from"../../utils/isContextFunctionalPseudoClass.mjs";import l from"../../utils/isNonNegativeInteger.mjs";import m from"../../utils/isStandardSyntaxRule.mjs";import a from"../../utils/optionsMatches.mjs";import u from"../../utils/report.mjs";import n from"../../utils/ruleMessages.mjs";import p from"../../utils/validateOptions.mjs";const{isRoot:c,isSelector:d}=e,f="selector-max-attribute",x=n(f,{expected:(e,t)=>`Expected "${e}" to have no more than ${t} attribute ${1===t?"selector":"selectors"}`}),g=(e,n)=>(g,j)=>{p(j,f,{actual:e,possible:l},{actual:n,possible:{ignoreAttributes:[t,s]},optional:!0})&&g.walkRules(t=>{m(t)&&r(t,j).forEach(({selector:s,resolvedSelectors:r})=>{r.walk(r=>{d(r)&&(c(r.parent)||i(r.parent))&&function(t,s,r){if(t.reduce((e,t)=>"attribute"!==t.type||a(n,"ignoreAttributes",t.attribute)?e:e+=1,0)>e){const{index:t,endIndex:i,selector:l}=o(s);u({ruleName:f,result:j,node:r,message:x.expected,messageArgs:[l,e],index:t,endIndex:i})}}(r,s,t)})})})};g.ruleName=f,g.messages=x,g.meta={url:"https://stylelint.io/user-guide/rules/selector-max-attribute"};export{g as default};