var e=require("node:fs"),t=require("node:path"),r=require("hastscript"),n=require("mdast-util-from-markdown"),i=require("mdast-util-to-hast");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=/*#__PURE__*/o(e),a=/*#__PURE__*/o(t);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t(((e,t,r)=>{t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);class c{constructor(e,t){l(this,"nodes",[]),l(this,"edges",[]),e&&(this.nodes=e),t&&(this.edges=t)}addNode(e){if(this.nodes.find(t=>t.id===e.id))throw new Error("A node with the same ID already exists in this.nodes");this.nodes.push(e)}addEdge(e){if(this.edges.find(t=>t.id===e.id))throw new Error("An edge with the same ID already exists in this.edges");this.edges.push(e)}getNode(e){return this.nodes.find(t=>t.id===e)}getEdge(e){return this.edges.find(t=>t.id===e)}getNodes(){return this.nodes}getEdges(){return this.edges}removeNode(e){this.nodes=this.nodes.filter(t=>t.id!==e),this.edges=this.edges.filter(t=>t.fromNode!==e&&t.toNode!==e)}removeEdge(e){this.edges=this.edges.filter(t=>t.id!==e)}toString(){return JSON.stringify({nodes:this.nodes,edges:this.edges})}static fromString(e){const t=JSON.parse(e);return new c(t.nodes,t.edges)}}const p=function(e){if(null==e)return v;if("function"==typeof e)return g(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let r=-1;for(;++r":"")+")"})}return a;function a(){let s,a,d,h=m;if(o(t,n,i[i.length-1]||void 0)&&(h=function(e){return Array.isArray(e)?e:"number"==typeof e?[!0,e]:null==e?m:[e]}(r(t,i)),h[0]===y))return h;if("children"in t&&t.children){const r=t;if(r.children&&"skip"!==h[0])for(a=0,d=i.concat(r);a>-1&&a