/**
 * Viz.js 3.5.0 (Graphviz 2.47.3, Expat 2.4.1, Emscripten 2.0.25)
 * @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT licensed
 *
 * This distribution contains other software in object code form:
 * - [Emscripten](https://github.com/emscripten-core/emscripten/blob/master/LICENSE)
 * - [Expat](https://github.com/libexpat/libexpat/blob/master/expat/COPYING)
 * - [Graphviz](https://graphviz.org/license/)
 */
class e{_worker;_isNodeWorker;_listeners=[];_nextId=0;_executing=0;constructor(e){this._worker=e;this._isNodeWorker="function"===typeof e.ref;if(this._isNodeWorker){this._worker.on("message",(e=>this._eventListener({data:e})));this._worker.on("error",(e=>this._listeners.forEach((r=>r(e)))))}else{this._worker.addEventListener("message",(e=>this._eventListener(e)))}}_eventListener(e){const{id:r,error:t,result:s}=e.data;this._listeners[r](t,s);delete this._listeners[r];if(this._isNodeWorker&&--this._executing===0){this._worker.unref()}}render(e,r){return new Promise(((t,s)=>{const i=this._nextId++;if(this._isNodeWorker&&this._executing++===0){this._worker.ref()}this._listeners[i]=function(e,r){if(e){const r=new Error(e.message);if(e.fileName)r.fileName=e.fileName;if(e.lineNumber)r.lineNumber=e.lineNumber;if(e.stack)r.stack=e.stack;return s(r)}t(r)};this._worker.postMessage({id:i,src:e,options:r})}))}terminate(){return this._worker.terminate()}}class r{_wrapper;constructor(r){if(!r)r={};if(typeof r.workerURL!=="undefined"){this._wrapper=new e(new Worker(r.workerURL,{type:"module"}))}else if(typeof r.worker!=="undefined"){this._wrapper=new e(r.worker)}else{throw new Error("Must specify workerURL or worker option.")}}renderString(e,{format:r="svg",engine:t="dot",files:s=[],images:i=[],yInvert:n=false,nop:o=0}={}){for(const{path:e,width:r,height:t}of i){s.push({path:e,data:'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'+'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+`<svg width="${r}" height="${t}"></svg>`})}return this._wrapper.render(e,{format:r,engine:t,files:s,yInvert:n,nop:o})}renderJSONObject(e,r={}){let{format:t}=r;if(!t||!t.startsWith("json")){t="json"}return this.renderString(e,{...r,format:t}).then(JSON.parse)}terminateWorker(){return this._wrapper.terminate()}}export default r;
