import{Function as t,Url as s,String as i,Ident as e,LeftParenthesis as r,RightParenthesis as h}from"../../tokenizer/types.mjs";import"../../tokenizer/char-code-definitions.mjs";import"../../tokenizer/TokenStream.mjs";function n(t,s){return this.parseWithFallback(()=>{try{return t.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==h&&this.error()}},s||(()=>this.Raw(null,!0)))}const o={layer(){this.skipSC();const t=this.createList(),s=n.call(this,this.Layer);return"Raw"===s.type&&""===s.value||t.push(s),t},supports(){this.skipSC();const t=this.createList(),s=n.call(this,this.Declaration,()=>n.call(this,()=>this.Condition("supports")));return"Raw"===s.type&&""===s.value||t.push(s),t}},p={parse:{prelude(){const h=this.createList();switch(this.tokenType){case i:h.push(this.String());break;case s:case t:h.push(this.Url());break;default:this.error("String or url() is expected")}return this.skipSC(),this.tokenType===e&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer")?h.push(this.Identifier()):this.tokenType===t&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer(")&&h.push(this.Function(null,o)),this.skipSC(),this.tokenType===t&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&h.push(this.Function(null,o)),this.lookupNonWSType(0)!==e&&this.lookupNonWSType(0)!==r||h.push(this.MediaQueryList()),h},block:null}};export{p as default};