function i(o){return t=>t.type===o}var n={parent(o){return Array.isArray(o.children)},literal(o){return typeof o.value=="string"},tag(o){return o.type==="element"||o.type==="custom-element"||o.type==="component"||o.type==="fragment"},whitespace(o){return o.type==="text"&&o.value.trim().length===0},root:i("root"),element:i("element"),customElement:i("custom-element"),component:i("component"),fragment:i("fragment"),expression:i("expression"),text:i("text"),doctype:i("doctype"),comment:i("comment"),frontmatter:i("frontmatter")},l=class{constructor(t){this.callback=t}async visit(t,e,s){if(await this.callback(t,e,s),n.parent(t)){let r=[];for(let a=0;as(a)):n.frontmatter(r)?e+=`---${r.value}--- `:n.comment(r)?e+=``:n.expression(r)?(e+="{",r.children.forEach(a=>s(a)),e+="}"):n.literal(r)?e+=r.value:n.tag(r)&&(e+=`<${r.name}`,e+=c(r),r.children.length==0&&t.selfClose?e+=" />":(e+=">",r.children.forEach(a=>s(a)),e+=``))}return s(o),e}export{n as is,u as serialize,N as walk};