import{isMediaQueryInvalid as e,isMediaFeature as r,isMediaFeatureValue as t}from"../../../../@csstools/media-query-list-parser/dist/index.mjs";import{sourceIndices as s}from"../../../../@csstools/css-parser-algorithms/dist/index.mjs";import{isRegExp as i,isString as a}from"../../utils/validateTypes.mjs";import{atRuleParamIndex as m}from"../../utils/nodeFieldIndices.mjs";import{atRuleRegexes as o}from"../../utils/regexes.mjs";import u from"../../utils/matchesStringOrRegExp.mjs";import l from"../../utils/optionsMatches.mjs";import d from"../../utils/parseMediaQuery.mjs";import n from"../../utils/report.mjs";import f from"../../utils/ruleMessages.mjs";import p from"../../utils/validateObjectWithArrayProps.mjs";import j from"../../utils/validateOptions.mjs";import c from"../../utils/vendor.mjs";const g="media-feature-name-value-allowed-list",x=f(g,{rejected:(e,r)=>`Unexpected value "${r}" for name "${e}"`}),N=f=>(N,v)=>{j(v,g,{actual:f,possible:[p(a,i)]})&&N.walkAtRules(o.mediaName,i=>{d(i).forEach(a=>{if(e(a))return;a.walk(({node:e,state:a})=>{if(!a)return;if(r(e))return a.mediaFeatureName=e.getName(),void(a.unprefixedMediaFeatureName=c.unprefixed(e.getName()));if(!t(e))return;const{mediaFeatureName:o,unprefixedMediaFeatureName:d}=a;if(!o||!d)return;const p=[e.value].flat(),j=p.map(e=>e.toString()).join(""),N=Object.keys(f).find(e=>u(d,e));if(null==N)return;if(l(f,N,j))return;const F=m(i),[h,y]=s(p);n({index:F+h,endIndex:F+y+1,message:x.rejected,messageArgs:[o,j],node:i,ruleName:g,result:v})},{mediaFeatureName:"",unprefixedMediaFeatureName:""})})})};N.ruleName=g,N.messages=x,N.meta={url:"https://stylelint.io/user-guide/rules/media-feature-name-value-allowed-list"};export{N as default};