md2x 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as t,b as r,c as e,d as m,e as p,f as n,h as a,i as d,j as f,k as i,l as s,m as x,n as l,o as u}from"./chunks/chunk-RLHZRADD.js";import"./chunks/chunk-EFKQH5UR.js";import"./chunks/chunk-DFROP2PD.js";import"./chunks/chunk-3P5X57NT.js";import"./chunks/chunk-CVKZIRZW.js";import"./chunks/chunk-DJGIYXVP.js";import"./chunks/chunk-URO5RPHJ.js";import"./chunks/chunk-YFL3W3OS.js";import"./chunks/chunk-3VL755NO.js";import"./chunks/chunk-2LPNL4GA.js";import"./chunks/chunk-MHCTK6WW.js";import"./chunks/chunk-R6G2575A.js";import"./chunks/chunk-AK6TXLWO.js";import"./chunks/chunk-PUOHPY5L.js";import"./chunks/chunk-R65AQGTF.js";import"./chunks/chunk-TRGQPVRY.js";import"./chunks/chunk-CN4F5HOV.js";import"./chunks/chunk-LLCWR7UA.js";import"./chunks/chunk-PARPCLXM.js";import"./chunks/chunk-IENSDROB.js";import"./chunks/chunk-5DPTQTJJ.js";import"./chunks/chunk-Z4LVGK7Y.js";import"./chunks/chunk-NM6J3ND7.js";import*as o from"path";import{fileURLToPath as O}from"url";var _=O(import.meta.url),T=o.dirname(_);globalThis.__md2x_module_dir__=T;export{t as NodeDocxExporter,m as NodeHtmlExporter,e as NodeImageExporter,r as NodePdfExporter,l as convert,u as convertFile,n as frontMatterToOptions,a as markdownToDocxBuffer,i as markdownToHtmlBuffer,f as markdownToHtmlString,s as markdownToImageBuffer,x as markdownToImageBuffers,d as markdownToPdfBuffer,p as parseFrontMatter};
1
+ import{a as t,b as r,c as e,d as m,e as p,f as n,h as a,i as d,j as f,k as i,l as s,m as x,n as l,o as u}from"./chunks/chunk-FXZD57XY.js";import"./chunks/chunk-EFKQH5UR.js";import"./chunks/chunk-DFROP2PD.js";import"./chunks/chunk-3P5X57NT.js";import"./chunks/chunk-CVKZIRZW.js";import"./chunks/chunk-DJGIYXVP.js";import"./chunks/chunk-URO5RPHJ.js";import"./chunks/chunk-YFL3W3OS.js";import"./chunks/chunk-3VL755NO.js";import"./chunks/chunk-2LPNL4GA.js";import"./chunks/chunk-MHCTK6WW.js";import"./chunks/chunk-R6G2575A.js";import"./chunks/chunk-AK6TXLWO.js";import"./chunks/chunk-PUOHPY5L.js";import"./chunks/chunk-R65AQGTF.js";import"./chunks/chunk-TRGQPVRY.js";import"./chunks/chunk-CN4F5HOV.js";import"./chunks/chunk-LLCWR7UA.js";import"./chunks/chunk-PARPCLXM.js";import"./chunks/chunk-IENSDROB.js";import"./chunks/chunk-5DPTQTJJ.js";import"./chunks/chunk-Z4LVGK7Y.js";import"./chunks/chunk-NM6J3ND7.js";import*as o from"path";import{fileURLToPath as O}from"url";var _=O(import.meta.url),T=o.dirname(_);globalThis.__md2x_module_dir__=T;export{t as NodeDocxExporter,m as NodeHtmlExporter,e as NodeImageExporter,r as NodePdfExporter,l as convert,u as convertFile,n as frontMatterToOptions,a as markdownToDocxBuffer,i as markdownToHtmlBuffer,f as markdownToHtmlString,s as markdownToImageBuffer,x as markdownToImageBuffers,d as markdownToPdfBuffer,p as parseFrontMatter};
package/dist/md2x.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{e as _,f as j,g as y,n as k}from"./chunks/chunk-RLHZRADD.js";import"./chunks/chunk-EFKQH5UR.js";import"./chunks/chunk-DFROP2PD.js";import"./chunks/chunk-3P5X57NT.js";import"./chunks/chunk-CVKZIRZW.js";import"./chunks/chunk-DJGIYXVP.js";import"./chunks/chunk-URO5RPHJ.js";import"./chunks/chunk-YFL3W3OS.js";import"./chunks/chunk-3VL755NO.js";import"./chunks/chunk-2LPNL4GA.js";import"./chunks/chunk-MHCTK6WW.js";import"./chunks/chunk-R6G2575A.js";import"./chunks/chunk-AK6TXLWO.js";import"./chunks/chunk-PUOHPY5L.js";import"./chunks/chunk-R65AQGTF.js";import"./chunks/chunk-TRGQPVRY.js";import"./chunks/chunk-CN4F5HOV.js";import"./chunks/chunk-LLCWR7UA.js";import"./chunks/chunk-PARPCLXM.js";import"./chunks/chunk-IENSDROB.js";import"./chunks/chunk-5DPTQTJJ.js";import"./chunks/chunk-Z4LVGK7Y.js";import"./chunks/chunk-NM6J3ND7.js";import*as a from"fs";import*as n from"path";import{fileURLToPath as I}from"url";var L=I(import.meta.url),T=n.dirname(L);globalThis.__md2x_module_dir__=T;function O(){return globalThis.__md2x_module_dir__||T}function R(o){let e=n.extname(o).toLowerCase();return e===".pdf"?"pdf":e===".docx"?"docx":e===".html"||e===".htm"?"html":e===".png"?"png":e===".jpg"?"jpg":e===".jpeg"?"jpeg":e===".webp"?"webp":null}function B(){let o=O(),e=[n.join(o,"themes","presets"),n.resolve(o,"../../src/themes/presets"),n.resolve(process.cwd(),"src/themes/presets")];for(let t of e)try{if(a.existsSync(t)&&a.statSync(t).isDirectory())return t}catch{}return null}function v(){let o=B();if(!o)return["default"];try{let e=a.readdirSync(o,{withFileTypes:!0}).filter(s=>s.isFile()&&s.name.endsWith(".json")).map(s=>s.name.replace(/\.json$/i,"")).filter(s=>s.length>0).sort();return["default",...Array.from(new Set(e)).filter(s=>s!=="default")]}catch{return["default"]}}function S(o){return o.join(", ")}function $(){let o=v();console.log(`
2
+ import{e as _,f as R,g as y,n as j}from"./chunks/chunk-FXZD57XY.js";import"./chunks/chunk-EFKQH5UR.js";import"./chunks/chunk-DFROP2PD.js";import"./chunks/chunk-3P5X57NT.js";import"./chunks/chunk-CVKZIRZW.js";import"./chunks/chunk-DJGIYXVP.js";import"./chunks/chunk-URO5RPHJ.js";import"./chunks/chunk-YFL3W3OS.js";import"./chunks/chunk-3VL755NO.js";import"./chunks/chunk-2LPNL4GA.js";import"./chunks/chunk-MHCTK6WW.js";import"./chunks/chunk-R6G2575A.js";import"./chunks/chunk-AK6TXLWO.js";import"./chunks/chunk-PUOHPY5L.js";import"./chunks/chunk-R65AQGTF.js";import"./chunks/chunk-TRGQPVRY.js";import"./chunks/chunk-CN4F5HOV.js";import"./chunks/chunk-LLCWR7UA.js";import"./chunks/chunk-PARPCLXM.js";import"./chunks/chunk-IENSDROB.js";import"./chunks/chunk-5DPTQTJJ.js";import"./chunks/chunk-Z4LVGK7Y.js";import"./chunks/chunk-NM6J3ND7.js";import*as l from"fs";import*as n from"path";import{fileURLToPath as C}from"url";var I=C(import.meta.url),k=n.dirname(I);globalThis.__md2x_module_dir__=k;function T(){return globalThis.__md2x_module_dir__||k}function B(r){let e=n.extname(r).toLowerCase();return e===".pdf"?"pdf":e===".docx"?"docx":e===".html"||e===".htm"?"html":e===".png"?"png":e===".jpg"?"jpg":e===".jpeg"?"jpeg":e===".webp"?"webp":null}function N(){let r=T(),e=[n.join(r,"themes","presets"),n.resolve(r,"../../src/themes/presets"),n.resolve(process.cwd(),"src/themes/presets")];for(let t of e)try{if(l.existsSync(t)&&l.statSync(t).isDirectory())return t}catch{}return null}function v(){let r=N();if(!r)return["default"];try{let e=l.readdirSync(r,{withFileTypes:!0}).filter(i=>i.isFile()&&i.name.endsWith(".json")).map(i=>i.name.replace(/\.json$/i,"")).filter(i=>i.length>0).sort();return["default",...Array.from(new Set(e)).filter(i=>i!=="default")]}catch{return["default"]}}function O(r){return r.join(", ")}function $(){let r=v();console.log(`
3
3
  md2x - Convert Markdown to PDF, DOCX, HTML, or Image
4
4
 
5
5
  Usage:
@@ -17,6 +17,8 @@ Options:
17
17
  -h, --help Show this help message
18
18
  -v, --version Show version number
19
19
  --diagram-mode img | live | none (default: img for DOCX; live for HTML/Image)
20
+ --live-runtime inline | cdn (HTML + diagramMode=live; default: cdn)
21
+ --live-runtime-url Custom runtime URL when --live-runtime cdn
20
22
  --hr-page-break Convert horizontal rules to page breaks: true | false (default: true for PDF/DOCX; false for HTML/Image)
21
23
  --templates-dir Extra template dir for md2x blocks (repeatable; resolved against input dir when relative)
22
24
  --list-themes List all available themes
@@ -32,8 +34,8 @@ Examples:
32
34
  npx md2x --list-themes
33
35
 
34
36
  Available Themes:
35
- ${S(o)}
36
- `)}function N(){let o=O(),e=[n.join(o,"../package.json"),n.join(o,"../../package.json")];for(let t of e)try{let p=JSON.parse(a.readFileSync(t,"utf-8"));if(p?.version){console.log(`md2x v${p.version}`);return}}catch{}console.log("md2x v1.0.0")}function U(){let o=v();console.log(`
37
+ ${O(r)}
38
+ `)}function H(){let r=T(),e=[n.join(r,"../package.json"),n.join(r,"../../package.json")];for(let t of e)try{let p=JSON.parse(l.readFileSync(t,"utf-8"));if(p?.version){console.log(`md2x v${p.version}`);return}}catch{}console.log("md2x v1.0.0")}function W(){let r=v();console.log(`
37
39
  Available Themes:
38
- `),o.forEach(e=>{console.log(` - ${e}`)}),console.log("")}function H(o){let e={input:"",output:"",theme:"default",format:"pdf",help:!1,version:!1,listThemes:!1,diagramMode:"live",templatesDir:[],hrPageBreak:null,_explicit:new Set},t=0,p=[];for(;t<o.length;){let s=o[t];if(s==="--"){t++;continue}if(s==="-h"||s==="--help")e.help=!0;else if(s==="-v"||s==="--version")e.version=!0;else if(s==="--list-themes")e.listThemes=!0;else if(s==="--diagram-mode")if(t++,t<o.length){let r=String(o[t]).toLowerCase();r!=="img"&&r!=="live"&&r!=="none"&&(console.error(`Error: Invalid --diagram-mode "${o[t]}". Must be "img", "live", or "none".`),process.exit(1)),e.diagramMode=r,e._explicit.add("diagramMode")}else console.error("Error: --diagram-mode requires a value (img | live | none)"),process.exit(1);else if(s==="-o"||s==="--output")t++,t<o.length?e.output=o[t]:(console.error("Error: --output requires a file path"),process.exit(1));else if(s==="-t"||s==="--theme")t++,t<o.length?(e.theme=o[t],e._explicit.add("theme")):(console.error("Error: --theme requires a theme name"),process.exit(1));else if(s==="-f"||s==="--format")if(t++,t<o.length){let r=o[t].toLowerCase();r!=="pdf"&&r!=="docx"&&r!=="html"&&r!=="png"&&r!=="jpg"&&r!=="jpeg"&&r!=="webp"&&(console.error(`Error: Invalid format "${o[t]}". Must be "pdf", "docx", "html", "png", "jpg/jpeg", or "webp".`),process.exit(1)),e.format=r,e._explicit.add("format")}else console.error("Error: --format requires a format (pdf, docx, html, png, jpg/jpeg, or webp)"),process.exit(1);else if(s==="--hr-page-break")if(t++,t<o.length){let r=o[t].toLowerCase();r!=="true"&&r!=="false"&&(console.error(`Error: Invalid --hr-page-break "${o[t]}". Must be "true" or "false".`),process.exit(1)),e.hrPageBreak=r==="true",e._explicit.add("hrPageBreak")}else console.error("Error: --hr-page-break requires a value (true | false)"),process.exit(1);else if(s==="--templates-dir")if(t++,t<o.length){let r=String(o[t]).trim();r||(console.error("Error: --templates-dir requires a non-empty path"),process.exit(1)),e.templatesDir.push(r),e._explicit.add("templatesDir")}else console.error("Error: --templates-dir requires a path"),process.exit(1);else s.startsWith("-")?(console.error(`Error: Unknown option: ${s}`),process.exit(1)):p.push(s);t++}return p.length>0&&(e.input=p[0]),p.length>1&&!e.output&&(e.output=p[1]),e}async function W(){let o=process.argv.slice(2),e=H(o);e.help&&($(),process.exit(0)),e.version&&(N(),process.exit(0)),e.listThemes&&(U(),process.exit(0)),e.input||(console.error(`Error: Input file is required
39
- `),$(),process.exit(1));let t=n.resolve(e.input);a.existsSync(t)||(console.error(`Error: Input file not found: ${t}`),process.exit(1));try{a.accessSync(t,a.constants.R_OK)}catch{console.error(`Error: Cannot read input file: ${t}`),process.exit(1)}let p=a.readFileSync(t,"utf-8"),s=_(p),r=s.hasFrontMatter?j(s.data):{},F=!e._explicit.has("format")&&e.output?R(e.output):null,i=e._explicit.has("format")?e.format:r.format??F??e.format,f=e._explicit.has("theme")?e.theme:r.theme??e.theme,b=i==="png"||i==="jpg"||i==="jpeg"||i==="webp",P=i==="docx"?"img":"live",D=e._explicit.has("diagramMode")?e.diagramMode:r.diagramMode??P,A=e._explicit.has("templatesDir")?e.templatesDir:r.templatesDir??e.templatesDir,E=e._explicit.has("hrPageBreak")?e.hrPageBreak:r.hrAsPageBreak??!(i==="html"||i==="png"||i==="jpg"||i==="jpeg"||i==="webp"),h=v();h.length>0&&!h.includes(f)&&(console.error(`Error: Unknown theme: ${f}`),console.error(`Available themes: ${S(h)}`),console.error("Tip: run `npx md2x --list-themes` to see the full list."),process.exit(1)),console.log(`Converting: ${n.basename(t)}`),console.log(`Format: ${i.toUpperCase()}`),console.log(`Theme: ${f}`),console.log(`HR as page break: ${E}`),(i==="pdf"||i==="html"||i==="png"||i==="jpg"||i==="jpeg"||i==="webp")&&console.log(`Diagram mode: ${D}`);try{let l=e.output,m=y(i);if(l)l=n.resolve(l);else{let u=n.dirname(t),g=n.basename(t,n.extname(t));l=n.join(u,`${g}${m}`)}let w=n.dirname(l);a.existsSync(w)||a.mkdirSync(w,{recursive:!0});let C=b?{...r.image??{},type:i==="jpg"?"jpeg":i,split:r.image?.split??"auto"}:void 0,c=await k(s.content,{format:i,theme:f,diagramMode:D,hrAsPageBreak:E,basePath:n.dirname(t),title:r.title??n.basename(t,n.extname(t)),pdf:r.pdf,standalone:r.standalone,baseTag:r.baseTag,cdn:r.cdn,templatesDir:A,image:C,skipFrontMatter:!0});if(b){let u=c.buffers&&c.buffers.length>0?c.buffers:[c.buffer];if(u.length<=1){a.writeFileSync(l,u[0]),console.log(`Output: ${l}`),console.log("Done!");return}let g=l.endsWith(m)?l.slice(0,-m.length):l,x=[];for(let d=0;d<u.length;d++){let q=String(d+1).padStart(3,"0"),M=`${g}.part-${q}${m}`;a.writeFileSync(M,u[d]),x.push(M)}console.log(`Output: ${x[0]} (+${x.length-1} parts)`),console.log("Done!");return}a.writeFileSync(l,c.buffer),console.log(`Output: ${l}`),console.log("Done!")}catch(l){let m=l instanceof Error?l.message:String(l);console.error(`Error during conversion: ${m}`),process.exit(1)}}W().catch(o=>{console.error("Unexpected error:",o),process.exit(1)});
40
+ `),r.forEach(e=>{console.log(` - ${e}`)}),console.log("")}function X(r){let e={input:"",output:"",theme:"default",format:"pdf",help:!1,version:!1,listThemes:!1,diagramMode:"live",templatesDir:[],liveRuntime:void 0,liveRuntimeUrl:void 0,hrPageBreak:null,_explicit:new Set},t=0,p=[];for(;t<r.length;){let i=r[t];if(i==="--"){t++;continue}if(i==="-h"||i==="--help")e.help=!0;else if(i==="-v"||i==="--version")e.version=!0;else if(i==="--list-themes")e.listThemes=!0;else if(i==="--diagram-mode")if(t++,t<r.length){let o=String(r[t]).toLowerCase();o!=="img"&&o!=="live"&&o!=="none"&&(console.error(`Error: Invalid --diagram-mode "${r[t]}". Must be "img", "live", or "none".`),process.exit(1)),e.diagramMode=o,e._explicit.add("diagramMode")}else console.error("Error: --diagram-mode requires a value (img | live | none)"),process.exit(1);else if(i==="-o"||i==="--output")t++,t<r.length?e.output=r[t]:(console.error("Error: --output requires a file path"),process.exit(1));else if(i==="-t"||i==="--theme")t++,t<r.length?(e.theme=r[t],e._explicit.add("theme")):(console.error("Error: --theme requires a theme name"),process.exit(1));else if(i==="-f"||i==="--format")if(t++,t<r.length){let o=r[t].toLowerCase();o!=="pdf"&&o!=="docx"&&o!=="html"&&o!=="png"&&o!=="jpg"&&o!=="jpeg"&&o!=="webp"&&(console.error(`Error: Invalid format "${r[t]}". Must be "pdf", "docx", "html", "png", "jpg/jpeg", or "webp".`),process.exit(1)),e.format=o,e._explicit.add("format")}else console.error("Error: --format requires a format (pdf, docx, html, png, jpg/jpeg, or webp)"),process.exit(1);else if(i==="--hr-page-break")if(t++,t<r.length){let o=r[t].toLowerCase();o!=="true"&&o!=="false"&&(console.error(`Error: Invalid --hr-page-break "${r[t]}". Must be "true" or "false".`),process.exit(1)),e.hrPageBreak=o==="true",e._explicit.add("hrPageBreak")}else console.error("Error: --hr-page-break requires a value (true | false)"),process.exit(1);else if(i==="--templates-dir")if(t++,t<r.length){let o=String(r[t]).trim();o||(console.error("Error: --templates-dir requires a non-empty path"),process.exit(1)),e.templatesDir.push(o),e._explicit.add("templatesDir")}else console.error("Error: --templates-dir requires a path"),process.exit(1);else if(i==="--live-runtime")if(t++,t<r.length){let o=String(r[t]).toLowerCase();o!=="inline"&&o!=="cdn"&&(console.error(`Error: Invalid --live-runtime "${r[t]}". Must be "inline" or "cdn".`),process.exit(1)),e.liveRuntime=o,e._explicit.add("liveRuntime")}else console.error("Error: --live-runtime requires a value (inline | cdn)"),process.exit(1);else if(i==="--live-runtime-url")if(t++,t<r.length){let o=String(r[t]).trim();o||(console.error("Error: --live-runtime-url requires a non-empty URL"),process.exit(1)),e.liveRuntimeUrl=o,e._explicit.add("liveRuntimeUrl")}else console.error("Error: --live-runtime-url requires a URL"),process.exit(1);else i.startsWith("-")?(console.error(`Error: Unknown option: ${i}`),process.exit(1)):p.push(i);t++}return p.length>0&&(e.input=p[0]),p.length>1&&!e.output&&(e.output=p[1]),e}async function z(){let r=process.argv.slice(2),e=X(r);e.help&&($(),process.exit(0)),e.version&&(H(),process.exit(0)),e.listThemes&&(W(),process.exit(0)),e.input||(console.error(`Error: Input file is required
41
+ `),$(),process.exit(1));let t=n.resolve(e.input);l.existsSync(t)||(console.error(`Error: Input file not found: ${t}`),process.exit(1));try{l.accessSync(t,l.constants.R_OK)}catch{console.error(`Error: Cannot read input file: ${t}`),process.exit(1)}let p=l.readFileSync(t,"utf-8"),i=_(p),o=i.hasFrontMatter?R(i.data):{},S=!e._explicit.has("format")&&e.output?B(e.output):null,s=e._explicit.has("format")?e.format:o.format??S??e.format,f=e._explicit.has("theme")?e.theme:o.theme??e.theme,b=s==="png"||s==="jpg"||s==="jpeg"||s==="webp",F=s==="docx"?"img":"live",E=e._explicit.has("diagramMode")?e.diagramMode:o.diagramMode??F,P=e._explicit.has("templatesDir")?e.templatesDir:o.templatesDir??e.templatesDir,U=e._explicit.has("liveRuntime")?e.liveRuntime:o.liveRuntime??e.liveRuntime,A=e._explicit.has("liveRuntimeUrl")?e.liveRuntimeUrl:o.liveRuntimeUrl??e.liveRuntimeUrl,D=e._explicit.has("hrPageBreak")?e.hrPageBreak:o.hrAsPageBreak??!(s==="html"||s==="png"||s==="jpg"||s==="jpeg"||s==="webp"),h=v();h.length>0&&!h.includes(f)&&(console.error(`Error: Unknown theme: ${f}`),console.error(`Available themes: ${O(h)}`),console.error("Tip: run `npx md2x --list-themes` to see the full list."),process.exit(1)),console.log(`Converting: ${n.basename(t)}`),console.log(`Format: ${s.toUpperCase()}`),console.log(`Theme: ${f}`),console.log(`HR as page break: ${D}`),(s==="pdf"||s==="html"||s==="png"||s==="jpg"||s==="jpeg"||s==="webp")&&console.log(`Diagram mode: ${E}`);try{let a=e.output,m=y(s);if(a)a=n.resolve(a);else{let u=n.dirname(t),g=n.basename(t,n.extname(t));a=n.join(u,`${g}${m}`)}let w=n.dirname(a);l.existsSync(w)||l.mkdirSync(w,{recursive:!0});let L=b?{...o.image??{},type:s==="jpg"?"jpeg":s,split:o.image?.split??"auto"}:void 0,c=await j(i.content,{format:s,theme:f,diagramMode:E,hrAsPageBreak:D,basePath:n.dirname(t),title:o.title??n.basename(t,n.extname(t)),pdf:o.pdf,standalone:o.standalone,baseTag:o.baseTag,liveRuntime:U,liveRuntimeUrl:A,cdn:o.cdn,templatesDir:P,image:L,skipFrontMatter:!0});if(b){let u=c.buffers&&c.buffers.length>0?c.buffers:[c.buffer];if(u.length<=1){l.writeFileSync(a,u[0]),console.log(`Output: ${a}`),console.log("Done!");return}let g=a.endsWith(m)?a.slice(0,-m.length):a,x=[];for(let d=0;d<u.length;d++){let q=String(d+1).padStart(3,"0"),M=`${g}.part-${q}${m}`;l.writeFileSync(M,u[d]),x.push(M)}console.log(`Output: ${x[0]} (+${x.length-1} parts)`),console.log("Done!");return}l.writeFileSync(a,c.buffer),console.log(`Output: ${a}`),console.log("Done!")}catch(a){let m=a instanceof Error?a.message:String(a);console.error(`Error during conversion: ${m}`),process.exit(1)}}z().catch(r=>{console.error("Unexpected error:",r),process.exit(1)});
@@ -0,0 +1,24 @@
1
+ "use strict";(()=>{var er=Object.create;var ae=Object.defineProperty;var rr=Object.getOwnPropertyDescriptor;var nr=Object.getOwnPropertyNames;var ir=Object.getPrototypeOf,or=Object.prototype.hasOwnProperty;var sr=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ct=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var ar=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nr(t))!or.call(n,i)&&i!==e&&ae(n,i,{get:()=>t[i],enumerable:!(r=rr(t,i))||r.enumerable});return n};var hr=(n,t,e)=>(e=n!=null?er(ir(n)):{},ar(t||!n||!n.__esModule?ae(e,"default",{value:n,enumerable:!0}):e,n));var ue=Ct(pt=>{"use strict";M();pt.byteLength=ur;pt.toByteArray=fr;pt.fromByteArray=gr;var N=[],D=[],cr=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(J=0,he=Rt.length;J<he;++J)N[J]=Rt[J],D[Rt.charCodeAt(J)]=J;var J,he;D[45]=62;D[95]=63;function ce(n){var t=n.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=n.indexOf("=");e===-1&&(e=t);var r=e===t?0:4-e%4;return[e,r]}function ur(n){var t=ce(n),e=t[0],r=t[1];return(e+r)*3/4-r}function lr(n,t,e){return(t+e)*3/4-e}function fr(n){var t,e=ce(n),r=e[0],i=e[1],o=new cr(lr(n,r,i)),s=0,a=i>0?r-4:r,c;for(c=0;c<a;c+=4)t=D[n.charCodeAt(c)]<<18|D[n.charCodeAt(c+1)]<<12|D[n.charCodeAt(c+2)]<<6|D[n.charCodeAt(c+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=D[n.charCodeAt(c)]<<2|D[n.charCodeAt(c+1)]>>4,o[s++]=t&255),i===1&&(t=D[n.charCodeAt(c)]<<10|D[n.charCodeAt(c+1)]<<4|D[n.charCodeAt(c+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function pr(n){return N[n>>18&63]+N[n>>12&63]+N[n>>6&63]+N[n&63]}function dr(n,t,e){for(var r,i=[],o=t;o<e;o+=3)r=(n[o]<<16&16711680)+(n[o+1]<<8&65280)+(n[o+2]&255),i.push(pr(r));return i.join("")}function gr(n){for(var t,e=n.length,r=e%3,i=[],o=16383,s=0,a=e-r;s<a;s+=o)i.push(dr(n,s,s+o>a?a:s+o));return r===1?(t=n[e-1],i.push(N[t>>2]+N[t<<4&63]+"==")):r===2&&(t=(n[e-2]<<8)+n[e-1],i.push(N[t>>10]+N[t>>4&63]+N[t<<2&63]+"=")),i.join("")}});var le=Ct(_t=>{M();_t.read=function(n,t,e,r,i){var o,s,a=i*8-r-1,c=(1<<a)-1,l=c>>1,h=-7,u=e?i-1:0,f=e?-1:1,p=n[t+u];for(u+=f,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=o*256+n[t+u],u+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=s*256+n[t+u],u+=f,h-=8);if(o===0)o=1-l;else{if(o===c)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-l}return(p?-1:1)*s*Math.pow(2,o-r)};_t.write=function(n,t,e,r,i,o){var s,a,c,l=o*8-i-1,h=(1<<l)-1,u=h>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,g=r?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+u>=1?t+=f/c:t+=f*Math.pow(2,1-u),t*c>=2&&(s++,c/=2),s+u>=h?(a=0,s=h):s+u>=1?(a=(t*c-1)*Math.pow(2,i),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;n[e+p]=a&255,p+=g,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;n[e+p]=s&255,p+=g,s/=256,l-=8);n[e+p-g]|=m*128}});var Ae=Ct(it=>{"use strict";M();var Pt=ue(),rt=le(),fe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;it.Buffer=d;it.SlowBuffer=kr;it.INSPECT_MAX_BYTES=50;var dt=2147483647;it.kMaxLength=dt;d.TYPED_ARRAY_SUPPORT=mr();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function mr(){try{let n=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(n,t),n.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function H(n){if(n>dt)throw new RangeError('The value "'+n+'" is invalid for option "size"');let t=new Uint8Array(n);return Object.setPrototypeOf(t,d.prototype),t}function d(n,t,e){if(typeof n=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Lt(n)}return me(n,t,e)}d.poolSize=8192;function me(n,t,e){if(typeof n=="string")return wr(n,t);if(ArrayBuffer.isView(n))return xr(n);if(n==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n);if(z(n,ArrayBuffer)||n&&z(n.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(z(n,SharedArrayBuffer)||n&&z(n.buffer,SharedArrayBuffer)))return Ut(n,t,e);if(typeof n=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=n.valueOf&&n.valueOf();if(r!=null&&r!==n)return d.from(r,t,e);let i=br(n);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof n[Symbol.toPrimitive]=="function")return d.from(n[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n)}d.from=function(n,t,e){return me(n,t,e)};Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d,Uint8Array);function ye(n){if(typeof n!="number")throw new TypeError('"size" argument must be of type number');if(n<0)throw new RangeError('The value "'+n+'" is invalid for option "size"')}function yr(n,t,e){return ye(n),n<=0?H(n):t!==void 0?typeof e=="string"?H(n).fill(t,e):H(n).fill(t):H(n)}d.alloc=function(n,t,e){return yr(n,t,e)};function Lt(n){return ye(n),H(n<0?0:vt(n)|0)}d.allocUnsafe=function(n){return Lt(n)};d.allocUnsafeSlow=function(n){return Lt(n)};function wr(n,t){if((typeof t!="string"||t==="")&&(t="utf8"),!d.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=we(n,t)|0,r=H(e),i=r.write(n,t);return i!==e&&(r=r.slice(0,i)),r}function Ot(n){let t=n.length<0?0:vt(n.length)|0,e=H(t);for(let r=0;r<t;r+=1)e[r]=n[r]&255;return e}function xr(n){if(z(n,Uint8Array)){let t=new Uint8Array(n);return Ut(t.buffer,t.byteOffset,t.byteLength)}return Ot(n)}function Ut(n,t,e){if(t<0||n.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(n.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let r;return t===void 0&&e===void 0?r=new Uint8Array(n):e===void 0?r=new Uint8Array(n,t):r=new Uint8Array(n,t,e),Object.setPrototypeOf(r,d.prototype),r}function br(n){if(d.isBuffer(n)){let t=vt(n.length)|0,e=H(t);return e.length===0||n.copy(e,0,0,t),e}if(n.length!==void 0)return typeof n.length!="number"||Gt(n.length)?H(0):Ot(n);if(n.type==="Buffer"&&Array.isArray(n.data))return Ot(n.data)}function vt(n){if(n>=dt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+dt.toString(16)+" bytes");return n|0}function kr(n){return+n!=n&&(n=0),d.alloc(+n)}d.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==d.prototype};d.compare=function(t,e){if(z(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),z(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(t)||!d.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,i=e.length;for(let o=0,s=Math.min(r,i);o<s;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0};d.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};d.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return d.alloc(0);let r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;let i=d.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){let s=t[r];if(z(s,Uint8Array))o+s.length>i.length?(d.isBuffer(s)||(s=d.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(d.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function we(n,t){if(d.isBuffer(n))return n.length;if(ArrayBuffer.isView(n)||z(n,ArrayBuffer))return n.byteLength;if(typeof n!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof n);let e=n.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return Dt(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return $e(n).length;default:if(i)return r?-1:Dt(n).length;t=(""+t).toLowerCase(),i=!0}}d.byteLength=we;function Er(n,t,e){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return Rr(this,t,e);case"utf8":case"utf-8":return be(this,t,e);case"ascii":return Tr(this,t,e);case"latin1":case"binary":return Cr(this,t,e);case"base64":return Ar(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _r(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function Q(n,t,e){let r=n[t];n[t]=n[e],n[e]=r}d.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)Q(this,e,e+1);return this};d.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)Q(this,e,e+3),Q(this,e+1,e+2);return this};d.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)Q(this,e,e+7),Q(this,e+1,e+6),Q(this,e+2,e+5),Q(this,e+3,e+4);return this};d.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?be(this,0,t):Er.apply(this,arguments)};d.prototype.toLocaleString=d.prototype.toString;d.prototype.equals=function(t){if(!d.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:d.compare(this,t)===0};d.prototype.inspect=function(){let t="",e=it.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};fe&&(d.prototype[fe]=d.prototype.inspect);d.prototype.compare=function(t,e,r,i,o){if(z(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;let s=o-i,a=r-e,c=Math.min(s,a),l=this.slice(i,o),h=t.slice(e,r);for(let u=0;u<c;++u)if(l[u]!==h[u]){s=l[u],a=h[u];break}return s<a?-1:a<s?1:0};function xe(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Gt(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:pe(n,t,e,r,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):pe(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function pe(n,t,e,r,i){let o=1,s=n.length,a=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;o=2,s/=2,a/=2,e/=2}function c(h,u){return o===1?h[u]:h.readUInt16BE(u*o)}let l;if(i){let h=-1;for(l=e;l<s;l++)if(c(n,l)===c(t,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===a)return h*o}else h!==-1&&(l-=l-h),h=-1}else for(e+a>s&&(e=s-a),l=e;l>=0;l--){let h=!0;for(let u=0;u<a;u++)if(c(n,l+u)!==c(t,u)){h=!1;break}if(h)return l}return-1}d.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};d.prototype.indexOf=function(t,e,r){return xe(this,t,e,r,!0)};d.prototype.lastIndexOf=function(t,e,r){return xe(this,t,e,r,!1)};function Mr(n,t,e,r){e=Number(e)||0;let i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;let o=t.length;r>o/2&&(r=o/2);let s;for(s=0;s<r;++s){let a=parseInt(t.substr(s*2,2),16);if(Gt(a))return s;n[e+s]=a}return s}function Br(n,t,e,r){return gt(Dt(t,n.length-e),n,e,r)}function Sr(n,t,e,r){return gt(Dr(t),n,e,r)}function Ir(n,t,e,r){return gt($e(t),n,e,r)}function $r(n,t,e,r){return gt(Lr(t,n.length-e),n,e,r)}d.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-e;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return Mr(this,t,e,r);case"utf8":case"utf-8":return Br(this,t,e,r);case"ascii":case"latin1":case"binary":return Sr(this,t,e,r);case"base64":return Ir(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $r(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ar(n,t,e){return t===0&&e===n.length?Pt.fromByteArray(n):Pt.fromByteArray(n.slice(t,e))}function be(n,t,e){e=Math.min(n.length,e);let r=[],i=t;for(;i<e;){let o=n[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=e){let c,l,h,u;switch(a){case 1:o<128&&(s=o);break;case 2:c=n[i+1],(c&192)===128&&(u=(o&31)<<6|c&63,u>127&&(s=u));break;case 3:c=n[i+1],l=n[i+2],(c&192)===128&&(l&192)===128&&(u=(o&15)<<12|(c&63)<<6|l&63,u>2047&&(u<55296||u>57343)&&(s=u));break;case 4:c=n[i+1],l=n[i+2],h=n[i+3],(c&192)===128&&(l&192)===128&&(h&192)===128&&(u=(o&15)<<18|(c&63)<<12|(l&63)<<6|h&63,u>65535&&u<1114112&&(s=u))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=a}return Fr(r)}var de=4096;function Fr(n){let t=n.length;if(t<=de)return String.fromCharCode.apply(String,n);let e="",r=0;for(;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=de));return e}function Tr(n,t,e){let r="";e=Math.min(n.length,e);for(let i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function Cr(n,t,e){let r="";e=Math.min(n.length,e);for(let i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function Rr(n,t,e){let r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);let i="";for(let o=t;o<e;++o)i+=vr[n[o]];return i}function _r(n,t,e){let r=n.slice(t,e),i="";for(let o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}d.prototype.slice=function(t,e){let r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,d.prototype),i};function F(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(t,e,r){t=t>>>0,e=e>>>0,r||F(t,e,this.length);let i=this[t],o=1,s=0;for(;++s<e&&(o*=256);)i+=this[t+s]*o;return i};d.prototype.readUintBE=d.prototype.readUIntBE=function(t,e,r){t=t>>>0,e=e>>>0,r||F(t,e,this.length);let i=this[t+--e],o=1;for(;e>0&&(o*=256);)i+=this[t+--e]*o;return i};d.prototype.readUint8=d.prototype.readUInt8=function(t,e){return t=t>>>0,e||F(t,1,this.length),this[t]};d.prototype.readUint16LE=d.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||F(t,2,this.length),this[t]|this[t+1]<<8};d.prototype.readUint16BE=d.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||F(t,2,this.length),this[t]<<8|this[t+1]};d.prototype.readUint32LE=d.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||F(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};d.prototype.readUint32BE=d.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||F(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};d.prototype.readBigUInt64LE=X(function(t){t=t>>>0,nt(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&ht(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+r*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});d.prototype.readBigUInt64BE=X(function(t){t=t>>>0,nt(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&ht(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+r;return(BigInt(i)<<BigInt(32))+BigInt(o)});d.prototype.readIntLE=function(t,e,r){t=t>>>0,e=e>>>0,r||F(t,e,this.length);let i=this[t],o=1,s=0;for(;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};d.prototype.readIntBE=function(t,e,r){t=t>>>0,e=e>>>0,r||F(t,e,this.length);let i=e,o=1,s=this[t+--i];for(;i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};d.prototype.readInt8=function(t,e){return t=t>>>0,e||F(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};d.prototype.readInt16LE=function(t,e){t=t>>>0,e||F(t,2,this.length);let r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};d.prototype.readInt16BE=function(t,e){t=t>>>0,e||F(t,2,this.length);let r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};d.prototype.readInt32LE=function(t,e){return t=t>>>0,e||F(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};d.prototype.readInt32BE=function(t,e){return t=t>>>0,e||F(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};d.prototype.readBigInt64LE=X(function(t){t=t>>>0,nt(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&ht(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});d.prototype.readBigInt64BE=X(function(t){t=t>>>0,nt(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&ht(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+r)});d.prototype.readFloatLE=function(t,e){return t=t>>>0,e||F(t,4,this.length),rt.read(this,t,!0,23,4)};d.prototype.readFloatBE=function(t,e){return t=t>>>0,e||F(t,4,this.length),rt.read(this,t,!1,23,4)};d.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||F(t,8,this.length),rt.read(this,t,!0,52,8)};d.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||F(t,8,this.length),rt.read(this,t,!1,52,8)};function C(n,t,e,r,i,o){if(!d.isBuffer(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e>>>0,r=r>>>0,!i){let a=Math.pow(2,8*r)-1;C(this,t,e,r,a,0)}let o=1,s=0;for(this[e]=t&255;++s<r&&(o*=256);)this[e+s]=t/o&255;return e+r};d.prototype.writeUintBE=d.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e>>>0,r=r>>>0,!i){let a=Math.pow(2,8*r)-1;C(this,t,e,r,a,0)}let o=r-1,s=1;for(this[e+o]=t&255;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+r};d.prototype.writeUint8=d.prototype.writeUInt8=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,1,255,0),this[e]=t&255,e+1};d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function ke(n,t,e,r,i){Ie(t,r,i,n,e,7);let o=Number(t&BigInt(4294967295));n[e++]=o,o=o>>8,n[e++]=o,o=o>>8,n[e++]=o,o=o>>8,n[e++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return n[e++]=s,s=s>>8,n[e++]=s,s=s>>8,n[e++]=s,s=s>>8,n[e++]=s,e}function Ee(n,t,e,r,i){Ie(t,r,i,n,e,7);let o=Number(t&BigInt(4294967295));n[e+7]=o,o=o>>8,n[e+6]=o,o=o>>8,n[e+5]=o,o=o>>8,n[e+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return n[e+3]=s,s=s>>8,n[e+2]=s,s=s>>8,n[e+1]=s,s=s>>8,n[e]=s,e+8}d.prototype.writeBigUInt64LE=X(function(t,e=0){return ke(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeBigUInt64BE=X(function(t,e=0){return Ee(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});d.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e>>>0,!i){let c=Math.pow(2,8*r-1);C(this,t,e,r,c-1,-c)}let o=0,s=1,a=0;for(this[e]=t&255;++o<r&&(s*=256);)t<0&&a===0&&this[e+o-1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r};d.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e>>>0,!i){let c=Math.pow(2,8*r-1);C(this,t,e,r,c-1,-c)}let o=r-1,s=1,a=0;for(this[e+o]=t&255;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r};d.prototype.writeInt8=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};d.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};d.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};d.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};d.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e>>>0,r||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};d.prototype.writeBigInt64LE=X(function(t,e=0){return ke(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});d.prototype.writeBigInt64BE=X(function(t,e=0){return Ee(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Me(n,t,e,r,i,o){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Be(n,t,e,r,i){return t=+t,e=e>>>0,i||Me(n,t,e,4,34028234663852886e22,-34028234663852886e22),rt.write(n,t,e,r,23,4),e+4}d.prototype.writeFloatLE=function(t,e,r){return Be(this,t,e,!0,r)};d.prototype.writeFloatBE=function(t,e,r){return Be(this,t,e,!1,r)};function Se(n,t,e,r,i){return t=+t,e=e>>>0,i||Me(n,t,e,8,17976931348623157e292,-17976931348623157e292),rt.write(n,t,e,r,52,8),e+8}d.prototype.writeDoubleLE=function(t,e,r){return Se(this,t,e,!0,r)};d.prototype.writeDoubleBE=function(t,e,r){return Se(this,t,e,!1,r)};d.prototype.copy=function(t,e,r,i){if(!d.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);let o=i-r;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),o};d.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!d.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let s=t.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);let o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{let s=d.isBuffer(t)?t:d.from(t,i),a=s.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var et={};function Nt(n,t,e){et[n]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${n}]`,this.stack,delete this.name}get code(){return n}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${n}]: ${this.message}`}}}Nt("ERR_BUFFER_OUT_OF_BOUNDS",function(n){return n?`${n} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Nt("ERR_INVALID_ARG_TYPE",function(n,t){return`The "${n}" argument must be of type number. Received type ${typeof t}`},TypeError);Nt("ERR_OUT_OF_RANGE",function(n,t,e){let r=`The value of "${n}" is out of range.`,i=e;return Number.isInteger(e)&&Math.abs(e)>2**32?i=ge(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=ge(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ge(n){let t="",e=n.length,r=n[0]==="-"?1:0;for(;e>=r+4;e-=3)t=`_${n.slice(e-3,e)}${t}`;return`${n.slice(0,e)}${t}`}function Pr(n,t,e){nt(t,"offset"),(n[t]===void 0||n[t+e]===void 0)&&ht(t,n.length-(e+1))}function Ie(n,t,e,r,i,o){if(n>e||n<t){let s=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${t}${s} and <= ${e}${s}`,new et.ERR_OUT_OF_RANGE("value",a,n)}Pr(r,i,o)}function nt(n,t){if(typeof n!="number")throw new et.ERR_INVALID_ARG_TYPE(t,"number",n)}function ht(n,t,e){throw Math.floor(n)!==n?(nt(n,e),new et.ERR_OUT_OF_RANGE(e||"offset","an integer",n)):t<0?new et.ERR_BUFFER_OUT_OF_BOUNDS:new et.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,n)}var Or=/[^+/0-9A-Za-z-_]/g;function Ur(n){if(n=n.split("=")[0],n=n.trim().replace(Or,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Dt(n,t){t=t||1/0;let e,r=n.length,i=null,o=[];for(let s=0;s<r;++s){if(e=n.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Dr(n){let t=[];for(let e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Lr(n,t){let e,r,i,o=[];for(let s=0;s<n.length&&!((t-=2)<0);++s)e=n.charCodeAt(s),r=e>>8,i=e%256,o.push(i),o.push(r);return o}function $e(n){return Pt.toByteArray(Ur(n))}function gt(n,t,e,r){let i;for(i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function z(n,t){return n instanceof t||n!=null&&n.constructor!=null&&n.constructor.name!=null&&n.constructor.name===t.name}function Gt(n){return n!==n}var vr=(function(){let n="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let r=e*16;for(let i=0;i<16;++i)t[r+i]=n[e]+n[i]}return t})();function X(n){return typeof BigInt>"u"?Nr:n}function Nr(){throw new Error("BigInt not supported")}});var Fe,M=sr(()=>{"use strict";Fe=hr(Ae(),1);globalThis.Buffer=Fe.Buffer});M();M();M();var Gr=Object.defineProperty,zr=(n,t,e)=>t in n?Gr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Te=(n,t,e)=>(zr(n,typeof t!="symbol"?t+"":t,e),e),ot=class n{constructor(t,e){Te(this,"nodes",[]),Te(this,"edges",[]),t&&(this.nodes=t),e&&(this.edges=e)}addNode(t){if(this.nodes.find(e=>e.id===t.id))throw new Error("A node with the same ID already exists in this.nodes");this.nodes.push(t)}addEdge(t){if(this.edges.find(e=>e.id===t.id))throw new Error("An edge with the same ID already exists in this.edges");this.edges.push(t)}getNode(t){return this.nodes.find(e=>e.id===t)}getEdge(t){return this.edges.find(e=>e.id===t)}getNodes(){return this.nodes}getEdges(){return this.edges}removeNode(t){this.nodes=this.nodes.filter(e=>e.id!==t),this.edges=this.edges.filter(e=>e.fromNode!==t&&e.toNode!==t)}removeEdge(t){this.edges=this.edges.filter(e=>e.id!==t)}toString(){return JSON.stringify({nodes:this.nodes,edges:this.edges})}static fromString(t){let e=JSON.parse(t);return new n(e.nodes,e.edges)}};M();M();function zt(n,t,e){if(n&&n.length){let[r,i]=t,o=Math.PI/180*e,s=Math.cos(o),a=Math.sin(o);for(let c of n){let[l,h]=c;c[0]=(l-r)*s-(h-i)*a+r,c[1]=(l-r)*a+(h-i)*s+i}}}function Wr(n,t){return n[0]===t[0]&&n[1]===t[1]}function Hr(n,t,e,r=1){let i=e,o=Math.max(t,.1),s=n[0]&&n[0][0]&&typeof n[0][0]=="number"?[n]:n,a=[0,0];if(i)for(let l of s)zt(l,a,i);let c=(function(l,h,u){let f=[];for(let w of l){let b=[...w];Wr(b[0],b[b.length-1])||b.push([b[0][0],b[0][1]]),b.length>2&&f.push(b)}let p=[];h=Math.max(h,.1);let g=[];for(let w of f)for(let b=0;b<w.length-1;b++){let B=w[b],I=w[b+1];if(B[1]!==I[1]){let E=Math.min(B[1],I[1]);g.push({ymin:E,ymax:Math.max(B[1],I[1]),x:E===B[1]?B[0]:I[0],islope:(I[0]-B[0])/(I[1]-B[1])})}}if(g.sort(((w,b)=>w.ymin<b.ymin?-1:w.ymin>b.ymin?1:w.x<b.x?-1:w.x>b.x?1:w.ymax===b.ymax?0:(w.ymax-b.ymax)/Math.abs(w.ymax-b.ymax))),!g.length)return p;let m=[],y=g[0].ymin,x=0;for(;m.length||g.length;){if(g.length){let w=-1;for(let b=0;b<g.length&&!(g[b].ymin>y);b++)w=b;g.splice(0,w+1).forEach((b=>{m.push({s:y,edge:b})}))}if(m=m.filter((w=>!(w.edge.ymax<=y))),m.sort(((w,b)=>w.edge.x===b.edge.x?0:(w.edge.x-b.edge.x)/Math.abs(w.edge.x-b.edge.x))),(u!==1||x%h==0)&&m.length>1)for(let w=0;w<m.length;w+=2){let b=w+1;if(b>=m.length)break;let B=m[w].edge,I=m[b].edge;p.push([[Math.round(B.x),y],[Math.round(I.x),y]])}y+=u,m.forEach((w=>{w.edge.x=w.edge.x+u*w.edge.islope})),x++}return p})(s,o,r);if(i){for(let l of s)zt(l,a,-i);(function(l,h,u){let f=[];l.forEach((p=>f.push(...p))),zt(f,h,u)})(c,a,-i)}return c}function ft(n,t){var e;let r=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=4*t.strokeWidth),i=Math.round(Math.max(i,.1));let o=1;return t.roughness>=1&&(((e=t.randomizer)===null||e===void 0?void 0:e.next())||Math.random())>.7&&(o=i),Hr(n,i,r,o||1)}var lt=class{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){let r=ft(t,e);return{type:"fillSketch",ops:this.renderLines(r,e)}}renderLines(t,e){let r=[];for(let i of t)r.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],e));return r}};function Bt(n){let t=n[0],e=n[1];return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}var Xt=class extends lt{fillPolygons(t,e){let r=e.hachureGap;r<0&&(r=4*e.strokeWidth),r=Math.max(r,.1);let i=ft(t,Object.assign({},e,{hachureGap:r})),o=Math.PI/180*e.hachureAngle,s=[],a=.5*r*Math.cos(o),c=.5*r*Math.sin(o);for(let[l,h]of i)Bt([l,h])&&s.push([[l[0]-a,l[1]+c],[...h]],[[l[0]+a,l[1]-c],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,e)}}},Yt=class extends lt{fillPolygons(t,e){let r=this._fillPolygons(t,e),i=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),o=this._fillPolygons(t,i);return r.ops=r.ops.concat(o.ops),r}},jt=class{constructor(t){this.helper=t}fillPolygons(t,e){let r=ft(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(r,e)}dotsOnLines(t,e){let r=[],i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);let o=e.fillWeight;o<0&&(o=e.strokeWidth/2);let s=i/4;for(let a of t){let c=Bt(a),l=c/i,h=Math.ceil(l)-1,u=c-h*i,f=(a[0][0]+a[1][0])/2-i/4,p=Math.min(a[0][1],a[1][1]);for(let g=0;g<h;g++){let m=p+u+g*i,y=f-s+2*Math.random()*s,x=m-s+2*Math.random()*s,w=this.helper.ellipse(y,x,o,o,e);r.push(...w.ops)}}return{type:"fillSketch",ops:r}}},Zt=class{constructor(t){this.helper=t}fillPolygons(t,e){let r=ft(t,e);return{type:"fillSketch",ops:this.dashedLine(r,e)}}dashedLine(t,e){let r=e.dashOffset<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashOffset,i=e.dashGap<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashGap,o=[];return t.forEach((s=>{let a=Bt(s),c=Math.floor(a/(r+i)),l=(a+i-c*(r+i))/2,h=s[0],u=s[1];h[0]>u[0]&&(h=s[1],u=s[0]);let f=Math.atan((u[1]-h[1])/(u[0]-h[0]));for(let p=0;p<c;p++){let g=p*(r+i),m=g+r,y=[h[0]+g*Math.cos(f)+l*Math.cos(f),h[1]+g*Math.sin(f)+l*Math.sin(f)],x=[h[0]+m*Math.cos(f)+l*Math.cos(f),h[1]+m*Math.sin(f)+l*Math.sin(f)];o.push(...this.helper.doubleLineOps(y[0],y[1],x[0],x[1],e))}})),o}},Jt=class{constructor(t){this.helper=t}fillPolygons(t,e){let r=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,i=e.zigzagOffset<0?r:e.zigzagOffset,o=ft(t,e=Object.assign({},e,{hachureGap:r+i}));return{type:"fillSketch",ops:this.zigzagLines(o,i,e)}}zigzagLines(t,e,r){let i=[];return t.forEach((o=>{let s=Bt(o),a=Math.round(s/(2*e)),c=o[0],l=o[1];c[0]>l[0]&&(c=o[1],l=o[0]);let h=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let u=0;u<a;u++){let f=2*u*e,p=2*(u+1)*e,g=Math.sqrt(2*Math.pow(e,2)),m=[c[0]+f*Math.cos(h),c[1]+f*Math.sin(h)],y=[c[0]+p*Math.cos(h),c[1]+p*Math.sin(h)],x=[m[0]+g*Math.cos(h+Math.PI/4),m[1]+g*Math.sin(h+Math.PI/4)];i.push(...this.helper.doubleLineOps(m[0],m[1],x[0],x[1],r),...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],r))}})),i}},R={},Qt=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},qr=0,Wt=1,Ce=2,mt={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Ht(n,t){return n.type===t}function ie(n){let t=[],e=(function(s){let a=new Array;for(;s!=="";)if(s.match(/^([ \t\r\n,]+)/))s=s.substr(RegExp.$1.length);else if(s.match(/^([aAcChHlLmMqQsStTvVzZ])/))a[a.length]={type:qr,text:RegExp.$1},s=s.substr(RegExp.$1.length);else{if(!s.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];a[a.length]={type:Wt,text:`${parseFloat(RegExp.$1)}`},s=s.substr(RegExp.$1.length)}return a[a.length]={type:Ce,text:""},a})(n),r="BOD",i=0,o=e[i];for(;!Ht(o,Ce);){let s=0,a=[];if(r==="BOD"){if(o.text!=="M"&&o.text!=="m")return ie("M0,0"+n);i++,s=mt[o.text],r=o.text}else Ht(o,Wt)?s=mt[r]:(i++,s=mt[o.text],r=o.text);if(!(i+s<e.length))throw new Error("Path data ended short");for(let c=i;c<i+s;c++){let l=e[c];if(!Ht(l,Wt))throw new Error("Param not a number: "+r+","+l.text);a[a.length]=+l.text}if(typeof mt[r]!="number")throw new Error("Bad segment: "+r);{let c={key:r,data:a};t.push(c),i+=s,o=e[i],r==="M"&&(r="L"),r==="m"&&(r="l")}}return t}function ve(n){let t=0,e=0,r=0,i=0,o=[];for(let{key:s,data:a}of n)switch(s){case"M":o.push({key:"M",data:[...a]}),[t,e]=a,[r,i]=a;break;case"m":t+=a[0],e+=a[1],o.push({key:"M",data:[t,e]}),r=t,i=e;break;case"L":o.push({key:"L",data:[...a]}),[t,e]=a;break;case"l":t+=a[0],e+=a[1],o.push({key:"L",data:[t,e]});break;case"C":o.push({key:"C",data:[...a]}),t=a[4],e=a[5];break;case"c":{let c=a.map(((l,h)=>h%2?l+e:l+t));o.push({key:"C",data:c}),t=c[4],e=c[5];break}case"Q":o.push({key:"Q",data:[...a]}),t=a[2],e=a[3];break;case"q":{let c=a.map(((l,h)=>h%2?l+e:l+t));o.push({key:"Q",data:c}),t=c[2],e=c[3];break}case"A":o.push({key:"A",data:[...a]}),t=a[5],e=a[6];break;case"a":t+=a[5],e+=a[6],o.push({key:"A",data:[a[0],a[1],a[2],a[3],a[4],t,e]});break;case"H":o.push({key:"H",data:[...a]}),t=a[0];break;case"h":t+=a[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...a]}),e=a[0];break;case"v":e+=a[0],o.push({key:"V",data:[e]});break;case"S":o.push({key:"S",data:[...a]}),t=a[2],e=a[3];break;case"s":{let c=a.map(((l,h)=>h%2?l+e:l+t));o.push({key:"S",data:c}),t=c[2],e=c[3];break}case"T":o.push({key:"T",data:[...a]}),t=a[0],e=a[1];break;case"t":t+=a[0],e+=a[1],o.push({key:"T",data:[t,e]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=r,e=i}return o}function Ne(n){let t=[],e="",r=0,i=0,o=0,s=0,a=0,c=0;for(let{key:l,data:h}of n){switch(l){case"M":t.push({key:"M",data:[...h]}),[r,i]=h,[o,s]=h;break;case"C":t.push({key:"C",data:[...h]}),r=h[4],i=h[5],a=h[2],c=h[3];break;case"L":t.push({key:"L",data:[...h]}),[r,i]=h;break;case"H":r=h[0],t.push({key:"L",data:[r,i]});break;case"V":i=h[0],t.push({key:"L",data:[r,i]});break;case"S":{let u=0,f=0;e==="C"||e==="S"?(u=r+(r-a),f=i+(i-c)):(u=r,f=i),t.push({key:"C",data:[u,f,...h]}),a=h[0],c=h[1],r=h[2],i=h[3];break}case"T":{let[u,f]=h,p=0,g=0;e==="Q"||e==="T"?(p=r+(r-a),g=i+(i-c)):(p=r,g=i);let m=r+2*(p-r)/3,y=i+2*(g-i)/3,x=u+2*(p-u)/3,w=f+2*(g-f)/3;t.push({key:"C",data:[m,y,x,w,u,f]}),a=p,c=g,r=u,i=f;break}case"Q":{let[u,f,p,g]=h,m=r+2*(u-r)/3,y=i+2*(f-i)/3,x=p+2*(u-p)/3,w=g+2*(f-g)/3;t.push({key:"C",data:[m,y,x,w,p,g]}),a=u,c=f,r=p,i=g;break}case"A":{let u=Math.abs(h[0]),f=Math.abs(h[1]),p=h[2],g=h[3],m=h[4],y=h[5],x=h[6];u===0||f===0?(t.push({key:"C",data:[r,i,y,x,y,x]}),r=y,i=x):(r!==y||i!==x)&&(Ge(r,i,y,x,u,f,p,g,m).forEach((function(w){t.push({key:"C",data:w})})),r=y,i=x);break}case"Z":t.push({key:"Z",data:[]}),r=o,i=s}e=l}return t}function ct(n,t,e){return[n*Math.cos(e)-t*Math.sin(e),n*Math.sin(e)+t*Math.cos(e)]}function Ge(n,t,e,r,i,o,s,a,c,l){let h=(u=s,Math.PI*u/180);var u;let f=[],p=0,g=0,m=0,y=0;if(l)[p,g,m,y]=l;else{[n,t]=ct(n,t,-h),[e,r]=ct(e,r,-h);let $=(n-e)/2,S=(t-r)/2,U=$*$/(i*i)+S*S/(o*o);U>1&&(U=Math.sqrt(U),i*=U,o*=U);let W=i*i,tt=o*o,Ke=W*tt-W*S*S-tt*$*$,tr=W*S*S+tt*$*$,se=(a===c?-1:1)*Math.sqrt(Math.abs(Ke/tr));m=se*i*S/o+(n+e)/2,y=se*-o*$/i+(t+r)/2,p=Math.asin(parseFloat(((t-y)/o).toFixed(9))),g=Math.asin(parseFloat(((r-y)/o).toFixed(9))),n<m&&(p=Math.PI-p),e<m&&(g=Math.PI-g),p<0&&(p=2*Math.PI+p),g<0&&(g=2*Math.PI+g),c&&p>g&&(p-=2*Math.PI),!c&&g>p&&(g-=2*Math.PI)}let x=g-p;if(Math.abs(x)>120*Math.PI/180){let $=g,S=e,U=r;g=c&&g>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=Ge(e=m+i*Math.cos(g),r=y+o*Math.sin(g),S,U,i,o,s,0,c,[g,$,m,y])}x=g-p;let w=Math.cos(p),b=Math.sin(p),B=Math.cos(g),I=Math.sin(g),E=Math.tan(x/4),_=4/3*i*E,A=4/3*o*E,P=[n,t],T=[n+_*b,t-A*w],L=[e+_*I,r-A*B],v=[e,r];if(T[0]=2*P[0]-T[0],T[1]=2*P[1]-T[1],l)return[T,L,v].concat(f);{f=[T,L,v].concat(f);let $=[];for(let S=0;S<f.length;S+=3){let U=ct(f[S][0],f[S][1],h),W=ct(f[S+1][0],f[S+1][1],h),tt=ct(f[S+2][0],f[S+2][1],h);$.push([U[0],U[1],W[0],W[1],tt[0],tt[1]])}return $}}var Vr={randOffset:function(n,t){return k(n,t)},randOffsetWithRange:function(n,t,e){return kt(n,t,e)},ellipse:function(n,t,e,r,i){let o=We(e,r,i);return Kt(n,t,i,o).opset},doubleLineOps:function(n,t,e,r,i){return Y(n,t,e,r,i,!0)}};function ze(n,t,e,r,i){return{type:"path",ops:Y(n,t,e,r,i)}}function xt(n,t,e){let r=(n||[]).length;if(r>2){let i=[];for(let o=0;o<r-1;o++)i.push(...Y(n[o][0],n[o][1],n[o+1][0],n[o+1][1],e));return t&&i.push(...Y(n[r-1][0],n[r-1][1],n[0][0],n[0][1],e)),{type:"path",ops:i}}return r===2?ze(n[0][0],n[0][1],n[1][0],n[1][1],e):{type:"path",ops:[]}}function Xr(n,t,e,r,i){return(function(o,s){return xt(o,!0,s)})([[n,t],[n+e,t],[n+e,t+r],[n,t+r]],i)}function Re(n,t){if(n.length){let e=typeof n[0][0]=="number"?[n]:n,r=yt(e[0],1*(1+.2*t.roughness),t),i=t.disableMultiStroke?[]:yt(e[0],1.5*(1+.22*t.roughness),Oe(t));for(let o=1;o<e.length;o++){let s=e[o];if(s.length){let a=yt(s,1*(1+.2*t.roughness),t),c=t.disableMultiStroke?[]:yt(s,1.5*(1+.22*t.roughness),Oe(t));for(let l of a)l.op!=="move"&&r.push(l);for(let l of c)l.op!=="move"&&i.push(l)}}return{type:"path",ops:r.concat(i)}}return{type:"path",ops:[]}}function We(n,t,e){let r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(n/2,2)+Math.pow(t/2,2))/2)),i=Math.ceil(Math.max(e.curveStepCount,e.curveStepCount/Math.sqrt(200)*r)),o=2*Math.PI/i,s=Math.abs(n/2),a=Math.abs(t/2),c=1-e.curveFitting;return s+=k(s*c,e),a+=k(a*c,e),{increment:o,rx:s,ry:a}}function Kt(n,t,e,r){let[i,o]=Ue(r.increment,n,t,r.rx,r.ry,1,r.increment*kt(.1,kt(.4,1,e),e),e),s=Et(i,null,e);if(!e.disableMultiStroke&&e.roughness!==0){let[a]=Ue(r.increment,n,t,r.rx,r.ry,1.5,0,e),c=Et(a,null,e);s=s.concat(c)}return{estimatedPoints:o,opset:{type:"path",ops:s}}}function _e(n,t,e,r,i,o,s,a,c){let l=n,h=t,u=Math.abs(e/2),f=Math.abs(r/2);u+=k(.01*u,c),f+=k(.01*f,c);let p=i,g=o;for(;p<0;)p+=2*Math.PI,g+=2*Math.PI;g-p>2*Math.PI&&(p=0,g=2*Math.PI);let m=2*Math.PI/c.curveStepCount,y=Math.min(m/2,(g-p)/2),x=De(y,l,h,u,f,p,g,1,c);if(!c.disableMultiStroke){let w=De(y,l,h,u,f,p,g,1.5,c);x.push(...w)}return s&&(a?x.push(...Y(l,h,l+u*Math.cos(p),h+f*Math.sin(p),c),...Y(l,h,l+u*Math.cos(g),h+f*Math.sin(g),c)):x.push({op:"lineTo",data:[l,h]},{op:"lineTo",data:[l+u*Math.cos(p),h+f*Math.sin(p)]})),{type:"path",ops:x}}function Pe(n,t){let e=Ne(ve(ie(n))),r=[],i=[0,0],o=[0,0];for(let{key:s,data:a}of e)switch(s){case"M":o=[a[0],a[1]],i=[a[0],a[1]];break;case"L":r.push(...Y(o[0],o[1],a[0],a[1],t)),o=[a[0],a[1]];break;case"C":{let[c,l,h,u,f,p]=a;r.push(...Yr(c,l,h,u,f,p,o,t)),o=[f,p];break}case"Z":r.push(...Y(o[0],o[1],i[0],i[1],t)),o=[i[0],i[1]]}return{type:"path",ops:r}}function qt(n,t){let e=[];for(let r of n)if(r.length){let i=t.maxRandomnessOffset||0,o=r.length;if(o>2){e.push({op:"move",data:[r[0][0]+k(i,t),r[0][1]+k(i,t)]});for(let s=1;s<o;s++)e.push({op:"lineTo",data:[r[s][0]+k(i,t),r[s][1]+k(i,t)]})}}return{type:"fillPath",ops:e}}function st(n,t){return(function(e,r){let i=e.fillStyle||"hachure";if(!R[i])switch(i){case"zigzag":R[i]||(R[i]=new Xt(r));break;case"cross-hatch":R[i]||(R[i]=new Yt(r));break;case"dots":R[i]||(R[i]=new jt(r));break;case"dashed":R[i]||(R[i]=new Zt(r));break;case"zigzag-line":R[i]||(R[i]=new Jt(r));break;default:i="hachure",R[i]||(R[i]=new lt(r))}return R[i]})(t,Vr).fillPolygons(n,t)}function Oe(n){let t=Object.assign({},n);return t.randomizer=void 0,n.seed&&(t.seed=n.seed+1),t}function He(n){return n.randomizer||(n.randomizer=new Qt(n.seed||0)),n.randomizer.next()}function kt(n,t,e,r=1){return e.roughness*r*(He(e)*(t-n)+n)}function k(n,t,e=1){return kt(-n,n,t,e)}function Y(n,t,e,r,i,o=!1){let s=o?i.disableMultiStrokeFill:i.disableMultiStroke,a=te(n,t,e,r,i,!0,!1);if(s)return a;let c=te(n,t,e,r,i,!0,!0);return a.concat(c)}function te(n,t,e,r,i,o,s){let a=Math.pow(n-e,2)+Math.pow(t-r,2),c=Math.sqrt(a),l=1;l=c<200?1:c>500?.4:-.0016668*c+1.233334;let h=i.maxRandomnessOffset||0;h*h*100>a&&(h=c/10);let u=h/2,f=.2+.2*He(i),p=i.bowing*i.maxRandomnessOffset*(r-t)/200,g=i.bowing*i.maxRandomnessOffset*(n-e)/200;p=k(p,i,l),g=k(g,i,l);let m=[],y=()=>k(u,i,l),x=()=>k(h,i,l),w=i.preserveVertices;return o&&(s?m.push({op:"move",data:[n+(w?0:y()),t+(w?0:y())]}):m.push({op:"move",data:[n+(w?0:k(h,i,l)),t+(w?0:k(h,i,l))]})),s?m.push({op:"bcurveTo",data:[p+n+(e-n)*f+y(),g+t+(r-t)*f+y(),p+n+2*(e-n)*f+y(),g+t+2*(r-t)*f+y(),e+(w?0:y()),r+(w?0:y())]}):m.push({op:"bcurveTo",data:[p+n+(e-n)*f+x(),g+t+(r-t)*f+x(),p+n+2*(e-n)*f+x(),g+t+2*(r-t)*f+x(),e+(w?0:x()),r+(w?0:x())]}),m}function yt(n,t,e){if(!n.length)return[];let r=[];r.push([n[0][0]+k(t,e),n[0][1]+k(t,e)]),r.push([n[0][0]+k(t,e),n[0][1]+k(t,e)]);for(let i=1;i<n.length;i++)r.push([n[i][0]+k(t,e),n[i][1]+k(t,e)]),i===n.length-1&&r.push([n[i][0]+k(t,e),n[i][1]+k(t,e)]);return Et(r,null,e)}function Et(n,t,e){let r=n.length,i=[];if(r>3){let o=[],s=1-e.curveTightness;i.push({op:"move",data:[n[1][0],n[1][1]]});for(let a=1;a+2<r;a++){let c=n[a];o[0]=[c[0],c[1]],o[1]=[c[0]+(s*n[a+1][0]-s*n[a-1][0])/6,c[1]+(s*n[a+1][1]-s*n[a-1][1])/6],o[2]=[n[a+1][0]+(s*n[a][0]-s*n[a+2][0])/6,n[a+1][1]+(s*n[a][1]-s*n[a+2][1])/6],o[3]=[n[a+1][0],n[a+1][1]],i.push({op:"bcurveTo",data:[o[1][0],o[1][1],o[2][0],o[2][1],o[3][0],o[3][1]]})}if(t&&t.length===2){let a=e.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+k(a,e),t[1]+k(a,e)]})}}else r===3?(i.push({op:"move",data:[n[1][0],n[1][1]]}),i.push({op:"bcurveTo",data:[n[1][0],n[1][1],n[2][0],n[2][1],n[2][0],n[2][1]]})):r===2&&i.push(...te(n[0][0],n[0][1],n[1][0],n[1][1],e,!0,!0));return i}function Ue(n,t,e,r,i,o,s,a){let c=[],l=[];if(a.roughness===0){n/=4,l.push([t+r*Math.cos(-n),e+i*Math.sin(-n)]);for(let h=0;h<=2*Math.PI;h+=n){let u=[t+r*Math.cos(h),e+i*Math.sin(h)];c.push(u),l.push(u)}l.push([t+r*Math.cos(0),e+i*Math.sin(0)]),l.push([t+r*Math.cos(n),e+i*Math.sin(n)])}else{let h=k(.5,a)-Math.PI/2;l.push([k(o,a)+t+.9*r*Math.cos(h-n),k(o,a)+e+.9*i*Math.sin(h-n)]);let u=2*Math.PI+h-.01;for(let f=h;f<u;f+=n){let p=[k(o,a)+t+r*Math.cos(f),k(o,a)+e+i*Math.sin(f)];c.push(p),l.push(p)}l.push([k(o,a)+t+r*Math.cos(h+2*Math.PI+.5*s),k(o,a)+e+i*Math.sin(h+2*Math.PI+.5*s)]),l.push([k(o,a)+t+.98*r*Math.cos(h+s),k(o,a)+e+.98*i*Math.sin(h+s)]),l.push([k(o,a)+t+.9*r*Math.cos(h+.5*s),k(o,a)+e+.9*i*Math.sin(h+.5*s)])}return[l,c]}function De(n,t,e,r,i,o,s,a,c){let l=o+k(.1,c),h=[];h.push([k(a,c)+t+.9*r*Math.cos(l-n),k(a,c)+e+.9*i*Math.sin(l-n)]);for(let u=l;u<=s;u+=n)h.push([k(a,c)+t+r*Math.cos(u),k(a,c)+e+i*Math.sin(u)]);return h.push([t+r*Math.cos(s),e+i*Math.sin(s)]),h.push([t+r*Math.cos(s),e+i*Math.sin(s)]),Et(h,null,c)}function Yr(n,t,e,r,i,o,s,a){let c=[],l=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3],h=[0,0],u=a.disableMultiStroke?1:2,f=a.preserveVertices;for(let p=0;p<u;p++)p===0?c.push({op:"move",data:[s[0],s[1]]}):c.push({op:"move",data:[s[0]+(f?0:k(l[0],a)),s[1]+(f?0:k(l[0],a))]}),h=f?[i,o]:[i+k(l[p],a),o+k(l[p],a)],c.push({op:"bcurveTo",data:[n+k(l[p],a),t+k(l[p],a),e+k(l[p],a),r+k(l[p],a),h[0],h[1]]});return c}function ut(n){return[...n]}function Le(n,t=0){let e=n.length;if(e<3)throw new Error("A curve must have at least three points.");let r=[];if(e===3)r.push(ut(n[0]),ut(n[1]),ut(n[2]),ut(n[2]));else{let i=[];i.push(n[0],n[0]);for(let a=1;a<n.length;a++)i.push(n[a]),a===n.length-1&&i.push(n[a]);let o=[],s=1-t;r.push(ut(i[0]));for(let a=1;a+2<i.length;a++){let c=i[a];o[0]=[c[0],c[1]],o[1]=[c[0]+(s*i[a+1][0]-s*i[a-1][0])/6,c[1]+(s*i[a+1][1]-s*i[a-1][1])/6],o[2]=[i[a+1][0]+(s*i[a][0]-s*i[a+2][0])/6,i[a+1][1]+(s*i[a][1]-s*i[a+2][1])/6],o[3]=[i[a+1][0],i[a+1][1]],r.push(o[1],o[2],o[3])}}return r}function bt(n,t){return Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2)}function jr(n,t,e){let r=bt(t,e);if(r===0)return bt(n,t);let i=((n[0]-t[0])*(e[0]-t[0])+(n[1]-t[1])*(e[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),bt(n,K(t,e,i))}function K(n,t,e){return[n[0]+(t[0]-n[0])*e,n[1]+(t[1]-n[1])*e]}function ee(n,t,e,r){let i=r||[];if((function(a,c){let l=a[c+0],h=a[c+1],u=a[c+2],f=a[c+3],p=3*h[0]-2*l[0]-f[0];p*=p;let g=3*h[1]-2*l[1]-f[1];g*=g;let m=3*u[0]-2*f[0]-l[0];m*=m;let y=3*u[1]-2*f[1]-l[1];return y*=y,p<m&&(p=m),g<y&&(g=y),p+g})(n,t)<e){let a=n[t+0];i.length?(o=i[i.length-1],s=a,Math.sqrt(bt(o,s))>1&&i.push(a)):i.push(a),i.push(n[t+3])}else{let c=n[t+0],l=n[t+1],h=n[t+2],u=n[t+3],f=K(c,l,.5),p=K(l,h,.5),g=K(h,u,.5),m=K(f,p,.5),y=K(p,g,.5),x=K(m,y,.5);ee([c,f,m,x],0,e,i),ee([x,y,g,u],0,e,i)}var o,s;return i}function Zr(n,t){return Mt(n,0,n.length,t)}function Mt(n,t,e,r,i){let o=i||[],s=n[t],a=n[e-1],c=0,l=1;for(let h=t+1;h<e-1;++h){let u=jr(n[h],s,a);u>c&&(c=u,l=h)}return Math.sqrt(c)>r?(Mt(n,t,l+1,r,o),Mt(n,l,e,r,o)):(o.length||o.push(s),o.push(a)),o}function Vt(n,t=.15,e){let r=[],i=(n.length-1)/3;for(let o=0;o<i;o++)ee(n,3*o,t,r);return e&&e>0?Mt(r,0,r.length,e):r}var O="none",at=class{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,e,r){return{shape:t,sets:e||[],options:r||this.defaultOptions}}line(t,e,r,i,o){let s=this._o(o);return this._d("line",[ze(t,e,r,i,s)],s)}rectangle(t,e,r,i,o){let s=this._o(o),a=[],c=Xr(t,e,r,i,s);if(s.fill){let l=[[t,e],[t+r,e],[t+r,e+i],[t,e+i]];s.fillStyle==="solid"?a.push(qt([l],s)):a.push(st([l],s))}return s.stroke!==O&&a.push(c),this._d("rectangle",a,s)}ellipse(t,e,r,i,o){let s=this._o(o),a=[],c=We(r,i,s),l=Kt(t,e,s,c);if(s.fill)if(s.fillStyle==="solid"){let h=Kt(t,e,s,c).opset;h.type="fillPath",a.push(h)}else a.push(st([l.estimatedPoints],s));return s.stroke!==O&&a.push(l.opset),this._d("ellipse",a,s)}circle(t,e,r,i){let o=this.ellipse(t,e,r,r,i);return o.shape="circle",o}linearPath(t,e){let r=this._o(e);return this._d("linearPath",[xt(t,!1,r)],r)}arc(t,e,r,i,o,s,a=!1,c){let l=this._o(c),h=[],u=_e(t,e,r,i,o,s,a,!0,l);if(a&&l.fill)if(l.fillStyle==="solid"){let f=Object.assign({},l);f.disableMultiStroke=!0;let p=_e(t,e,r,i,o,s,!0,!1,f);p.type="fillPath",h.push(p)}else h.push((function(f,p,g,m,y,x,w){let b=f,B=p,I=Math.abs(g/2),E=Math.abs(m/2);I+=k(.01*I,w),E+=k(.01*E,w);let _=y,A=x;for(;_<0;)_+=2*Math.PI,A+=2*Math.PI;A-_>2*Math.PI&&(_=0,A=2*Math.PI);let P=(A-_)/w.curveStepCount,T=[];for(let L=_;L<=A;L+=P)T.push([b+I*Math.cos(L),B+E*Math.sin(L)]);return T.push([b+I*Math.cos(A),B+E*Math.sin(A)]),T.push([b,B]),st([T],w)})(t,e,r,i,o,s,l));return l.stroke!==O&&h.push(u),this._d("arc",h,l)}curve(t,e){let r=this._o(e),i=[],o=Re(t,r);if(r.fill&&r.fill!==O)if(r.fillStyle==="solid"){let s=Re(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{let s=[],a=t;if(a.length){let c=typeof a[0][0]=="number"?[a]:a;for(let l of c)l.length<3?s.push(...l):l.length===3?s.push(...Vt(Le([l[0],l[0],l[1],l[2]]),10,(1+r.roughness)/2)):s.push(...Vt(Le(l),10,(1+r.roughness)/2))}s.length&&i.push(st([s],r))}return r.stroke!==O&&i.push(o),this._d("curve",i,r)}polygon(t,e){let r=this._o(e),i=[],o=xt(t,!0,r);return r.fill&&(r.fillStyle==="solid"?i.push(qt([t],r)):i.push(st([t],r))),r.stroke!==O&&i.push(o),this._d("polygon",i,r)}path(t,e){let r=this._o(e),i=[];if(!t)return this._d("path",i,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let o=r.fill&&r.fill!=="transparent"&&r.fill!==O,s=r.stroke!==O,a=!!(r.simplification&&r.simplification<1),c=(function(h,u,f){let p=Ne(ve(ie(h))),g=[],m=[],y=[0,0],x=[],w=()=>{x.length>=4&&m.push(...Vt(x,u)),x=[]},b=()=>{w(),m.length&&(g.push(m),m=[])};for(let{key:I,data:E}of p)switch(I){case"M":b(),y=[E[0],E[1]],m.push(y);break;case"L":w(),m.push([E[0],E[1]]);break;case"C":if(!x.length){let _=m.length?m[m.length-1]:y;x.push([_[0],_[1]])}x.push([E[0],E[1]]),x.push([E[2],E[3]]),x.push([E[4],E[5]]);break;case"Z":w(),m.push([y[0],y[1]])}if(b(),!f)return g;let B=[];for(let I of g){let E=Zr(I,f);E.length&&B.push(E)}return B})(t,1,a?4-4*(r.simplification||1):(1+r.roughness)/2),l=Pe(t,r);if(o)if(r.fillStyle==="solid")if(c.length===1){let h=Pe(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else i.push(qt(c,r));else i.push(st(c,r));return s&&(a?c.forEach((h=>{i.push(xt(h,!1,r))})):i.push(l)),this._d("path",i,r)}opsToPath(t,e){let r="";for(let i of t.ops){let o=typeof e=="number"&&e>=0?i.data.map((s=>+s.toFixed(e))):i.data;switch(i.op){case"move":r+=`M${o[0]} ${o[1]} `;break;case"bcurveTo":r+=`C${o[0]} ${o[1]}, ${o[2]} ${o[3]}, ${o[4]} ${o[5]} `;break;case"lineTo":r+=`L${o[0]} ${o[1]} `}}return r.trim()}toPaths(t){let e=t.sets||[],r=t.options||this.defaultOptions,i=[];for(let o of e){let s=null;switch(o.type){case"path":s={d:this.opsToPath(o),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:O};break;case"fillPath":s={d:this.opsToPath(o),stroke:O,strokeWidth:0,fill:r.fill||O};break;case"fillSketch":s=this.fillSketch(o,r)}s&&i.push(s)}return i}fillSketch(t,e){let r=e.fillWeight;return r<0&&(r=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||O,strokeWidth:r,fill:O}}_mergedShape(t){return t.filter(((e,r)=>r===0||e.op!=="move"))}},re=class{constructor(t,e){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new at(e)}draw(t){let e=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.ctx,o=t.options.fixedDecimalPlaceDigits;for(let s of e)switch(s.type){case"path":i.save(),i.strokeStyle=r.stroke==="none"?"transparent":r.stroke,i.lineWidth=r.strokeWidth,r.strokeLineDash&&i.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(i.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(i,s,o),i.restore();break;case"fillPath":{i.save(),i.fillStyle=r.fill||"";let a=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,s,o,a),i.restore();break}case"fillSketch":this.fillSketch(i,s,r)}}fillSketch(t,e,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=i,this._drawToContext(t,e,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,e,r,i="nonzero"){t.beginPath();for(let o of e.ops){let s=typeof r=="number"&&r>=0?o.data.map((a=>+a.toFixed(r))):o.data;switch(o.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1])}}e.type==="fillPath"?t.fill(i):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,e,r,i,o){let s=this.gen.line(t,e,r,i,o);return this.draw(s),s}rectangle(t,e,r,i,o){let s=this.gen.rectangle(t,e,r,i,o);return this.draw(s),s}ellipse(t,e,r,i,o){let s=this.gen.ellipse(t,e,r,i,o);return this.draw(s),s}circle(t,e,r,i){let o=this.gen.circle(t,e,r,i);return this.draw(o),o}linearPath(t,e){let r=this.gen.linearPath(t,e);return this.draw(r),r}polygon(t,e){let r=this.gen.polygon(t,e);return this.draw(r),r}arc(t,e,r,i,o,s,a=!1,c){let l=this.gen.arc(t,e,r,i,o,s,a,c);return this.draw(l),l}curve(t,e){let r=this.gen.curve(t,e);return this.draw(r),r}path(t,e){let r=this.gen.path(t,e);return this.draw(r),r}},wt="http://www.w3.org/2000/svg",ne=class{constructor(t,e){this.svg=t,this.gen=new at(e)}draw(t){let e=t.sets||[],r=t.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,o=i.createElementNS(wt,"g"),s=t.options.fixedDecimalPlaceDigits;for(let a of e){let c=null;switch(a.type){case"path":c=i.createElementNS(wt,"path"),c.setAttribute("d",this.opsToPath(a,s)),c.setAttribute("stroke",r.stroke),c.setAttribute("stroke-width",r.strokeWidth+""),c.setAttribute("fill","none"),r.strokeLineDash&&c.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&c.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break;case"fillPath":c=i.createElementNS(wt,"path"),c.setAttribute("d",this.opsToPath(a,s)),c.setAttribute("stroke","none"),c.setAttribute("stroke-width","0"),c.setAttribute("fill",r.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||c.setAttribute("fill-rule","evenodd");break;case"fillSketch":c=this.fillSketch(i,a,r)}c&&o.appendChild(c)}return o}fillSketch(t,e,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);let o=t.createElementNS(wt,"path");return o.setAttribute("d",this.opsToPath(e,r.fixedDecimalPlaceDigits)),o.setAttribute("stroke",r.fill||""),o.setAttribute("stroke-width",i+""),o.setAttribute("fill","none"),r.fillLineDash&&o.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&o.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,e){return this.gen.opsToPath(t,e)}line(t,e,r,i,o){let s=this.gen.line(t,e,r,i,o);return this.draw(s)}rectangle(t,e,r,i,o){let s=this.gen.rectangle(t,e,r,i,o);return this.draw(s)}ellipse(t,e,r,i,o){let s=this.gen.ellipse(t,e,r,i,o);return this.draw(s)}circle(t,e,r,i){let o=this.gen.circle(t,e,r,i);return this.draw(o)}linearPath(t,e){let r=this.gen.linearPath(t,e);return this.draw(r)}polygon(t,e){let r=this.gen.polygon(t,e);return this.draw(r)}arc(t,e,r,i,o,s,a=!1,c){let l=this.gen.arc(t,e,r,i,o,s,a,c);return this.draw(l)}curve(t,e){let r=this.gen.curve(t,e);return this.draw(r)}path(t,e){let r=this.gen.path(t,e);return this.draw(r)}},qe={canvas:(n,t)=>new re(n,t),svg:(n,t)=>new ne(n,t),generator:n=>new at(n),newSeed:()=>at.newSeed()};var Jr={roughness:.5,bowing:.5,fillStyle:"hachure",fillWeight:.5,hachureGap:4,defaultBorderColor:"#333"};function St(n,t={}){let e={...Jr,...t},r={roughness:e.roughness,bowing:e.bowing},i=document.createElement("div");i.style.cssText="position: absolute; left: -9999px; top: -9999px;",i.innerHTML=n,document.body.appendChild(i);let o=i.querySelector("svg");if(!o)return document.body.removeChild(i),n;let s=qe.svg(o),a=u=>{let f=u.getAttribute("stroke");if(f&&f!=="none")return f;let p=window.getComputedStyle(u).stroke;return p&&p!=="none"&&p!==""?p:null},c=u=>{let f=u.getAttribute("fill");if(f&&f!=="none")return f;let p=window.getComputedStyle(u).fill;return p&&p!=="none"&&p!==""?p:null},l=u=>{u.setAttribute("stroke","none"),u.style.stroke="none"},h=u=>{let f=u.parentElement;for(;f;){let p=f.tagName.toLowerCase();if(p==="defs"||p==="marker")return!0;f=f.parentElement}return!1};return o.querySelectorAll("rect").forEach(u=>{if(h(u))return;let f=a(u),p=c(u);if(!f&&!p)return;let g=parseFloat(u.getAttribute("x")||"0"),m=parseFloat(u.getAttribute("y")||"0"),y=parseFloat(u.getAttribute("width")||"0"),x=parseFloat(u.getAttribute("height")||"0");if(y<=0||x<=0)return;let w=f||e.defaultBorderColor,b=s.rectangle(g,m,y,x,{...r,stroke:w,fill:p||"none",fillStyle:e.fillStyle,fillWeight:e.fillWeight,hachureGap:e.hachureGap});u.parentNode?.insertBefore(b,u),u.remove()}),o.querySelectorAll("circle").forEach(u=>{if(h(u))return;let f=a(u),p=c(u);if(!f&&!p)return;let g=parseFloat(u.getAttribute("cx")||"0"),m=parseFloat(u.getAttribute("cy")||"0"),y=parseFloat(u.getAttribute("r")||"0");if(y<=0)return;let x=f||e.defaultBorderColor,w=s.circle(g,m,y*2,{...r,stroke:x,fill:p||"none",fillStyle:e.fillStyle,fillWeight:e.fillWeight,hachureGap:e.hachureGap});u.parentNode?.insertBefore(w,u),u.remove()}),o.querySelectorAll("ellipse").forEach(u=>{if(h(u))return;let f=a(u),p=c(u);if(!f&&!p)return;let g=parseFloat(u.getAttribute("cx")||"0"),m=parseFloat(u.getAttribute("cy")||"0"),y=parseFloat(u.getAttribute("rx")||"0"),x=parseFloat(u.getAttribute("ry")||"0");if(y<=0||x<=0)return;let w=f||e.defaultBorderColor,b=s.ellipse(g,m,y*2,x*2,{...r,stroke:w,fill:p||"none",fillStyle:e.fillStyle,fillWeight:e.fillWeight,hachureGap:e.hachureGap});u.parentNode?.insertBefore(b,u),u.remove()}),o.querySelectorAll("polygon").forEach(u=>{if(h(u))return;let f=a(u),p=c(u);if(!f&&!p)return;let m=(u.getAttribute("points")||"").trim().split(/\s+/).map(w=>{let[b,B]=w.split(",").map(Number);return[b,B]});if(m.length<3)return;let y=f||e.defaultBorderColor,x=s.polygon(m,{...r,stroke:y,fill:p||"none",fillStyle:e.fillStyle,fillWeight:e.fillWeight,hachureGap:e.hachureGap});u.parentNode?.insertBefore(x,u),u.remove()}),o.querySelectorAll("line").forEach(u=>{if(h(u))return;let f=a(u);if(!f)return;let p=parseFloat(u.getAttribute("x1")||"0"),g=parseFloat(u.getAttribute("y1")||"0"),m=parseFloat(u.getAttribute("x2")||"0"),y=parseFloat(u.getAttribute("y2")||"0"),x=s.line(p,g,m,y,{...r,stroke:f}),w=u.getAttribute("marker-end"),b=u.getAttribute("marker-start");w||b?(l(u),u.parentNode?.insertBefore(x,u)):u.parentNode?.replaceChild(x,u)}),o.querySelectorAll("path").forEach(u=>{if(h(u))return;let f=a(u),p=c(u),g=u.getAttribute("d");if(!f||!g||p&&p!=="rgb(0, 0, 0)")return;let m=s.path(g,{...r,stroke:f,fill:"none"}),y=u.getAttribute("marker-end"),x=u.getAttribute("marker-start");y||x?(l(u),u.parentNode?.insertBefore(m,u)):u.parentNode?.replaceChild(m,u)}),document.body.removeChild(i),new XMLSerializer().serializeToString(o)}M();M();var It=class{constructor(t){this._initialized=!1;this.type=t}createContainer(){let t=document.createElement("div");return t.id="render-container-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),t.style.cssText="position: absolute; left: -9999px; top: -9999px;",document.body.appendChild(t),t}removeContainer(t){t&&t.parentNode&&t.parentNode.removeChild(t)}async initialize(t=null){this._initialized=!0}isInitialized(){return this._initialized}async render(t,e){throw new Error("render() must be implemented by subclass")}async mountToDom(t,e,r){let i=await this.render(t,e);if(!i||!i.base64){let s=document.createElement("div");return s.textContent=`Renderer returned empty result: ${this.type}`,r.appendChild(s),{root:s,cleanup:()=>{try{s.remove()}catch{}}}}let o=document.createElement("img");return o.style.maxWidth="100%",o.style.height="auto",o.alt=`${this.type} diagram`,o.src=`data:image/${i.format};base64,${i.base64}`,r.appendChild(o),{root:o,cleanup:()=>{try{o.remove()}catch{}}}}validateInput(t){if(!t||typeof t=="string"&&t.trim()==="")throw new Error(`Empty ${this.type} input provided`)}preprocessInput(t){return t}calculateCanvasScale(t){let r=t?.fontSize||12;return 14/16*(r/12)*4}async renderSvgToCanvas(t,e,r,i=null){return t=t.replace(/<style>/,"<style>foreignObject { overflow: visible; }"),new Promise((o,s)=>{let a=new Image;a.crossOrigin="Anonymous";let c=btoa(unescape(encodeURIComponent(t)));a.src=`data:image/svg+xml;base64,${c}`,a.onload=()=>{let l=document.createElement("canvas");l.width=e,l.height=r;let h=l.getContext("2d");i&&(h.font=`14px ${i}`),h.drawImage(a,0,0,e,r),o(l)},a.onerror=l=>{s(new Error("Failed to load SVG into image for rendering"))}})}};M();function Qr(n){let t=n.match(/^(#{1,6})\s+(.+)$/);return t?{level:t[1].length,content:t[2]}:null}function j(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ve(n){let t=[],e=0,r="",i=()=>{r&&(t.push({type:"text",content:r}),r="")};for(;e<n.length;){if(n[e]==="`"){let o=n.indexOf("`",e+1);if(o!==-1){i(),t.push({type:"code",content:n.slice(e+1,o)}),e=o+1;continue}}if(n.slice(e,e+2)==="~~"){let o=n.indexOf("~~",e+2);if(o!==-1){i(),t.push({type:"strikethrough",content:n.slice(e+2,o)}),e=o+2;continue}}if(n.slice(e,e+2)==="**"){let o=n.indexOf("**",e+2);if(o!==-1){i(),t.push({type:"bold",content:n.slice(e+2,o)}),e=o+2;continue}}if(n.slice(e,e+2)==="__"){let o=n.indexOf("__",e+2);if(o!==-1){i(),t.push({type:"bold",content:n.slice(e+2,o)}),e=o+2;continue}}if(n[e]==="*"&&n[e+1]!=="*"){let o=Xe(n,"*",e+1);if(o!==-1){i(),t.push({type:"italic",content:n.slice(e+1,o)}),e=o+1;continue}}if(n[e]==="_"&&n[e+1]!=="_"){let o=Xe(n,"_",e+1);if(o!==-1){i(),t.push({type:"italic",content:n.slice(e+1,o)}),e=o+1;continue}}if(n[e]==="["){let o=n.indexOf("]",e+1);if(o!==-1&&n[o+1]==="("){let s=n.indexOf(")",o+2);if(s!==-1){i();let a=n.slice(e+1,o),c=n.slice(o+2,s);t.push({type:"link",content:a,url:c}),e=s+1;continue}}}r+=n[e],e++}return i(),t}function Xe(n,t,e){for(let r=e;r<n.length;r++)if(n[r]===t&&n[r-1]!==t&&n[r+1]!==t)return r;return-1}function Ye(n){return n.map(t=>{switch(t.type){case"text":return j(t.content);case"bold":return`<strong>${j(t.content)}</strong>`;case"italic":return`<em>${j(t.content)}</em>`;case"code":return`<code style="background: rgba(0,0,0,0.06); padding: 1px 4px; border-radius: 3px; font-family: monospace;">${j(t.content)}</code>`;case"strikethrough":return`<del>${j(t.content)}</del>`;case"link":return`<a href="${j(t.url||"")}" style="color: #0066cc; text-decoration: underline;">${j(t.content)}</a>`;default:return j(t.content)}}).join("")}function je(n){return n.split(`
2
+ `).map(r=>{let i=Qr(r);if(i){let s=Ve(i.content),a=Ye(s);return`<h${i.level} style="margin:0">${a}</h${i.level}>`}let o=Ve(r);return Ye(o)}).join("<br/>")}function Ze(n){return/[*_`~\[#]/.test(n)}var $t={1:{fill:"rgba(255, 145, 145, 0.25)",stroke:"#e76f6f"},2:{fill:"rgba(255, 190, 130, 0.25)",stroke:"#d9a05b"},3:{fill:"rgba(240, 230, 140, 0.25)",stroke:"#c9b95f"},4:{fill:"rgba(130, 200, 140, 0.25)",stroke:"#6faf7a"},5:{fill:"rgba(140, 210, 210, 0.25)",stroke:"#6fb5b5"},6:{fill:"rgba(190, 160, 240, 0.25)",stroke:"#9f8fcc"}},Kr="rgba(255, 255, 255, 0.9)",tn="#666666",en="#aaaaaa",rn="rgba(200, 200, 200, 0.2)",nn="#aaaaaa",At=40,Z=8,q=7,V=6,oe=14,Je=12,on=1.4,Ft=class extends It{constructor(){super("canvas");this.roughOptions={roughness:.5,bowing:.5}}async initialize(e=null){this._initialized=!0}calculateBounds(e){let r=1/0,i=1/0,o=-1/0,s=-1/0;for(let l of e)r=Math.min(r,l.x),i=Math.min(i,l.y),o=Math.max(o,l.x+l.width),s=Math.max(s,l.y+l.height);e.length===0&&(r=i=0,o=s=100);let a=o-r+At*2,c=s-i+At*2;return{minX:r,minY:i,maxX:o,maxY:s,width:a,height:c,offsetX:-r+At,offsetY:-i+At}}getNodeColors(e){return e?$t[e]?$t[e]:{fill:e+"33",stroke:e}:{fill:Kr,stroke:tn}}getEdgeColor(e){return e?$t[e]?$t[e].stroke:e:en}escapeXml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}wrapText(e,r,i){let o=i*.6,s=Math.floor(r/o),a=[],c=e.split(`
3
+ `);for(let l of c)if(l.length<=s)a.push(l);else{let h=l.split(" "),u="";for(let f of h)(u+" "+f).trim().length<=s?u=(u+" "+f).trim():(u&&a.push(u),u=f);u&&a.push(u)}return a}renderTextNode(e,r,i,o){let s=e.x+r,a=e.y+i,{fill:c,stroke:l}=this.getNodeColors(e.color),h=`<rect x="${s}" y="${a}" width="${e.width}" height="${e.height}" rx="${Z}" ry="${Z}" fill="${c}" stroke="${l}" stroke-width="2"/>`;if(e.text){let f=e.width-20,p=e.height-20,g=Ze(e.text)?je(e.text):this.escapeXml(e.text).replace(/\n/g,"<br/>");h+=`<foreignObject x="${s+10}" y="${a+10}" width="${f}" height="${p}">`,h+=`<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: ${o}; font-size: ${oe}px; color: #333333; line-height: ${on}; overflow: hidden; word-wrap: break-word; white-space: pre-wrap;">${g}</div>`,h+="</foreignObject>"}return h}renderFileNode(e,r,i,o){let s=e.x+r,a=e.y+i,{fill:c,stroke:l}=this.getNodeColors(e.color),h=`<rect x="${s}" y="${a}" width="${e.width}" height="${e.height}" rx="${Z}" ry="${Z}" fill="${c}" stroke="${l}" stroke-width="2"/>`,u=s+10,f=a+e.height/2-10;h+=`<path d="M${u} ${f}h12v16h-16v-12l4-4z" fill="none" stroke="#666" stroke-width="1.5"/>`;let p=e.file||"file",g=s+35,m=a+e.height/2+5;return h+=`<text x="${g}" y="${m}" font-family="${o}" font-size="${oe}" fill="#333333">${this.escapeXml(p)}</text>`,h}renderLinkNode(e,r,i,o){let s=e.x+r,a=e.y+i,{fill:c,stroke:l}=this.getNodeColors(e.color),h=`<rect x="${s}" y="${a}" width="${e.width}" height="${e.height}" rx="${Z}" ry="${Z}" fill="${c}" stroke="${l}" stroke-width="2"/>`,u=s+15,f=a+e.height/2;h+=`<circle cx="${u}" cy="${f}" r="8" fill="none" stroke="#0066cc" stroke-width="1.5"/>`,h+=`<path d="M${u-3} ${f}h6m-3 -3v6" stroke="#0066cc" stroke-width="1.5"/>`;let p=e.url||"link",g=s+35,m=a+e.height/2+5,y=p.length>40?p.substring(0,37)+"...":p;return h+=`<text x="${g}" y="${m}" font-family="${o}" font-size="${oe}" fill="#0066cc">${this.escapeXml(y)}</text>`,h}renderGroupNode(e,r,i,o){let s=e.x+r,a=e.y+i,c=rn,l=nn;if(e.color){let u=this.getNodeColors(e.color);c=u.fill,l=u.stroke}let h=`<rect x="${s}" y="${a}" width="${e.width}" height="${e.height}" rx="${Z}" ry="${Z}" fill="${c}" stroke="${l}" stroke-width="2" stroke-dasharray="8,4"/>`;if(e.label){let u=s+10,f=a-8;h+=`<text x="${u}" y="${f}" font-family="${o}" font-size="${Je}" font-weight="bold" fill="#666666">${this.escapeXml(e.label)}</text>`}return h}getConnectionPoint(e,r,i,o){let s=e.x+i,a=e.y+o;switch(r){case"top":return{x:s+e.width/2,y:a};case"bottom":return{x:s+e.width/2,y:a+e.height};case"left":return{x:s,y:a+e.height/2};case"right":default:return{x:s+e.width,y:a+e.height/2}}}getArrowMarker(e,r){return`<marker id="${e}" markerWidth="${q}" markerHeight="${V}" refX="${q}" refY="${V/2}" orient="auto">
4
+ <polygon points="0 0, ${q} ${V/2}, 0 ${V}" fill="${r}"/>
5
+ </marker>`}getArrowMarkerStart(e,r){return`<marker id="${e}" markerWidth="${q}" markerHeight="${V}" refX="0" refY="${V/2}" orient="auto">
6
+ <polygon points="${q} 0, 0 ${V/2}, ${q} ${V}" fill="${r}"/>
7
+ </marker>`}getSideDirection(e){switch(e){case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1};case"left":return{x:-1,y:0};case"right":default:return{x:1,y:0}}}renderEdge(e,r,i,o,s){let a=r.get(e.fromNode),c=r.get(e.toNode);if(!a||!c)return"";let l=this.getConnectionPoint(a,e.fromSide,i,o),h=this.getConnectionPoint(c,e.toSide,i,o),u=this.getEdgeColor(e.color),f=`arrow-${e.id}`,p=this.getSideDirection(e.fromSide),g=this.getSideDirection(e.toSide),m=Math.abs(h.x-l.x),y=Math.abs(h.y-l.y),x=Math.max(m,y),w=Math.sqrt(m*m+y*y),b="",B=e.toEnd==="arrow"||e.toEnd===void 0,I=e.fromEnd==="arrow",E=(B?1:0)+(I?1:0);if(w<30){let A=1;if(E>0){let U=E>=2?.4:.6,W=w*U;W<q&&(A=W/q)}let P=`${f}-scaled`,T=B?`marker-end="url(#${P})"`:"",L=I?`marker-start="url(#${P}-start)"`:"",v=q*A,$=V*A,S="";B&&(S+=`<defs><marker id="${P}" markerWidth="${v}" markerHeight="${$}" refX="${v}" refY="${$/2}" orient="auto" markerUnits="userSpaceOnUse">
8
+ <polygon points="0 0, ${v} ${$/2}, 0 ${$}" fill="${u}"/>
9
+ </marker></defs>`),I&&(S+=`<defs><marker id="${P}-start" markerWidth="${v}" markerHeight="${$}" refX="0" refY="${$/2}" orient="auto" markerUnits="userSpaceOnUse">
10
+ <polygon points="${v} 0, 0 ${$/2}, ${v} ${$}" fill="${u}"/>
11
+ </marker></defs>`),b+=S,b+=`<line x1="${l.x}" y1="${l.y}" x2="${h.x}" y2="${h.y}" stroke="${u}" stroke-width="2" ${T} ${L}/>`}else{let A=Math.max(80,x*.5),P=l.x+p.x*A,T=l.y+p.y*A,L=h.x+g.x*A,v=h.y+g.y*A,$=e.toEnd==="arrow"||e.toEnd===void 0?`marker-end="url(#${f})"`:"",S=e.fromEnd==="arrow"?`marker-start="url(#${f}-start)"`:"";b+=`<path d="M${l.x},${l.y} C${P},${T} ${L},${v} ${h.x},${h.y}" fill="none" stroke="${u}" stroke-width="2" ${$} ${S}/>`}if(e.label){let A=(l.x+h.x)/2,P=(l.y+h.y)/2-8;b+=`<text x="${A}" y="${P}" font-family="${s}" font-size="${Je}" fill="${u}" text-anchor="middle">${this.escapeXml(e.label)}</text>`}return b}generateSvg(e,r){let i=e.getNodes(),o=e.getEdges(),s=this.calculateBounds(i),a=new Map;for(let h of i)a.set(h.id,h);let c=[...i].sort((h,u)=>h.type==="group"&&u.type!=="group"?-1:h.type!=="group"&&u.type==="group"?1:0),l=`<svg xmlns="http://www.w3.org/2000/svg" width="${s.width}" height="${s.height}" viewBox="0 0 ${s.width} ${s.height}">`;l+="<defs>";for(let h of o){let u=this.getEdgeColor(h.color);(h.toEnd==="arrow"||h.toEnd===void 0)&&(l+=this.getArrowMarker(`arrow-${h.id}`,u)),h.fromEnd==="arrow"&&(l+=this.getArrowMarkerStart(`arrow-${h.id}-start`,u))}l+="</defs>";for(let h of o)l+=this.renderEdge(h,a,s.offsetX,s.offsetY,r);for(let h of c)switch(h.type){case"text":l+=this.renderTextNode(h,s.offsetX,s.offsetY,r);break;case"file":l+=this.renderFileNode(h,s.offsetX,s.offsetY,r);break;case"link":l+=this.renderLinkNode(h,s.offsetX,s.offsetY,r);break;case"group":l+=this.renderGroupNode(h,s.offsetX,s.offsetY,r);break;default:l+=this.renderTextNode(h,s.offsetX,s.offsetY,r)}return l+="</svg>",l}async render(e,r){this._initialized||await this.initialize(r),this.validateInput(e);let i;try{i=ot.fromString(e)}catch(w){throw new Error(`Invalid JSON Canvas format: ${w instanceof Error?w.message:String(w)}`)}let o=r?.fontFamily||"'SimSun', 'Times New Roman', Times, serif",s=this.generateSvg(i,o);r?.diagramStyle==="handDrawn"&&(s=St(s,this.roughOptions));let h=new DOMParser().parseFromString(s,"image/svg+xml").documentElement,u,f,p=h.getAttribute("viewBox");if(p){let w=p.split(/\s+/);u=Math.ceil(parseFloat(w[2])),f=Math.ceil(parseFloat(w[3]))}else u=Math.ceil(parseFloat(h.getAttribute("width")||"800")),f=Math.ceil(parseFloat(h.getAttribute("height")||"600"));let g=this.calculateCanvasScale(r),m=await this.renderSvgToCanvas(s,u*g,f*g);return{base64:m.toDataURL("image/png",1).replace(/^data:image\/png;base64,/,""),width:m.width,height:m.height,format:"png"}}};var Tt=class extends Ft{async mountToDom(t,e,r){if(this._initialized||await this.initialize(e),typeof t!="string")throw new Error("JSON Canvas input must be a string");let i=t;this.validateInput(i);let o;try{o=ot.fromString(i)}catch(h){throw new Error(`Invalid JSON Canvas format: ${h instanceof Error?h.message:String(h)}`)}let s=e?.fontFamily||"'SimSun', 'Times New Roman', Times, serif",a=this.generateSvg(o,s);return e?.diagramStyle==="handDrawn"&&(a=St(a,this.roughOptions)),r.innerHTML=a,{root:r.querySelector("svg")||r,cleanup:()=>{try{r.innerHTML=""}catch{}}}}};M();function sn(){return globalThis}function an(){let n=sn();return n.__md2x_renderer_registry__||(n.__md2x_renderer_registry__=new Map),n.__md2x_renderer_registry__}function Qe(n){an().set(n.type,n)}Qe(new Tt);})();
12
+ /*! Bundled license information:
13
+
14
+ ieee754/index.js:
15
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
16
+
17
+ buffer/index.js:
18
+ (*!
19
+ * The buffer module from node.js, for the browser.
20
+ *
21
+ * @author Feross Aboukhadijeh <https://feross.org>
22
+ * @license MIT
23
+ *)
24
+ */
@@ -0,0 +1,14 @@
1
+ "use strict";(()=>{var _e=Object.create;var X=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var be=(t,e)=>()=>(t&&(e=t(t=0)),e);var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Le=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ce(e))!Me.call(t,i)&&i!==r&&X(t,i,{get:()=>e[i],enumerable:!(n=Te(e,i))||n.enumerable});return t};var De=(t,e,r)=>(r=t!=null?_e(Se(t)):{},Le(e||!t||!t.__esModule?X(r,"default",{value:t,enumerable:!0}):r,t));var Q=$(L=>{"use strict";d();L.byteLength=ke;L.toByteArray=$e;L.fromByteArray=qe;var x=[],g=[],Ne=typeof Uint8Array<"u"?Uint8Array:Array,H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(I=0,J=H.length;I<J;++I)x[I]=H[I],g[H.charCodeAt(I)]=I;var I,J;g[45]=62;g[95]=63;function Z(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function ke(t){var e=Z(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Pe(t,e,r){return(e+r)*3/4-r}function $e(t){var e,r=Z(t),n=r[0],i=r[1],o=new Ne(Pe(t,n,i)),u=0,c=i>0?n-4:n,a;for(a=0;a<c;a+=4)e=g[t.charCodeAt(a)]<<18|g[t.charCodeAt(a+1)]<<12|g[t.charCodeAt(a+2)]<<6|g[t.charCodeAt(a+3)],o[u++]=e>>16&255,o[u++]=e>>8&255,o[u++]=e&255;return i===2&&(e=g[t.charCodeAt(a)]<<2|g[t.charCodeAt(a+1)]>>4,o[u++]=e&255),i===1&&(e=g[t.charCodeAt(a)]<<10|g[t.charCodeAt(a+1)]<<4|g[t.charCodeAt(a+2)]>>2,o[u++]=e>>8&255,o[u++]=e&255),o}function He(t){return x[t>>18&63]+x[t>>12&63]+x[t>>6&63]+x[t&63]}function Oe(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(He(n));return i.join("")}function qe(t){for(var e,r=t.length,n=r%3,i=[],o=16383,u=0,c=r-n;u<c;u+=o)i.push(Oe(t,u,u+o>c?c:u+o));return n===1?(e=t[r-1],i.push(x[e>>2]+x[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(x[e>>10]+x[e>>4&63]+x[e<<2&63]+"=")),i.join("")}});var v=$(O=>{d();O.read=function(t,e,r,n,i){var o,u,c=i*8-n-1,a=(1<<c)-1,l=a>>1,h=-7,f=r?i-1:0,w=r?-1:1,m=t[e+f];for(f+=w,o=m&(1<<-h)-1,m>>=-h,h+=c;h>0;o=o*256+t[e+f],f+=w,h-=8);for(u=o&(1<<-h)-1,o>>=-h,h+=n;h>0;u=u*256+t[e+f],f+=w,h-=8);if(o===0)o=1-l;else{if(o===a)return u?NaN:(m?-1:1)*(1/0);u=u+Math.pow(2,n),o=o-l}return(m?-1:1)*u*Math.pow(2,o-n)};O.write=function(t,e,r,n,i,o){var u,c,a,l=o*8-i-1,h=(1<<l)-1,f=h>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,A=n?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,u=h):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),u+f>=1?e+=w/a:e+=w*Math.pow(2,1-f),e*a>=2&&(u++,a/=2),u+f>=h?(c=0,u=h):u+f>=1?(c=(e*a-1)*Math.pow(2,i),u=u+f):(c=e*Math.pow(2,f-1)*Math.pow(2,i),u=0));i>=8;t[r+m]=c&255,m+=A,c/=256,i-=8);for(u=u<<i|c,l+=i;l>0;t[r+m]=u&255,m+=A,u/=256,l-=8);t[r+m-A]|=P*128}});var me=$(S=>{"use strict";d();var q=Q(),T=v(),ee=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;S.Buffer=s;S.SlowBuffer=Ke;S.INSPECT_MAX_BYTES=50;var D=2147483647;S.kMaxLength=D;s.TYPED_ARRAY_SUPPORT=Ge();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ge(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function B(t){if(t>D)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return j(t)}return ie(t,e,r)}s.poolSize=8192;function ie(t,e,r){if(typeof t=="string")return Ye(t,e);if(ArrayBuffer.isView(t))return je(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(E(t,ArrayBuffer)||t&&E(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(E(t,SharedArrayBuffer)||t&&E(t.buffer,SharedArrayBuffer)))return W(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return s.from(n,e,r);let i=ze(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}s.from=function(t,e,r){return ie(t,e,r)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function oe(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function We(t,e,r){return oe(t),t<=0?B(t):e!==void 0?typeof r=="string"?B(t).fill(e,r):B(t).fill(e):B(t)}s.alloc=function(t,e,r){return We(t,e,r)};function j(t){return oe(t),B(t<0?0:z(t)|0)}s.allocUnsafe=function(t){return j(t)};s.allocUnsafeSlow=function(t){return j(t)};function Ye(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ue(t,e)|0,n=B(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function G(t){let e=t.length<0?0:z(t.length)|0,r=B(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function je(t){if(E(t,Uint8Array)){let e=new Uint8Array(t);return W(e.buffer,e.byteOffset,e.byteLength)}return G(t)}function W(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function ze(t){if(s.isBuffer(t)){let e=z(t.length)|0,r=B(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||V(t.length)?B(0):G(t);if(t.type==="Buffer"&&Array.isArray(t.data))return G(t.data)}function z(t){if(t>=D)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D.toString(16)+" bytes");return t|0}function Ke(t){return+t!=t&&(t=0),s.alloc(+t)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype};s.compare=function(e,r){if(E(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),E(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(e)||!s.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let o=0,u=Math.min(n,i);o<u;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=s.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){let u=e[n];if(E(u,Uint8Array))o+u.length>i.length?(s.isBuffer(u)||(u=s.from(u)),u.copy(i,o)):Uint8Array.prototype.set.call(i,u,o);else if(s.isBuffer(u))u.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=u.length}return i};function ue(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||E(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ye(t).length;default:if(i)return n?-1:Y(t).length;e=(""+e).toLowerCase(),i=!0}}s.byteLength=ue;function Ve(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return ir(this,e,r);case"utf8":case"utf-8":return ce(this,e,r);case"ascii":return tr(this,e,r);case"latin1":case"binary":return nr(this,e,r);case"base64":return er(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return or(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function F(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}s.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)F(this,r,r+1);return this};s.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)F(this,r,r+3),F(this,r+1,r+2);return this};s.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)F(this,r,r+7),F(this,r+1,r+6),F(this,r+2,r+5),F(this,r+3,r+4);return this};s.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ce(this,0,e):Ve.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.inspect=function(){let e="",r=S.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};ee&&(s.prototype[ee]=s.prototype.inspect);s.prototype.compare=function(e,r,n,i,o){if(E(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let u=o-i,c=n-r,a=Math.min(u,c),l=this.slice(i,o),h=e.slice(r,n);for(let f=0;f<a;++f)if(l[f]!==h[f]){u=l[f],c=h[f];break}return u<c?-1:c<u?1:0};function se(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,V(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:re(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):re(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function re(t,e,r,n,i){let o=1,u=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,u/=2,c/=2,r/=2}function a(h,f){return o===1?h[f]:h.readUInt16BE(f*o)}let l;if(i){let h=-1;for(l=r;l<u;l++)if(a(t,l)===a(e,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===c)return h*o}else h!==-1&&(l-=l-h),h=-1}else for(r+c>u&&(r=u-c),l=r;l>=0;l--){let h=!0;for(let f=0;f<c;f++)if(a(t,l+f)!==a(e,f)){h=!1;break}if(h)return l}return-1}s.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};s.prototype.indexOf=function(e,r,n){return se(this,e,r,n,!0)};s.prototype.lastIndexOf=function(e,r,n){return se(this,e,r,n,!1)};function Xe(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let u;for(u=0;u<n;++u){let c=parseInt(e.substr(u*2,2),16);if(V(c))return u;t[r+u]=c}return u}function Je(t,e,r,n){return N(Y(e,t.length-r),t,r,n)}function Ze(t,e,r,n){return N(ar(e),t,r,n)}function Qe(t,e,r,n){return N(ye(e),t,r,n)}function ve(t,e,r,n){return N(fr(e,t.length-r),t,r,n)}s.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let u=!1;for(;;)switch(i){case"hex":return Xe(this,e,r,n);case"utf8":case"utf-8":return Je(this,e,r,n);case"ascii":case"latin1":case"binary":return Ze(this,e,r,n);case"base64":return Qe(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ve(this,e,r,n);default:if(u)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),u=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function er(t,e,r){return e===0&&r===t.length?q.fromByteArray(t):q.fromByteArray(t.slice(e,r))}function ce(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let o=t[i],u=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){let a,l,h,f;switch(c){case 1:o<128&&(u=o);break;case 2:a=t[i+1],(a&192)===128&&(f=(o&31)<<6|a&63,f>127&&(u=f));break;case 3:a=t[i+1],l=t[i+2],(a&192)===128&&(l&192)===128&&(f=(o&15)<<12|(a&63)<<6|l&63,f>2047&&(f<55296||f>57343)&&(u=f));break;case 4:a=t[i+1],l=t[i+2],h=t[i+3],(a&192)===128&&(l&192)===128&&(h&192)===128&&(f=(o&15)<<18|(a&63)<<12|(l&63)<<6|h&63,f>65535&&f<1114112&&(u=f))}}u===null?(u=65533,c=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u),i+=c}return rr(n)}var te=4096;function rr(t){let e=t.length;if(e<=te)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=te));return r}function tr(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function nr(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function ir(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=e;o<r;++o)i+=hr[t[o]];return i}function or(t,e,r){let n=t.slice(e,r),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}s.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,s.prototype),i};function p(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||p(e,r,this.length);let i=this[e],o=1,u=0;for(;++u<r&&(o*=256);)i+=this[e+u]*o;return i};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||p(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(e,r){return e=e>>>0,r||p(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||p(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||p(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||p(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||p(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readBigUInt64LE=R(function(e){e=e>>>0,C(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&b(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});s.prototype.readBigUInt64BE=R(function(e){e=e>>>0,C(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&b(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});s.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||p(e,r,this.length);let i=this[e],o=1,u=0;for(;++u<r&&(o*=256);)i+=this[e+u]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};s.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||p(e,r,this.length);let i=r,o=1,u=this[e+--i];for(;i>0&&(o*=256);)u+=this[e+--i]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*r)),u};s.prototype.readInt8=function(e,r){return e=e>>>0,r||p(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,r){e=e>>>0,r||p(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,r){e=e>>>0,r||p(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,r){return e=e>>>0,r||p(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,r){return e=e>>>0,r||p(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readBigInt64LE=R(function(e){e=e>>>0,C(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&b(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});s.prototype.readBigInt64BE=R(function(e){e=e>>>0,C(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&b(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});s.prototype.readFloatLE=function(e,r){return e=e>>>0,r||p(e,4,this.length),T.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,r){return e=e>>>0,r||p(e,4,this.length),T.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||p(e,8,this.length),T.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||p(e,8,this.length),T.read(this,e,!1,52,8)};function y(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;y(this,e,r,n,c,0)}let o=1,u=0;for(this[r]=e&255;++u<n&&(o*=256);)this[r+u]=e/o&255;return r+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;y(this,e,r,n,c,0)}let o=n-1,u=1;for(this[r+o]=e&255;--o>=0&&(u*=256);)this[r+o]=e/u&255;return r+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,1,255,0),this[r]=e&255,r+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function ae(t,e,r,n,i){de(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o;let u=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=u,u=u>>8,t[r++]=u,u=u>>8,t[r++]=u,u=u>>8,t[r++]=u,r}function fe(t,e,r,n,i){de(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o=o>>8,t[r+6]=o,o=o>>8,t[r+5]=o,o=o>>8,t[r+4]=o;let u=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=u,u=u>>8,t[r+2]=u,u=u>>8,t[r+1]=u,u=u>>8,t[r]=u,r+8}s.prototype.writeBigUInt64LE=R(function(e,r=0){return ae(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=R(function(e,r=0){return fe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let a=Math.pow(2,8*n-1);y(this,e,r,n,a-1,-a)}let o=0,u=1,c=0;for(this[r]=e&255;++o<n&&(u*=256);)e<0&&c===0&&this[r+o-1]!==0&&(c=1),this[r+o]=(e/u>>0)-c&255;return r+n};s.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let a=Math.pow(2,8*n-1);y(this,e,r,n,a-1,-a)}let o=n-1,u=1,c=0;for(this[r+o]=e&255;--o>=0&&(u*=256);)e<0&&c===0&&this[r+o+1]!==0&&(c=1),this[r+o]=(e/u>>0)-c&255;return r+n};s.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};s.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};s.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||y(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};s.prototype.writeBigInt64LE=R(function(e,r=0){return ae(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=R(function(e,r=0){return fe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function he(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function le(t,e,r,n,i){return e=+e,r=r>>>0,i||he(t,e,r,4,34028234663852886e22,-34028234663852886e22),T.write(t,e,r,n,23,4),r+4}s.prototype.writeFloatLE=function(e,r,n){return le(this,e,r,!0,n)};s.prototype.writeFloatBE=function(e,r,n){return le(this,e,r,!1,n)};function pe(t,e,r,n,i){return e=+e,r=r>>>0,i||he(t,e,r,8,17976931348623157e292,-17976931348623157e292),T.write(t,e,r,n,52,8),r+8}s.prototype.writeDoubleLE=function(e,r,n){return pe(this,e,r,!0,n)};s.prototype.writeDoubleBE=function(e,r,n){return pe(this,e,r,!1,n)};s.prototype.copy=function(e,r,n,i){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};s.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let u=e.charCodeAt(0);(i==="utf8"&&u<128||i==="latin1")&&(e=u)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=r;o<n;++o)this[o]=e;else{let u=s.isBuffer(e)?e:s.from(e,i),c=u.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-r;++o)this[o+r]=u[o%c]}return this};var _={};function K(t,e,r){_[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);K("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);K("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=ne(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=ne(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function ne(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function ur(t,e,r){C(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&b(e,t.length-(r+1))}function de(t,e,r,n,i,o){if(t>r||t<e){let u=typeof e=="bigint"?"n":"",c;throw o>3?e===0||e===BigInt(0)?c=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:c=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:c=`>= ${e}${u} and <= ${r}${u}`,new _.ERR_OUT_OF_RANGE("value",c,t)}ur(n,i,o)}function C(t,e){if(typeof t!="number")throw new _.ERR_INVALID_ARG_TYPE(e,"number",t)}function b(t,e,r){throw Math.floor(t)!==t?(C(t,r),new _.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new _.ERR_BUFFER_OUT_OF_BOUNDS:new _.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var sr=/[^+/0-9A-Za-z-_]/g;function cr(t){if(t=t.split("=")[0],t=t.trim().replace(sr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Y(t,e){e=e||1/0;let r,n=t.length,i=null,o=[];for(let u=0;u<n;++u){if(r=t.charCodeAt(u),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(u+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function ar(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function fr(t,e){let r,n,i,o=[];for(let u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function ye(t){return q.toByteArray(cr(t))}function N(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function E(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function V(t){return t!==t}var hr=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e})();function R(t){return typeof BigInt>"u"?lr:t}function lr(){throw new Error("BigInt not supported")}});var ge,d=be(()=>{"use strict";ge=De(me(),1);globalThis.Buffer=ge.Buffer});d();d();d();function pr(){return globalThis}function we(){let t=pr();return t.__md2x_renderer_registry__||(t.__md2x_renderer_registry__=new Map),t.__md2x_renderer_registry__}function xe(t){return we().get(t)}function Ee(t){return we().has(t)}function dr(t){let e=xe(t);if(!e)throw new Error(`No renderer found for type: ${t}`);return e}var Be=null;async function Re({renderType:t,input:e,themeConfig:r,host:n}){return r&&(Be=r),await dr(t).mountToDom(e,Be,n)}function Ie(t){return Ee(t)}function Fe({canvas:t}={}){if(t&&t.getContext("2d",{willReadFrequently:!0}),typeof window<"u"){let e=window;e.mermaid&&typeof e.mermaid.initialize=="function"&&e.mermaid.initialize({startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'})}}d();var k=class{async fetchAsDataUrl(e){try{let r=await fetch(e,{mode:"cors",credentials:"omit",signal:AbortSignal.timeout(1e4)});if(!r.ok)return null;let n=await r.blob();return new Promise(i=>{let o=new FileReader;o.onloadend=()=>i(o.result),o.onerror=()=>i(null),o.readAsDataURL(n)})}catch{return null}}};var yr=null;function Ae(t){yr=t}function mr(){let t=document.querySelector("base");return t||(t=document.createElement("base"),document.head.appendChild(t)),t}function Ue(){Ae({fetch:new k}),Fe({}),window.__md2xSetBaseHref=i=>{let o=mr();o.href=i};let t=i=>{let u=(i&&i.className?String(i.className):"").match(/\blanguage-([a-z0-9-]+)\b/i);return u?u[1]:""},e=i=>{let o=String(i||"").toLowerCase();return o==="graphviz"||o==="gv"?"dot":o==="vegalite"?"vega-lite":o},r=i=>{let o=String(i||"").match(/\btype\s*:\s*['"]([a-z0-9-]+)['"]/i),u=o?String(o[1]).toLowerCase():"";return u==="vue"||u==="html"||u==="svelte"?`md2x-${u}`:"md2x"},n=(i,o)=>{let u=document.createElement("div");u.className="md2x-diagram",u.setAttribute("data-md2x-diagram-kind",o),u.style.maxWidth="100%";let c=document.createElement("div");c.className="md2x-diagram-inner",c.style.display="inline-block",c.style.maxWidth="100%";let a=document.createElement("div");return a.className="md2x-diagram-mount",a.style.maxWidth="100%",c.appendChild(a),u.appendChild(c),i.replaceWith(u),a};window.__md2xRenderDocument=async i=>{let o=i||{};try{window.__md2xLiveDone=!1}catch{}try{o.baseHref&&typeof window.__md2xSetBaseHref=="function"&&window.__md2xSetBaseHref(o.baseHref)}catch{}let u=o.rootSelector?document.querySelector(o.rootSelector):document;if(!u){try{window.__md2xLiveDone=!0}catch{}return}let c=Array.from(u.querySelectorAll("pre > code"));for(let a of c){let l=a&&a.parentElement;if(!l)continue;let h=t(a);if(!h)continue;let f=e(h);if(!Ie(f))continue;let w=a.textContent?String(a.textContent):"";if(!w.trim())continue;let m=f==="md2x"?r(w):f,A=n(l,m),P=f==="md2x"?{code:w,templateFiles:o.md2xTemplateFiles||{},cdn:o.cdn}:w;try{let U=await Re({renderType:f,input:P,themeConfig:o.themeConfig??null,host:A});try{await U.done}catch{}}catch(U){A.textContent=U&&U.message?String(U.message):String(U)}}try{document.fonts?.ready&&await document.fonts.ready}catch{}try{window.__md2xLiveDone=!0}catch{}},window.__md2xRenderReady=!0}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ue,{once:!0}):Ue();})();
2
+ /*! Bundled license information:
3
+
4
+ ieee754/index.js:
5
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
6
+
7
+ buffer/index.js:
8
+ (*!
9
+ * The buffer module from node.js, for the browser.
10
+ *
11
+ * @author Feross Aboukhadijeh <https://feross.org>
12
+ * @license MIT
13
+ *)
14
+ */