import a from"@markdoc/markdoc";import{isPrimitive as m}from"../../../../../../utils/guards/is-primitive.js";import{isStringNode as s}from"../../helpers/guards/is-string-node.js";import{isTag as u}from"../../helpers/guards/is-tag.js";const g=a.nodes.fence,w={...g,attributes:{...g.attributes,label:{type:String,render:"data-label"},title:{type:String,render:"data-title"},highlight:{type:String,render:"data-highlight"}},transform(r,i){const e=r.transformAttributes(i);let t=r.transformChildren(i);const o=e["data-language"],l=e["data-title"];switch(r.attributes.process===!1&&(t=[r.attributes.content]),o){case"mermaid":return s(t[0])?new a.Tag("Mermaid",{...e,diagramSource:t[0]},t):new a.Tag(r.tag,e,t);default:const c=t.map(n=>m(n)?n.toString():u(n)?n?.attributes?.rawtag:"").join("");return s(t[0])?new a.Tag("CodeBlock",{...e,header:{title:l,controls:{copy:{}}},source:c,lang:o},[]):new a.Tag(r.tag,e,t)}}};export{w as fence};
