import{Ident as e,LeftParenthesis as i,EOF as t,Comma as o,Semicolon as n,LeftCurlyBracket as s,Function as r}from"../../tokenizer/types.mjs";import"../../tokenizer/char-code-definitions.mjs";import"../../tokenizer/TokenStream.mjs";const a="MediaQuery",d={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]};function c(){const a=this.tokenStart;let d=null,c=null,h=null;if(this.skipSC(),this.tokenType===e&&this.lookupTypeNonSC(1)!==i){const i=this.consume(e),r=i.toLowerCase();switch("not"===r||"only"===r?(this.skipSC(),d=r,c=this.consume(e)):c=i,this.lookupTypeNonSC(0)){case e:this.skipSC(),this.eatIdent("and"),h=this.Condition("media");break;case s:case n:case o:case t:break;default:this.error("Identifier or parenthesis is expected")}}else switch(this.tokenType){case e:case i:case r:h=this.Condition("media");break;case s:case n:case t:break;default:this.error("Identifier or parenthesis is expected")}return{type:"MediaQuery",loc:this.getLocation(a,this.tokenStart),modifier:d,mediaType:c,condition:h}}function h(i){i.mediaType?(i.modifier&&this.token(e,i.modifier),this.token(e,i.mediaType),i.condition&&(this.token(e,"and"),this.node(i.condition))):i.condition&&this.node(i.condition)}export{h as generate,a as name,c as parse,d as structure};