import e from"../../../../../_virtual/index20.mjs";import t from"../../../../../_virtual/index23.mjs";import{isString as s,isRegExp as r}from"../../utils/validateTypes.mjs";import i from"../../utils/getRuleSelector.mjs";import{htmlTypeSelectors as o}from"../../reference/selectors.mjs";import n from"../../utils/isCustomElement.mjs";import a from"../../utils/isKeyframeSelector.mjs";import m from"../../utils/isStandardSyntaxRule.mjs";import l from"../../utils/isStandardSyntaxTypeSelector.mjs";import u from"../../utils/mathMLTags.mjs";import p from"../../utils/optionsMatches.mjs";import c from"../../utils/parseSelector.mjs";import f from"../../utils/report.mjs";import d from"../../utils/ruleMessages.mjs";import g from"../../utils/validateOptions.mjs";const h="selector-type-no-unknown",j=d(h,{rejected:e=>`Unexpected unknown type selector "${e}"`}),v=/(?:[^.#[:a-z-]|^)[a-z]/i,w=new Set(["::highlight","::view-transition-group","::view-transition-image-pair","::view-transition-new","::view-transition-old"]),y=new Set([":active-view-transition-type",":dir",":-moz-locale-dir",":state",":lang"]),S=(d,S)=>(x,T)=>{g(T,h,{actual:d},{actual:S,possible:{ignore:["custom-elements","default-namespace"],ignoreNamespaces:[s,r],ignoreTypes:[s,r]},optional:!0})&&x.walkRules(s=>{v.test(s.selector)&&m(s)&&(s.selectors.some(a)||c(i(s),T,s)?.walkTags(r=>{if(!l(r))return;if(p(S,"ignore","custom-elements")&&n(r.value))return;if(p(S,"ignore","default-namespace")&&"string"!=typeof r.namespace)return;if(p(S,"ignoreNamespaces",r.namespace))return;if(p(S,"ignoreTypes",r.value))return;if(function(t){const s=t.parent?.parent;return e.isPseudoElement(s)&&w.has(s.value)}(r)||function(t){const s=t.parent?.parent;return e.isPseudoClass(s)&&y.has(s.value)}(r))return;const i=r.value,a=i.toLowerCase(),m=[...t,"hatch","hatchpath","hatchPath"];if(o.has(a)||m.includes(i)||u.includes(a))return;const c=r.sourceIndex,d=c+i.length;f({message:j.rejected,messageArgs:[i],node:s,index:c,endIndex:d,ruleName:h,result:T})}))})};S.ruleName=h,S.messages=j,S.meta={url:"https://stylelint.io/user-guide/rules/selector-type-no-unknown"};export{S as default};