import e from"../../../../../_virtual/index20.mjs";import t from"../../utils/flattenNestedSelectorsForRule.mjs";import s from"../../utils/getStrippedSelectorSource.mjs";import r from"../../utils/isKeyframeRule.mjs";import i from"../../utils/isStandardSyntaxRule.mjs";import o from"../../utils/isStandardSyntaxTypeSelector.mjs";import l from"../../utils/optionsMatches.mjs";import n from"../../utils/report.mjs";import a from"../../utils/ruleMessages.mjs";import u from"../../utils/validateOptions.mjs";const m="selector-no-qualifying-type",c=a(m,{rejected:e=>`Unexpected qualifying type selector "${e}"`}),p=/[#.[]/;const d=(a,d)=>(f,g)=>{if(!u(g,m,{actual:a,possible:[!0]},{actual:d,possible:{ignore:["attribute","class","id"]},optional:!0}))return;const y=l(d,"ignore","id"),j=l(d,"ignore","class"),x=l(d,"ignore","attribute");f.walkRules(l=>{function a(t,r,i){t.walkTags(t=>{if(!o(t))return;const a=t.parent;if(a&&1===a.nodes.length)return;const u=function(t){const s=[];let r=t;for(;(r=r.next())&&!e.isCombinator(r)&&!e.isPseudoElement(r);)s.push(r);for(;(r=s.at(-1))&&!(e.isIdentifier(r)||e.isClassName(r)||e.isAttribute(r));)s.splice(-1,1);return s}(t);for(const e of u)if("id"===e.type&&!y||"class"===e.type&&!j||"attribute"===e.type&&!x){let e=0,o=0;const a=[t,...u].join("").trim();i?({index:e,endIndex:o}=s(r)):(e=t.sourceIndex??0,o=e+a.length),n({ruleName:m,result:g,node:l,message:c.rejected,messageArgs:[a],index:e,endIndex:o});break}})}i(l)&&(r(l)||p.test(l.selector)&&t(l,g).forEach(({selector:e,resolvedSelectors:t,nested:s})=>{a(t,e,s)}))})};d.ruleName=m,d.messages=c,d.meta={url:"https://stylelint.io/user-guide/rules/selector-no-qualifying-type"};export{d as default};