import a from"@markdoc/markdoc";import{isPrimitive as m}from"../../../utils/guards/is-primitive.js";import{isStringNode as o}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"},align:{type:String,matches:["left","center","right"]},width:{type:String}},transform(e,s){const r=e.transformAttributes(s);let t=e.transformChildren(s);const n=r["data-language"],l=r["data-title"];switch(e.attributes.process===!1&&(t=[e.attributes.content]),n){case"mermaid":case"excalidraw":case"plantuml":return o(t[0])?new a.Tag("Diagram",{...r,diagramType:n,diagramSource:t[0]},t):new a.Tag(e.tag,r,t);default:const c=t.map(i=>m(i)?i.toString():u(i)?i?.attributes?.rawtag:"").join("");return o(t[0])?new a.Tag("CodeBlock",{...r,header:{title:l,controls:{copy:{}}},source:c,lang:n},[]):new a.Tag(e.tag,r,t)}}};export{w as fence};
