import{isRegExp as e,isString as t}from"../../utils/validateTypes.mjs";import{atRuleParamIndex as s}from"../../utils/nodeFieldIndices.mjs";import r from"../../utils/report.mjs";import a from"../../utils/ruleMessages.mjs";import m from"../../utils/validateOptions.mjs";const o="custom-media-pattern",i=a(o,{expected:(e,t)=>`Expected "${e}" to match pattern "${t}"`}),l=a=>(l,n)=>{if(!m(n,o,{actual:a,possible:[e,t]}))return;const u=t(a)?new RegExp(a):a;l.walkAtRules(e=>{if("custom-media"!==e.name.toLowerCase())return;const[t,m]=e.params.match(/^--(\S+)\b/)||[];if(void 0===t||void 0===m)throw new Error(`Unexpected at-rule params: "${e.params}"`);if(u.test(m))return;const l=s(e);r({message:i.expected,messageArgs:[t,a],node:e,index:l,endIndex:l+t.length,result:n,ruleName:o})})};l.ruleName=o,l.messages=i,l.meta={url:"https://stylelint.io/user-guide/rules/custom-media-pattern"};export{l as default};