agentic-mermaid 0.5.4 → 0.5.6

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.
Files changed (133) hide show
  1. package/AGENT_NATIVE.md +5 -9
  2. package/CHANGELOG.md +66 -0
  3. package/Instructions_for_agents.md +171 -97
  4. package/README.md +1 -1
  5. package/dist/agent-core.d.ts +7 -7
  6. package/dist/agent-core.js +1 -1
  7. package/dist/agent.d.ts +9 -10
  8. package/dist/agent.js +1 -1
  9. package/dist/agentic-mermaid-mcp.js +1 -1
  10. package/dist/am.js +1 -1
  11. package/dist/browser-lazy/chunks/{agentic-producer-core-ECZ3CMZM.js → agentic-producer-core-MYYZCUJS.js} +1 -1
  12. package/dist/browser-lazy/chunks/{architecture-H5LTMKQW.js → architecture-OHEIJI33.js} +6 -6
  13. package/dist/browser-lazy/chunks/{block-566X6FNV.js → block-DMBSQUFZ.js} +6 -6
  14. package/dist/browser-lazy/chunks/{builtin-backends-VAFEZXKY.js → builtin-backends-JTN3XG37.js} +3 -3
  15. package/dist/browser-lazy/chunks/{c4-ZXFDLBFK.js → c4-TK5GVVGU.js} +3 -3
  16. package/dist/browser-lazy/chunks/{chunk-7UFOFWBA.js → chunk-2R6M4CUH.js} +1 -1
  17. package/dist/browser-lazy/chunks/{chunk-YVNJDVQO.js → chunk-3K25OV6X.js} +1 -1
  18. package/dist/browser-lazy/chunks/{chunk-QVSZOF5M.js → chunk-3QXHJBE3.js} +1 -1
  19. package/dist/browser-lazy/chunks/{chunk-IUI4DYC3.js → chunk-4G652M75.js} +1 -1
  20. package/dist/browser-lazy/chunks/{chunk-LBXXKLIR.js → chunk-4WON4RCG.js} +3 -3
  21. package/dist/browser-lazy/chunks/{chunk-V6I2VGNQ.js → chunk-5SZ2YBKG.js} +9 -9
  22. package/dist/browser-lazy/chunks/{chunk-XHU3A432.js → chunk-CJZMMNPO.js} +1 -1
  23. package/dist/browser-lazy/chunks/{chunk-5LKPDHPC.js → chunk-F4CQMYR2.js} +4 -4
  24. package/dist/browser-lazy/chunks/{chunk-G4JBA7HU.js → chunk-GK5PSUKH.js} +3 -3
  25. package/dist/browser-lazy/chunks/{chunk-VRZKI33U.js → chunk-HAMXYU5V.js} +1 -1
  26. package/dist/browser-lazy/chunks/{chunk-Z7UHFVKN.js → chunk-IFUYPCDA.js} +6 -6
  27. package/dist/browser-lazy/chunks/{chunk-3JTYTXA6.js → chunk-ILCWDEZN.js} +4 -4
  28. package/dist/browser-lazy/chunks/{chunk-64JFHCJC.js → chunk-JJFXEH35.js} +1 -1
  29. package/dist/browser-lazy/chunks/{chunk-PXTLV57R.js → chunk-KOO3MCMJ.js} +1 -1
  30. package/dist/browser-lazy/chunks/{chunk-A7V5VDKN.js → chunk-LO25KEJY.js} +1 -1
  31. package/dist/browser-lazy/chunks/{chunk-TT5GR5EJ.js → chunk-MGB5QQEH.js} +1 -1
  32. package/dist/browser-lazy/chunks/{chunk-PSZEE64O.js → chunk-NVZKY7UI.js} +8 -8
  33. package/dist/browser-lazy/chunks/{chunk-6UOOATQR.js → chunk-PA7YKMP5.js} +1 -1
  34. package/dist/browser-lazy/chunks/{chunk-NKW2ZNCD.js → chunk-PS4HSV54.js} +1 -1
  35. package/dist/browser-lazy/chunks/{chunk-OBI5U5XU.js → chunk-QG67RIGQ.js} +1 -1
  36. package/dist/browser-lazy/chunks/{chunk-J57YRC2M.js → chunk-QOIFBX26.js} +1 -1
  37. package/dist/browser-lazy/chunks/chunk-QQCKPJF3.js +1 -0
  38. package/dist/browser-lazy/chunks/{chunk-O34YYEQV.js → chunk-QXSPMZ67.js} +1 -1
  39. package/dist/browser-lazy/chunks/{chunk-4NILRBC7.js → chunk-QYORAVMZ.js} +1 -1
  40. package/dist/browser-lazy/chunks/{chunk-OFOS57WQ.js → chunk-SC7LXD2V.js} +1 -1
  41. package/dist/browser-lazy/chunks/{chunk-EIYLJ4FI.js → chunk-SZAI2WB4.js} +12 -12
  42. package/dist/browser-lazy/chunks/{chunk-37FZNMPR.js → chunk-TXYQEDUF.js} +1 -1
  43. package/dist/browser-lazy/chunks/{chunk-2JQXRKBC.js → chunk-VR6YRNUZ.js} +1 -1
  44. package/dist/browser-lazy/chunks/{chunk-7TTFBJYA.js → chunk-WNTLLJPT.js} +1 -1
  45. package/dist/browser-lazy/chunks/{chunk-62MR3LWJ.js → chunk-YYF5TS6K.js} +1 -1
  46. package/dist/browser-lazy/chunks/{class-XIFNVBFE.js → class-QOJOM2XO.js} +8 -8
  47. package/dist/browser-lazy/chunks/{er-VEUYJBGG.js → er-2W6UXQT7.js} +6 -6
  48. package/dist/browser-lazy/chunks/{eventmodeling-G7DITZX7.js → eventmodeling-IVAFIO2U.js} +9 -9
  49. package/dist/browser-lazy/chunks/{flowchart-SSFIU4EU.js → flowchart-Y6OWQ46O.js} +1 -1
  50. package/dist/browser-lazy/chunks/{gantt-HQNVDX2B.js → gantt-BXTFJPZM.js} +6 -6
  51. package/dist/browser-lazy/chunks/{gitgraph-Z5MN6M6L.js → gitgraph-PW6R75SQ.js} +4 -4
  52. package/dist/browser-lazy/chunks/{ishikawa-UEERNFQV.js → ishikawa-GFX3XQQZ.js} +2 -2
  53. package/dist/browser-lazy/chunks/{journey-3BEWWGB5.js → journey-Q3M2GVKJ.js} +7 -7
  54. package/dist/browser-lazy/chunks/{kanban-2WFNCWLB.js → kanban-WVGVXROE.js} +11 -11
  55. package/dist/browser-lazy/chunks/{mindmap-R2C6SNYR.js → mindmap-CEDNSFJ6.js} +6 -6
  56. package/dist/browser-lazy/chunks/{packet-GMVCI5YZ.js → packet-Z56OVP2O.js} +3 -3
  57. package/dist/browser-lazy/chunks/{pie-WER45DKC.js → pie-FOJURIAM.js} +7 -7
  58. package/dist/browser-lazy/chunks/{quadrant-NCUPSFKN.js → quadrant-OGUQEK5C.js} +4 -4
  59. package/dist/browser-lazy/chunks/{radar-WLYS4YC5.js → radar-XTAUIQIJ.js} +9 -9
  60. package/dist/browser-lazy/chunks/render-core-QRFSDWGQ.js +3 -0
  61. package/dist/browser-lazy/chunks/{requirement-AK3NWMJ6.js → requirement-KEJ7ILX2.js} +7 -7
  62. package/dist/browser-lazy/chunks/{sankey-C2DY6WVU.js → sankey-ODWGDRAM.js} +8 -8
  63. package/dist/browser-lazy/chunks/{sequence-D4WJB44W.js → sequence-4ZNQR7S7.js} +1 -1
  64. package/dist/browser-lazy/chunks/{state-YUQVESE7.js → state-6IWPVJ4C.js} +2 -2
  65. package/dist/browser-lazy/chunks/{timeline-BMBJJXWR.js → timeline-LPJMPVPV.js} +4 -4
  66. package/dist/browser-lazy/chunks/{treemap-B66XBZZ6.js → treemap-2KFOQZRA.js} +4 -4
  67. package/dist/browser-lazy/chunks/xychart-KIPWFNVQ.js +16 -0
  68. package/dist/browser-lazy/chunks/{zenuml-62RLYFWP.js → zenuml-2ABFLOUP.js} +6 -6
  69. package/dist/browser-lazy/index.js +1 -1
  70. package/dist/browser.global.js +436 -436
  71. package/dist/chunk-3QC3FE2X.js +4 -0
  72. package/dist/{chunk-XU5LPD2D.js → chunk-5BYN55G4.js} +1 -1
  73. package/dist/chunk-5XKELJT2.js +2 -0
  74. package/dist/chunk-7HIKKNPP.js +150 -0
  75. package/dist/chunk-A5TX2FW5.js +2 -0
  76. package/dist/chunk-AS6A6XHE.js +2 -0
  77. package/dist/{chunk-DOFB572I.js → chunk-CGCGMO4U.js} +15 -15
  78. package/dist/chunk-GO4CS5KS.js +52 -0
  79. package/dist/{chunk-KXMANAST.js → chunk-JRLCGATA.js} +47 -47
  80. package/dist/{chunk-7XYB2LNC.js → chunk-K6TYUPTW.js} +2 -2
  81. package/dist/{chunk-HINRNKPO.js → chunk-QVP364DJ.js} +2 -2
  82. package/dist/chunk-V5RFODN6.js +2 -0
  83. package/dist/cli-PVKOWT4V.js +191 -0
  84. package/dist/elk-constructor.js +1 -1
  85. package/dist/{index-Bvhprdxz.d.ts → index-Bs7imZCS.d.ts} +14 -4
  86. package/dist/index.d.ts +4 -4
  87. package/dist/index.js +1 -1
  88. package/dist/{jsonl-RPJY6YWO.js → jsonl-5N4DTV7P.js} +2 -2
  89. package/dist/mcp-cli-EPIA7DTH.js +2 -0
  90. package/dist/{paint-certification-BoLyr006.d.ts → paint-certification-aIPtFDcn.d.ts} +2 -2
  91. package/dist/server-X6OFY2ZN.js +527 -0
  92. package/dist/{svg-styles-BnCoXyYe.d.ts → svg-styles-DfHloZTH.d.ts} +1 -1
  93. package/dist/svg-styles.d.ts +1 -1
  94. package/dist/svg-styles.js +1 -1
  95. package/dist/svg.d.ts +4 -4
  96. package/dist/svg.js +1 -1
  97. package/dist/{types-CLVJCaH2.d.ts → types-DkUbM48-.d.ts} +1 -1
  98. package/dist/zenuml/chunks/{appearance-5RM5MVM2.js → appearance-ROFRJDW7.js} +1 -1
  99. package/dist/zenuml/chunks/{builtin-backends-UTNWL4N3.js → builtin-backends-LM2A6WWK.js} +2 -2
  100. package/dist/zenuml/chunks/{chunk-ZNZRIISS.js → chunk-E6ZQYSVJ.js} +2 -2
  101. package/dist/zenuml/chunks/{chunk-IARQ24W3.js → chunk-KCHXQ5UA.js} +2 -2
  102. package/dist/zenuml/chunks/{chunk-3A6S6GNB.js → chunk-TEDVLVJM.js} +1 -1
  103. package/dist/zenuml/chunks/{chunk-CNLL4BGF.js → chunk-WD3ZPN3X.js} +1 -1
  104. package/dist/zenuml/chunks/{chunk-6J4BGPB2.js → chunk-WUHZDXTF.js} +24 -24
  105. package/dist/zenuml/chunks/{chunk-55WS466K.js → chunk-ZGLUBUQJ.js} +9 -9
  106. package/dist/zenuml/chunks/{render-core-ECIWU5ZS.js → render-core-WTHYSKBN.js} +2 -2
  107. package/dist/zenuml/chunks/{zenuml-N3LZMB2G.js → zenuml-3TCHUQJZ.js} +8 -8
  108. package/dist/zenuml.d.ts +2 -2
  109. package/dist/zenuml.js +1 -1
  110. package/docs/api.md +84 -4
  111. package/docs/quality.md +6 -3
  112. package/docs/style-authoring.md +23 -0
  113. package/docs/testing-strategy.md +59 -52
  114. package/examples/styles/readme-hero.md +4 -3
  115. package/package.json +4 -4
  116. package/server.json +2 -2
  117. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +19 -154
  118. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +12 -2
  119. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +5 -1
  120. package/dist/browser-lazy/chunks/chunk-6GPDLZFQ.js +0 -1
  121. package/dist/browser-lazy/chunks/render-core-42UVWIPF.js +0 -3
  122. package/dist/browser-lazy/chunks/xychart-HAVFROGT.js +0 -16
  123. package/dist/chunk-2DNGDTJD.js +0 -2
  124. package/dist/chunk-4F2UGYTM.js +0 -4
  125. package/dist/chunk-EHJI3QYE.js +0 -52
  126. package/dist/chunk-MKE7GNYU.js +0 -146
  127. package/dist/chunk-U4MT3RRE.js +0 -2
  128. package/dist/chunk-VUFVLGTH.js +0 -2
  129. package/dist/chunk-WYIB6BUR.js +0 -2
  130. package/dist/cli-ZYIDBYNS.js +0 -226
  131. package/dist/mcp-cli-YVDCORWA.js +0 -2
  132. package/dist/server-4JGAVXR3.js +0 -524
  133. package/docs/MCP-DIRECTORY-LISTINGS.md +0 -145
