import{levelOneAndTwoPseudoElements as e,atRulePagePseudoClasses as s,pseudoElements as t,pseudoClasses as r,webkitScrollbarPseudoElements as o,webkitScrollbarPseudoClasses as i}from"../../reference/selectors.mjs";import{isString as l,isRegExp as u}from"../../utils/validateTypes.mjs";import{atRuleParamIndex as a}from"../../utils/nodeFieldIndices.mjs";import m from"../../utils/getAtRuleParams.mjs";import n from"../../utils/getRuleSelector.mjs";import{isAtRule as p}from"../../utils/typeGuards.mjs";import f from"../../utils/isCustomSelector.mjs";import c from"../../utils/isStandardSyntaxAtRule.mjs";import d from"../../utils/isStandardSyntaxRule.mjs";import j from"../../utils/isStandardSyntaxSelector.mjs";import g from"../../utils/optionsMatches.mjs";import h from"../../utils/parseSelector.mjs";import x from"../../utils/report.mjs";import S from"../../utils/ruleMessages.mjs";import v from"../../utils/validateOptions.mjs";import w from"../../utils/vendor.mjs";const y="selector-pseudo-class-no-unknown",k=S(y,{rejected:e=>`Unexpected unknown pseudo-class selector "${e}"`}),C=(S,C)=>(I,P)=>{v(P,y,{actual:S},{actual:C,possible:{ignorePseudoClasses:[l,u]},optional:!0})&&I.walk(l=>{let u=null;if("rule"===l.type){if(!d(l))return;u=n(l)}else if(p(l)&&"page"===l.name&&l.params){if(!c(l))return;u=m(l)}u&&u.includes(":")&&function(l,u){h(l,P,u)?.walkPseudos(l=>{const m=l.value;if(!j(m))return;if(f(m))return;if(m.startsWith("::"))return;const n=m.replace(/^:*/,"").toLowerCase();if(e.has(n))return;if(g(C,"ignorePseudoClasses",l.value.slice(1)))return;const c=w.prefix(n);let d=null;if(p(u)&&"page"===u.name){if(s.has(n))return;d=a(u)+l.sourceIndex}else if(t.has(n)&&!c)d=l.sourceIndex;else{if(c||r.has(n))return;let e=l;do{if(e=e.prev(),e&&"::"===e.value.slice(0,2))break}while(e);if(e){const s=e.value.toLowerCase().slice(2);if(o.has(s)&&i.has(n))return}d=l.sourceIndex}const h=d+l.value.length;x({message:k.rejected,messageArgs:[m],node:u,index:d,endIndex:h,ruleName:y,result:P})})}(u,l)})};C.ruleName=y,C.messages=k,C.meta={url:"https://stylelint.io/user-guide/rules/selector-pseudo-class-no-unknown"};export{C as default};