import e from"../../../../../_virtual/index20.mjs";import t from"../../utils/findAtRuleContext.mjs";import s from"../../utils/flattenNestedSelectorsForRule.mjs";import o from"../../utils/getRuleSelector.mjs";import r from"../../utils/getStrippedSelectorSource.mjs";import{isBoolean as i}from"../../utils/validateTypes.mjs";import l from"../../utils/isKeyframeRule.mjs";import n from"../../utils/isStandardSyntaxRule.mjs";import u from"../../utils/nodeContextLookup.mjs";import m from"../../utils/normalizeSelector.mjs";import c from"../../utils/parseSelector.mjs";import a from"../../utils/report.mjs";import d from"../../utils/ruleMessages.mjs";import f from"../../utils/validateOptions.mjs";const p="no-duplicate-selectors",g=d(p,{rejected:(e,t)=>`Unexpected duplicate selector "${e}", first used at line ${t}`}),j=(d,j)=>(S,x)=>{if(!f(x,p,{actual:d},{actual:j,possible:{disallowInList:[i]},optional:!0}))return;const v=j&&j.disallowInList,h=u();function R(e,t,s,o,r){a({result:x,ruleName:p,node:e,message:g.rejected,messageArgs:[t,r],index:s,endIndex:o})}S.walkRules(i=>{if(l(i))return;if(!n(i))return;const u=h.getContext(i,t(i));v?function(e,t){s(e,x).forEach(s=>{const{selector:o,resolvedSelectors:i}=s;i.each(s=>{const i=m(s).toString(),l=t.get(i);if(!l)return void t.set(i,{line:(o.source?.start?.line??1)+(e.source?.start?.line??1)-1});const{index:n,endIndex:u,selector:c}=r(o);R(e,c,n,u,l.line)})})}(i,u):(function(e){const t=new Map,s=c(o(e),x,e);s?.each(s=>{const o=m(s.clone()).toString(),i=t.get(o);if(!i)return void t.set(o,{line:(s.source?.start?.line??1)+(e.source?.start?.line??1)-1});const{index:l,endIndex:n,selector:u}=r(s);R(e,u,l,n,i.line)})}(i),function(t,r){const i=s(t,x).flatMap(({resolvedSelectors:e})=>e.nodes);if(!i.length)return;const l=e.root({nodes:i,value:""}),n=m(l).toString(),u=r.get(n);if(!u)return void r.set(n,{line:t.source?.start?.line??1});const c=o(t).toString().trim();R(t,c,0,c.length,u.line)}(i,u))})};j.ruleName=p,j.messages=g,j.meta={url:"https://stylelint.io/user-guide/rules/no-duplicate-selectors"};export{j as default};