@@ -1,4 +0,0 @@
1
- import{Ab as K,Bb as X,Na as I,Oa as B,Ra as M,Va as j,Xa as z,rb as H,sb as Y,ta as V,yb as q}from"./chunk-KXMANAST.js";import{$a as w,I as D,Od as W,R as v,Sa as x,Xa as L,_a as g,ob as G}from"./chunk-DOFB572I.js";import{fileURLToPath as Je}from"url";import{tmpdir as Ze}from"os";import{basename as Qe,dirname as le,join as F}from"path";import{existsSync as et,mkdtempSync as tt,rmSync as ye,writeFileSync as rt}from"fs";import{Resvg as nt}from"@resvg/resvg-js";function J(e){if(!e.includes("auto-start-reverse"))return e;const r=L(e);const t=new Set(r.map(n=>g(n,"id")).filter(Boolean));const i=new Map;const s=[];for(const n of r){if(n.name!=="marker"||g(n,"orient")!=="auto-start-reverse")continue;const c=g(n,"id");if(!c||n.selfClosing)continue;const a=e.indexOf("</marker>",n.end);if(a<0)throw new Error(`Unclosed native marker ${c}`);const f=g(n,"viewBox")?.trim().split(/[\s,]+/).map(Number);const m=Number(g(n,"markerWidth")??3);const u=Number(g(n,"markerHeight")??3);const[p,l,O,E]=f??[0,0,m,u];const S=Number(g(n,"refX")??0);const y=Number(g(n,"refY")??0);if(![p,l,O,E,S,y].every(h=>typeof h==="number"&&Number.isFinite(h))){throw new Error(`Native marker ${c} requires numeric coordinates`)}let b=`${c}-native-start`;while(t.has(b))b+="-";t.add(b);i.set(c,b);const A=p+O/2,$=l+E/2;const k={id:x(b),orient:"auto",refX:String(2*A-S),refY:String(2*$-y)};let U=w(e.slice(n.start,n.end),h=>k[h.name]);for(const h of["refX","refY"]){if(!n.attributes.some(Re=>Re.name===h))U=U.replace(/>$/,` ${h}="${k[h]}">`)}s.push({at:a+"</marker>".length,content:`
2
- ${U}<g transform="rotate(180 ${A} ${$})">${e.slice(n.end,a)}</g></marker>`})}let o=e;for(const n of s.reverse())o=o.slice(0,n.at)+n.content+o.slice(n.at);return w(o,(n,c)=>{if(c.name==="marker"&&n.name==="orient"&&n.value==="auto-start-reverse")return"auto";if(n.name!=="marker-start")return void 0;const a=/^url\(#([^)]*)\)$/.exec(g(c,"marker-start")??"")?.[1];const f=a?i.get(a):void 0;return f?`url(#${x(f)})`:void 0})}import{readdirSync as _e,readFileSync as Fe,statSync as Te}from"fs";import{join as Ae}from"path";import{decodeXML as he}from"entities";var Ee=1668112752;var Se=1953784678;var Pe=1330926671;var be=1953658213;function Oe(e){const r=new DataView(e.buffer,e.byteOffset,e.byteLength);try{if(r.getUint32(0)===Se){const i=[];for(let s=0;s<r.getUint32(8);s++)i.push(Z(r,r.getUint32(12+s*4)));return i.filter(s=>s.length>0)}const t=Z(r,0);return t.length>0?[t]:[]}catch{return[]}}function Z(e,r){const t=e.getUint32(r);if(t!==65536&&t!==Pe&&t!==be)return[];const i=e.getUint16(r+4);for(let s=0;s<i;s++){const o=r+12+s*16;if(e.getUint32(o)===Ee)return Ie(e,e.getUint32(o+8))}return[]}function Ie(e,r){const t=[];const i=e.getUint16(r+2);for(let s=0;s<i;s++){const o=r+4+s*8;const n=e.getUint16(o);const c=e.getUint16(o+2);if(!(n===0||n===3&&(c===1||c===10)))continue;const a=r+e.getUint32(o+4);const f=e.getUint16(a);if(f===4)t.push(Ue(e,a));else if(f===12)t.push(xe(e,a));else if(f===6)t.push(we(e,a));else if(f===0)t.push(Me(e,a))}return t}function Ue(e,r){const t=e.getUint16(r+6)/2;const i=r+14;const s=i+t*2+2;const o=s+t*2;const n=o+t*2;return{has(c){if(c>65535)return false;let a=0,f=t-1;while(a<f){const l=a+f>>1;if(e.getUint16(i+l*2)<c)a=l+1;else f=l}if(e.getUint16(s+a*2)>c||c===65535)return false;const m=e.getUint16(n+a*2);if(m===0)return(c+e.getInt16(o+a*2)&65535)!==0;const u=n+a*2+m+(c-e.getUint16(s+a*2))*2;if(u+2>e.byteLength)return false;const p=e.getUint16(u);return p!==0&&(p+e.getInt16(o+a*2)&65535)!==0}}}function xe(e,r){const t=e.getUint32(r+12);const i=r+16;return{has(s){let o=0,n=t-1;while(o<=n){const c=o+n>>1;const a=i+c*12;if(s<e.getUint32(a))n=c-1;else if(s>e.getUint32(a+4))o=c+1;else return e.getUint32(a+8)+s-e.getUint32(a)!==0}return false}}}function we(e,r){const t=e.getUint16(r+6);const i=e.getUint16(r+8);return{has:s=>s>=t&&s<t+i&&e.getUint16(r+10+(s-t)*2)!==0}}function Me(e,r){return{has:t=>t<256&&e.getUint8(r+6+t)!==0}}function Ne(e){let r="";for(const t of e.matchAll(/<text\b[^>]*>([\s\S]*?)<\/text>/g))r+=t[1].replace(/<[^>]*>/g,"");return he(r)}function Ce(e){return e<=32||e===127||e>=8203&&e<=8207||e===8232||e===8233||e>=65024&&e<=65039||e===65279}function Q(e){if(e>=11904&&e<=40959||e>=44032&&e<=55295||e>=63744&&e<=64255||e>=131072&&e<=262143)return"CJK";if(e>=9728&&e<=10175||e>=126976&&e<=129791)return"emoji";if(e>=1424&&e<=1535)return"Hebrew";if(e>=1536&&e<=1919)return"Arabic";if(e>=2304&&e<=2431)return"Devanagari";return"other"}function ee(e,r){const t=r.flatMap(Oe);const i=new Map;for(const s of D(Ne(e))){const o=[...s].map(a=>a.codePointAt(0)).filter(a=>!Ce(a));if(o.length===0)continue;const n=t.some(a=>o.every(f=>a.some(m=>m.has(f))));const c=s.includes("\u200D")||/\p{Mark}/u.test(s);if(n&&!c)continue;for(const a of o){const f=i.get(Q(a))??new Set;f.add(a);i.set(Q(a),f)}}return[...i].sort(([s],[o])=>s<o?-1:s>o?1:0).map(([s,o])=>({script:s,chars:[...o].sort((n,c)=>n-c).map(n=>String.fromCodePoint(n))}))}var $e=/\.(ttf|otf|ttc|otc)$/i;function te(e,r=4){if(r<0)return[];let t;try{t=_e(e).sort()}catch{return[]}const i=[];for(const s of t){const o=Ae(e,s);try{const n=Te(o);if(n.isDirectory())i.push(...te(o,r-1));else if($e.test(s))i.push(o)}catch{}}return i}function ke(e){const r=[];for(const t of e){for(const i of te(t)){try{r.push(new Uint8Array(Fe(i)))}catch{}}}return r}function re(e,r,t){return ee(e,[...t,...ke(r)])}function ne(e,r={}){return e.map(({script:t,chars:i})=>{const s=i.slice(0,5).join(" ");const o=r.systemFontsMayCover?" They are absent from bundled/caller-provided fonts; an installed system font may cover them, so final shaping is machine-dependent.":" They may draw as tofu or fail to shape as one grapheme.";return{code:"PNG_FONT_COVERAGE",script:t,chars:[...i],message:`no known loaded face covers ${i.length} ${t} character${i.length===1?"":"s"} (${s}) in one grapheme cluster.${o} Supply fontDirs (CLI: --font-dirs <dir>) with a face that covers the cluster.`}})}import{createHash as De}from"crypto";import{closeSync as N,constants as oe,fstatSync as C,lstatSync as se,openSync as ve,readSync as Le,realpathSync as ie}from"fs";import{isAbsolute as ae,join as Ge,relative as ce,sep as _}from"path";var d=class extends Error{code;resourceId;constructor(r,t,i){super(`${r}: ${i}`);this.name="ResourceResolutionError";this.code=r;this.resourceId=t}};function fe(e){return typeof e==="object"&&e!==null&&"code"in e?String(e.code):void 0}function We(e){return De("sha256").update(e).digest("hex")}function Ve(e,r){if(e==="linux")return`/proc/self/fd/${r}`;if(e==="darwin")return`/dev/fd/${r}`;return void 0}var P=class{#e;#t;#r;#n;#o;constructor(r,t,i={}){let s;try{s=I(t)}catch(n){const c=n instanceof Error?n.message.replace(/^INVALID_RESOURCE_MANIFEST:\s*/,""):String(n);throw new d("INVALID_RESOURCE_MANIFEST","resource-manifest",c)}const o=i.maxResourceBytes??16*1024*1024;if(!Number.isSafeInteger(o)||o<=0){throw new d("INVALID_RESOURCE_MANIFEST","resource-manifest","maxResourceBytes must be a positive safe integer")}try{this.#e=ie(r)}catch{throw new d("RESOURCE_MISSING","resource-manifest",`package root does not exist: ${r}`)}this.#t=s;this.#r=o;this.#n=Object.freeze({...i.mediaTypes??B});this.#o=new Map(this.#t.resources.map(n=>[n.identity.id,n]))}list(){return this.#t.resources}#s(r,t,i){const s=t.split("/");let o=this.#e;for(const c of s){o=Ge(o,c);let a;try{a=se(o)}catch(f){if(fe(f)==="ENOENT"){throw new d(i,r.identity.id,`declared path is missing: ${t}`)}throw f}if(a.isSymbolicLink()){throw new d("RESOURCE_SYMLINK_REJECTED",r.identity.id,`symlink component is forbidden: ${t}`)}}const n=ce(this.#e,o);if(n===".."||n.startsWith(`..${_}`)||ae(n)){throw new d("RESOURCE_PATH_ESCAPE",r.identity.id,`path escapes package root: ${t}`)}return o}#i(r,t,i){const s=this.#s(r,t,i);let o;try{o=ve(s,oe.O_RDONLY|oe.O_NOFOLLOW)}catch(n){const c=fe(n);if(c==="ENOENT")throw new d(i,r.identity.id,`declared path is missing: ${t}`);if(c==="ELOOP")throw new d("RESOURCE_SYMLINK_REJECTED",r.identity.id,`symlink component is forbidden: ${t}`);throw n}try{const n=C(o);if(!n.isFile()){throw new d("RESOURCE_NOT_REGULAR",r.identity.id,`resource is not a regular file: ${t}`)}const c=Ve(process.platform,o);if(c){const m=ie(c);if(m!==c&&!m.startsWith(`${c}${_}`)){const u=ce(this.#e,m);if(u===".."||u.startsWith(`..${_}`)||ae(u)){throw new d("RESOURCE_PATH_ESCAPE",r.identity.id,`opened file escapes package root: ${t}`)}}}const a=this.#s(r,t,i);const f=se(a);if(!f.isFile()){throw new d("RESOURCE_NOT_REGULAR",r.identity.id,`resource is not a regular file: ${t}`)}if(n.dev!==f.dev||n.ino!==f.ino){throw new d("RESOURCE_PATH_ESCAPE",r.identity.id,`opened file identity no longer matches the rooted path: ${t}`)}return o}catch(n){N(o);throw n}}resolve(r){const t=this.#o.get(r);if(!t)throw new d("UNKNOWN_RESOURCE",r,`resource is not installed: ${r}`);if(t.bytes>this.#r){throw new d("RESOURCE_SIZE_LIMIT",r,`${t.bytes} exceeds the ${this.#r}-byte host limit`)}const i=this.#i(t,t.license.noticePath,"RESOURCE_LICENSE_NOTICE_MISSING");N(i);const s=this.#i(t,t.path,"RESOURCE_MISSING");let o;try{const f=C(s);if(f.size!==t.bytes){throw new d("RESOURCE_SIZE_MISMATCH",r,`declared ${t.bytes} bytes but found ${f.size}`)}const m=new Uint8Array(t.bytes+1);let u=0;while(u<m.byteLength){const l=Le(s,m,u,m.byteLength-u,null);if(l===0)break;u+=l}const p=C(s);if(u!==t.bytes||p.size!==t.bytes){throw new d("RESOURCE_SIZE_MISMATCH",r,`declared ${t.bytes} bytes but securely read ${u}`)}o=m.slice(0,u)}finally{N(s)}const n=this.#n[t.mediaType];if(!n||!n(o)){throw new d("RESOURCE_MEDIA_TYPE_MISMATCH",r,`resource bytes do not match ${t.mediaType}`)}const c=We(o);if(c!==t.sha256){throw new d("RESOURCE_DIGEST_MISMATCH",r,`expected ${t.sha256}, received ${c}`)}const a=o.slice();return Object.freeze({entry:t,readBytes:()=>a.slice()})}verifyInstalled(){const r=[];const t=[];for(const i of this.#t.resources){try{r.push(this.resolve(i.identity.id))}catch(s){if(!i.required&&s instanceof d&&s.code==="RESOURCE_MISSING"){t.push(Object.freeze({code:"OPTIONAL_RESOURCE_MISSING",resourceId:i.identity.id,message:s.message}));continue}throw s}}return Object.freeze({resources:Object.freeze(r),diagnostics:Object.freeze(t)})}};import{tmpdir as Be}from"os";import{dirname as je,join as de}from"path";import{mkdirSync as ze,mkdtempSync as He,readFileSync as Ye,rmSync as qe,writeFileSync as Ke}from"fs";var ue;function Xe(e,r){const t=I(e);const i=new Map;for(const o of t.resources){i.set(o.path,{resourceId:o.identity.id,missingCode:"RESOURCE_MISSING"});if(!i.has(o.license.noticePath)){i.set(o.license.noticePath,{resourceId:o.identity.id,missingCode:"RESOURCE_LICENSE_NOTICE_MISSING"})}}const s=He(de(Be(),"agentic-mermaid-embedded-resources-"));try{const o=new Set;for(const n of r){const c=i.get(n.manifestPath);if(!c){throw new d("UNKNOWN_RESOURCE",n.manifestPath,`embedded path is not declared by the font resource manifest: ${n.manifestPath}`)}if(o.has(n.manifestPath)){throw new d("INVALID_RESOURCE_MANIFEST",c.resourceId,`duplicate embedded path: ${n.manifestPath}`)}let a;try{a=Ye(n.embeddedPath)}catch{throw new d(c.missingCode,c.resourceId,`embedded source is unavailable for declared path: ${n.manifestPath}`)}const f=de(s,n.manifestPath);ze(je(f),{recursive:true,mode:448});Ke(f,a,{flag:"wx",mode:256});o.add(n.manifestPath)}return new P(s,t).verifyInstalled()}finally{try{qe(s,{recursive:true,force:true})}catch{}}}function me(e){return ue?Xe(e,ue):void 0}var R;var pe=false;function ge(e){const r=tt(F(Ze(),"agentic-mermaid-fonts-"));try{const t=e.map(s=>s.readBytes());const i=t.map((s,o)=>{const n=F(r,`${o}-${Qe(e[o].entry.path)}`);rt(n,s,{flag:"wx",mode:256});return n});return Object.freeze({snapshotDirectory:r,buffers:Object.freeze(t),files:Object.freeze(i)})}catch(t){try{ye(r,{recursive:true,force:true})}catch{}throw t}}function ot(){if(R)return R;const e=typeof import.meta.url==="string"?Je(import.meta.url):__filename;let r=le(e);for(let t=0;t<6;t++){const i=F(r,"assets","fonts");if(et(i)){const o=new P(r,M).verifyInstalled();R=ge(o.resources);break}const s=le(r);if(s===r)break;r=s}if(!R){const t=me(M);if(t)R=ge(t.resources)}if(!R)throw new Error("RESOURCE_MISSING: required bundled font manifest could not be located");if(!pe){pe=true;process.once("exit",()=>{try{if(R)ye(R.snapshotDirectory,{recursive:true,force:true})}catch{}})}return R}function Ht(e,r={}){return st(e,r).png}function st(e,r={}){return T(e,r,{})}function Yt(e={}){const r=W(e.backendPolicy);const t=v(e.textMeasurement);const i=Object.freeze({...r?{backendPolicy:r}:{},...t?{textMeasurement:t}:{}});return Object.freeze({renderMermaidPNG(s,o={}){return T(s,o,i).png},renderMermaidPNGWithReceipt(s,o={}){return T(s,o,i)}})}function T(e,r,t){const i=V(e);const s=i.source;const o=r.onWarning;if(o!==void 0&&typeof o!=="function"){throw new TypeError("PNG onWarning must be a function")}const n=H(r);const c=Y(r);const a=X(s,c,n,{backendPolicy:t.backendPolicy,textMeasurement:t.textMeasurement,expectedFamilyId:i.expectedFamilyId});const f=a.outputPolicy;const m=K(J(G(a.svg)),a.rasterDimensions);const u=ot();const p=o??(y=>process.stderr.write(`agentic-mermaid renderMermaidPNG: warning ${y.code}: ${y.message}
3
- `));for(const y of ne(re(m,f.fonts.callerDirectories,u.buffers),{systemFontsMayCover:f.fonts.loadSystemFonts}))p(y);for(const y of a.legibilityWarnings)p(y);const l={background:a.rasterBackground,fitTo:{mode:"zoom",value:1},font:{loadSystemFonts:f.fonts.loadSystemFonts,fontFiles:[...u.files],fontDirs:[...f.fonts.callerDirectories],defaultFontFamily:f.fonts.defaultFamily}};const O=new nt(m,l);const E=z(O.render().asPng());const S=j(E);if(S.width!==a.rasterDimensions.width||S.height!==a.rasterDimensions.height){throw new Error(`native PNG rasterizer returned ${S.width}\xD7${S.height}; expected ${a.rasterDimensions.width}\xD7${a.rasterDimensions.height}`)}return{png:new Uint8Array(E.buffer,E.byteOffset,E.byteLength),receipt:a.receipt,runtime:q(f.fonts)}}export{Ht as a,st as b,Yt as c};
4
- //# sourceMappingURL=chunk-4F2UGYTM.js.map