agentic-mermaid 0.3.1 → 0.3.2
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/CHANGELOG.md +17 -0
- package/dist/agent-core.d.ts +2 -2
- package/dist/agent-core.js +2 -2
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +4 -4
- package/dist/agentic-mermaid-mcp.js +5 -5
- package/dist/am.js +6 -6
- package/dist/browser-lazy/chunks/{architecture-3CGEU363.js → architecture-WMSX5L4P.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-RVO6J7S3.js → chunk-32FWKUUV.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-KTTWXSIX.js → chunk-ANTNEVJC.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-DPSSG7LR.js → chunk-AOCFMYYH.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-2U4EUPSI.js → chunk-CCTZFX43.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-PXRUFH7U.js → chunk-EBPTM2RP.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-FXBBGAMJ.js → chunk-EX6TP7QM.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-MMWVZP6M.js → chunk-QMZ4Y6I7.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-4IUBLBJJ.js → chunk-QYJMRNS3.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-6UT2VTFI.js → chunk-RLS545DI.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-VDTSULBU.js → chunk-TBZAU7KC.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-JX5ZZY3T.js → chunk-TDGTBGV3.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-HZ4ADQMK.js → chunk-TEH2PRKN.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-CTVVJPMX.js → chunk-W6Q4PHPC.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-4U2TVB2S.js → chunk-WN7SFUCZ.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-7D24ZLOV.js → chunk-ZZECLXC3.js} +1 -1
- package/dist/browser-lazy/chunks/{class-B3AVLSIF.js → class-7JRALQIM.js} +1 -1
- package/dist/browser-lazy/chunks/{er-AF4BKKKC.js → er-UDCGHKBX.js} +1 -1
- package/dist/browser-lazy/chunks/{flowchart-BE6BQZLZ.js → flowchart-5FP7RRIK.js} +1 -1
- package/dist/browser-lazy/chunks/{gantt-U4BMMSEL.js → gantt-NTOIC5CW.js} +1 -1
- package/dist/browser-lazy/chunks/{gitgraph-UPSWNFRP.js → gitgraph-JYAPXUIJ.js} +1 -1
- package/dist/browser-lazy/chunks/{journey-PDZ7FDJR.js → journey-646EFIB6.js} +1 -1
- package/dist/browser-lazy/chunks/{mindmap-BFEUURLS.js → mindmap-2SBTQHQO.js} +1 -1
- package/dist/browser-lazy/chunks/{pie-ZFYW5JZO.js → pie-7FDXZ24K.js} +1 -1
- package/dist/browser-lazy/chunks/{quadrant-XJVEYYXK.js → quadrant-72UT4XAW.js} +1 -1
- package/dist/browser-lazy/chunks/{radar-OVXFNRNC.js → radar-SU7BO56J.js} +1 -1
- package/dist/browser-lazy/chunks/{render-core-R4ZGGEFS.js → render-core-Q2JWXDDL.js} +2 -2
- package/dist/browser-lazy/chunks/{sequence-AWY6JCSB.js → sequence-5O5ET264.js} +1 -1
- package/dist/browser-lazy/chunks/{state-TCE4DXKR.js → state-IWPLFQ6R.js} +1 -1
- package/dist/browser-lazy/chunks/{timeline-W4ZVT3FF.js → timeline-WJWYHH5Y.js} +1 -1
- package/dist/browser-lazy/chunks/{xychart-K3QQACKS.js → xychart-HHQVQA5O.js} +1 -1
- package/dist/browser-lazy/index.js +1 -1
- package/dist/browser.global.js +2 -2
- package/dist/{chunk-XVY324NY.js → chunk-3D4EHVQ4.js} +5 -3
- package/dist/{chunk-BSVM3VMO.js → chunk-GX7UT56Q.js} +2 -2
- package/dist/{chunk-JJ7JRYZV.js → chunk-IVN6KP3W.js} +2 -2
- package/dist/{chunk-FGO3J7RA.js → chunk-NE6JBHSE.js} +680 -42
- package/dist/{chunk-KQMJ37OY.js → chunk-R5U67OIW.js} +4 -4
- package/dist/{chunk-MBIR6S3B.js → chunk-YWKCUBQN.js} +2 -2
- package/dist/{index-Do8z5rPq.d.ts → index-BFg_LoZS.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-cli-XGZP6CMW.js +17 -0
- package/docs/mcp-http-transport.md +2 -0
- package/package.json +5 -4
- package/server.json +2 -2
- package/dist/mcp-cli-7FLGTEG3.js +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Qn,b as $}from"./chunk-6UT2VTFI.js";import{a as Hn}from"./chunk-4U2TVB2S.js";import{b as Wn,c as qn}from"./chunk-4IUBLBJJ.js";import{b as vn}from"./chunk-T7IJ6V4B.js";import"./chunk-5Q4S74UO.js";import"./chunk-STQRDZ67.js";import{a as mn,b as hn}from"./chunk-A7L4WWVW.js";import{a as Ot,b as kn,c as On}from"./chunk-PXRUFH7U.js";import{b as dn,c as pn}from"./chunk-KJVNXJ5Y.js";import"./chunk-M6BT2HIP.js";import{a as Un,b as Jn,c as Xn,d as Kn,f as Yn,g as Zn}from"./chunk-MMWVZP6M.js";import{b as un,d as fn,f as Rt}from"./chunk-FFOHLPDA.js";import{b as wt,c as Et}from"./chunk-I6VE56S7.js";import"./chunk-FLD63DXE.js";import"./chunk-RVO6J7S3.js";import{$ as Xe,A as Rn,Aa as In,B as xt,Ba as ie,C as Ie,Ca as Pn,Da as Nn,E as kt,Ea as jn,Fa as Ln,Ga as _n,Ha as zn,Ia as Bn,Ja as Gn,K as xn,Ka as Vn,O as z,R as vt,S as wn,d as yn,da as En,g as gn,ga as Mn,h as bn,ha as re,ra as Cn,sa as An,ta as Fn,ua as $n,va as Tn,w as Sn,x as Je,za as Dn}from"./chunk-FXBBGAMJ.js";import{e as He,f as Ue}from"./chunk-P7HMSKHJ.js";function Mt(e,t,n){if(e&&e.length){let[r,i]=t,o=Math.PI/180*n,a=Math.cos(o),s=Math.sin(o);for(let d of e){let[l,c]=d;d[0]=(l-r)*a-(c-i)*s+r,d[1]=(l-r)*s+(c-i)*a+i}}}function vi(e,t,n){let r=[];e.forEach(i=>r.push(...i)),Mt(r,t,n)}function wi(e,t){return e[0]===t[0]&&e[1]===t[1]}function er(e,t,n,r=1){let i=n,o=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,s=[0,0];if(i)for(let l of a)Mt(l,s,i);let d=Ei(a,o,r);if(i){for(let l of a)Mt(l,s,-i);vi(d,s,-i)}return d}function Ei(e,t,n){let r=[];for(let l of e){let c=[...l];wi(c[0],c[c.length-1])||c.push([c[0][0],c[0][1]]),c.length>2&&r.push(c)}let i=[];t=Math.max(t,.1);let o=[];for(let l of r)for(let c=0;c<l.length-1;c++){let p=l[c],u=l[c+1];if(p[1]!==u[1]){let f=Math.min(p[1],u[1]);o.push({ymin:f,ymax:Math.max(p[1],u[1]),x:f===p[1]?p[0]:u[0],islope:(u[0]-p[0])/(u[1]-p[1])})}}if(o.sort((l,c)=>l.ymin<c.ymin?-1:l.ymin>c.ymin?1:l.x<c.x?-1:l.x>c.x?1:l.ymax===c.ymax?0:(l.ymax-c.ymax)/Math.abs(l.ymax-c.ymax)),!o.length)return i;let a=[],s=o[0].ymin,d=0;for(;a.length||o.length;){if(o.length){let l=-1;for(let p=0;p<o.length&&!(o[p].ymin>s);p++)l=p;o.splice(0,l+1).forEach(p=>{a.push({s,edge:p})})}if(a=a.filter(l=>!(l.edge.ymax<=s)),a.sort((l,c)=>l.edge.x===c.edge.x?0:(l.edge.x-c.edge.x)/Math.abs(l.edge.x-c.edge.x)),(n!==1||d%t===0)&&a.length>1)for(let l=0;l<a.length;l=l+2){let c=l+1;if(c>=a.length)break;let p=a[l].edge,u=a[c].edge;i.push([[Math.round(p.x),s],[Math.round(u.x),s]])}s+=n,a.forEach(l=>{l.edge.x=l.edge.x+n*l.edge.islope}),d++}return i}function X(e,t){var n;let r=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=t.strokeWidth*4),i=Math.round(Math.max(i,.1));let o=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(o=i),er(e,i,r,o||1)}var oe=class{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){let r=X(t,n);return{type:"fillSketch",ops:this.renderLines(r,n)}}renderLines(t,n){let r=[];for(let i of t)r.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],n));return r}};function se(e){let t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}var Ke=class extends oe{fillPolygons(t,n){let r=n.hachureGap;r<0&&(r=n.strokeWidth*4),r=Math.max(r,.1);let i=Object.assign({},n,{hachureGap:r}),o=X(t,i),a=Math.PI/180*n.hachureAngle,s=[],d=r*.5*Math.cos(a),l=r*.5*Math.sin(a);for(let[p,u]of o)se([p,u])&&s.push([[p[0]-d,p[1]+l],[...u]],[[p[0]+d,p[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(s,n)}}};var Ye=class extends oe{fillPolygons(t,n){let r=this._fillPolygons(t,n),i=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),o=this._fillPolygons(t,i);return r.ops=r.ops.concat(o.ops),r}};var Ze=class{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});let r=X(t,n);return this.dotsOnLines(r,n)}dotsOnLines(t,n){let r=[],i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);let o=n.fillWeight;o<0&&(o=n.strokeWidth/2);let a=i/4;for(let s of t){let d=se(s),l=d/i,c=Math.ceil(l)-1,p=d-c*i,u=(s[0][0]+s[1][0])/2-i/4,f=Math.min(s[0][1],s[1][1]);for(let m=0;m<c;m++){let h=f+p+m*i,y=u-a+Math.random()*2*a,g=h-a+Math.random()*2*a,S=this.helper.ellipse(y,g,o,o,n);r.push(...S.ops)}}return{type:"fillSketch",ops:r}}};var Qe=class{constructor(t){this.helper=t}fillPolygons(t,n){let r=X(t,n);return{type:"fillSketch",ops:this.dashedLine(r,n)}}dashedLine(t,n){let r=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,i=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,o=[];return t.forEach(a=>{let s=se(a),d=Math.floor(s/(r+i)),l=(s+i-d*(r+i))/2,c=a[0],p=a[1];c[0]>p[0]&&(c=a[1],p=a[0]);let u=Math.atan((p[1]-c[1])/(p[0]-c[0]));for(let f=0;f<d;f++){let m=f*(r+i),h=m+r,y=[c[0]+m*Math.cos(u)+l*Math.cos(u),c[1]+m*Math.sin(u)+l*Math.sin(u)],g=[c[0]+h*Math.cos(u)+l*Math.cos(u),c[1]+h*Math.sin(u)+l*Math.sin(u)];o.push(...this.helper.doubleLineOps(y[0],y[1],g[0],g[1],n))}}),o}};var et=class{constructor(t){this.helper=t}fillPolygons(t,n){let r=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,i=n.zigzagOffset<0?r:n.zigzagOffset;n=Object.assign({},n,{hachureGap:r+i});let o=X(t,n);return{type:"fillSketch",ops:this.zigzagLines(o,i,n)}}zigzagLines(t,n,r){let i=[];return t.forEach(o=>{let a=se(o),s=Math.round(a/(2*n)),d=o[0],l=o[1];d[0]>l[0]&&(d=o[1],l=o[0]);let c=Math.atan((l[1]-d[1])/(l[0]-d[0]));for(let p=0;p<s;p++){let u=p*2*n,f=(p+1)*2*n,m=Math.sqrt(2*Math.pow(n,2)),h=[d[0]+u*Math.cos(c),d[1]+u*Math.sin(c)],y=[d[0]+f*Math.cos(c),d[1]+f*Math.sin(c)],g=[h[0]+m*Math.cos(c+Math.PI/4),h[1]+m*Math.sin(c+Math.PI/4)];i.push(...this.helper.doubleLineOps(h[0],h[1],g[0],g[1],r),...this.helper.doubleLineOps(g[0],g[1],y[0],y[1],r))}}),i}};var j={};function tr(e,t){let n=e.fillStyle||"hachure";if(!j[n])switch(n){case"zigzag":j[n]||(j[n]=new Ke(t));break;case"cross-hatch":j[n]||(j[n]=new Ye(t));break;case"dots":j[n]||(j[n]=new Ze(t));break;case"dashed":j[n]||(j[n]=new Qe(t));break;case"zigzag-line":j[n]||(j[n]=new et(t));break;default:n="hachure",j[n]||(j[n]=new oe(t));break}return j[n]}function nr(){return Math.floor(Math.random()*2**31)}var tt=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};var nt={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 Mi(e){let t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:2,text:""},t}function Ct(e,t){return e.type===t}function ve(e){let t=[],n=Mi(e),r="BOD",i=0,o=n[i];for(;!Ct(o,2);){let a=0,s=[];if(r==="BOD")if(o.text==="M"||o.text==="m")i++,a=nt[o.text],r=o.text;else return ve("M0,0"+e);else Ct(o,1)?a=nt[r]:(i++,a=nt[o.text],r=o.text);if(i+a<n.length){for(let d=i;d<i+a;d++){let l=n[d];if(Ct(l,1))s[s.length]=+l.text;else throw new Error("Param not a number: "+r+","+l.text)}if(typeof nt[r]=="number"){let d={key:r,data:s};t.push(d),i+=a,o=n[i],r==="M"&&(r="L"),r==="m"&&(r="l")}else throw new Error("Bad segment: "+r)}else throw new Error("Path data ended short")}return t}function Pe(e){let t=0,n=0,r=0,i=0,o=[];for(let{key:a,data:s}of e)switch(a){case"M":o.push({key:"M",data:[...s]}),[t,n]=s,[r,i]=s;break;case"m":t+=s[0],n+=s[1],o.push({key:"M",data:[t,n]}),r=t,i=n;break;case"L":o.push({key:"L",data:[...s]}),[t,n]=s;break;case"l":t+=s[0],n+=s[1],o.push({key:"L",data:[t,n]});break;case"C":o.push({key:"C",data:[...s]}),t=s[4],n=s[5];break;case"c":{let d=s.map((l,c)=>c%2?l+n:l+t);o.push({key:"C",data:d}),t=d[4],n=d[5];break}case"Q":o.push({key:"Q",data:[...s]}),t=s[2],n=s[3];break;case"q":{let d=s.map((l,c)=>c%2?l+n:l+t);o.push({key:"Q",data:d}),t=d[2],n=d[3];break}case"A":o.push({key:"A",data:[...s]}),t=s[5],n=s[6];break;case"a":t+=s[5],n+=s[6],o.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case"H":o.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...s]}),n=s[0];break;case"v":n+=s[0],o.push({key:"V",data:[n]});break;case"S":o.push({key:"S",data:[...s]}),t=s[2],n=s[3];break;case"s":{let d=s.map((l,c)=>c%2?l+n:l+t);o.push({key:"S",data:d}),t=d[2],n=d[3];break}case"T":o.push({key:"T",data:[...s]}),t=s[0],n=s[1];break;case"t":t+=s[0],n+=s[1],o.push({key:"T",data:[t,n]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=r,n=i;break}return o}function je(e){let t=[],n="",r=0,i=0,o=0,a=0,s=0,d=0;for(let{key:l,data:c}of e){switch(l){case"M":t.push({key:"M",data:[...c]}),[r,i]=c,[o,a]=c;break;case"C":t.push({key:"C",data:[...c]}),r=c[4],i=c[5],s=c[2],d=c[3];break;case"L":t.push({key:"L",data:[...c]}),[r,i]=c;break;case"H":r=c[0],t.push({key:"L",data:[r,i]});break;case"V":i=c[0],t.push({key:"L",data:[r,i]});break;case"S":{let p=0,u=0;n==="C"||n==="S"?(p=r+(r-s),u=i+(i-d)):(p=r,u=i),t.push({key:"C",data:[p,u,...c]}),s=c[0],d=c[1],r=c[2],i=c[3];break}case"T":{let[p,u]=c,f=0,m=0;n==="Q"||n==="T"?(f=r+(r-s),m=i+(i-d)):(f=r,m=i);let h=r+2*(f-r)/3,y=i+2*(m-i)/3,g=p+2*(f-p)/3,S=u+2*(m-u)/3;t.push({key:"C",data:[h,y,g,S,p,u]}),s=f,d=m,r=p,i=u;break}case"Q":{let[p,u,f,m]=c,h=r+2*(p-r)/3,y=i+2*(u-i)/3,g=f+2*(p-f)/3,S=m+2*(u-m)/3;t.push({key:"C",data:[h,y,g,S,f,m]}),s=p,d=u,r=f,i=m;break}case"A":{let p=Math.abs(c[0]),u=Math.abs(c[1]),f=c[2],m=c[3],h=c[4],y=c[5],g=c[6];p===0||u===0?(t.push({key:"C",data:[r,i,y,g,y,g]}),r=y,i=g):(r!==y||i!==g)&&(rr(r,i,y,g,p,u,f,m,h).forEach(function(k){t.push({key:"C",data:k})}),r=y,i=g);break}case"Z":t.push({key:"Z",data:[]}),r=o,i=a;break}n=l}return t}function Ci(e){return Math.PI*e/180}function Ne(e,t,n){let r=e*Math.cos(n)-t*Math.sin(n),i=e*Math.sin(n)+t*Math.cos(n);return[r,i]}function rr(e,t,n,r,i,o,a,s,d,l){let c=Ci(a),p=[],u=0,f=0,m=0,h=0;if(l)[u,f,m,h]=l;else{[e,t]=Ne(e,t,-c),[n,r]=Ne(n,r,-c);let w=(e-n)/2,x=(t-r)/2,A=w*w/(i*i)+x*x/(o*o);A>1&&(A=Math.sqrt(A),i=A*i,o=A*o);let U=s===d?-1:1,F=i*i,R=o*o,Te=F*R-F*x*x-R*w*w,J=F*x*x+R*w*w,ne=U*Math.sqrt(Math.abs(Te/J));m=ne*i*x/o+(e+n)/2,h=ne*-o*w/i+(t+r)/2,u=Math.asin(parseFloat(((t-h)/o).toFixed(9))),f=Math.asin(parseFloat(((r-h)/o).toFixed(9))),e<m&&(u=Math.PI-u),n<m&&(f=Math.PI-f),u<0&&(u=Math.PI*2+u),f<0&&(f=Math.PI*2+f),d&&u>f&&(u=u-Math.PI*2),!d&&f>u&&(f=f-Math.PI*2)}let y=f-u;if(Math.abs(y)>Math.PI*120/180){let w=f,x=n,A=r;d&&f>u?f=u+Math.PI*120/180*1:f=u+Math.PI*120/180*-1,n=m+i*Math.cos(f),r=h+o*Math.sin(f),p=rr(n,r,x,A,i,o,a,0,d,[f,w,m,h])}y=f-u;let g=Math.cos(u),S=Math.sin(u),k=Math.cos(f),H=Math.sin(f),v=Math.tan(y/4),L=4/3*i*v,Y=4/3*o*v,_=[e,t],N=[e+L*S,t-Y*g],C=[n+L*H,r-Y*k],G=[n,r];if(N[0]=2*_[0]-N[0],N[1]=2*_[1]-N[1],l)return[N,C,G].concat(p);{p=[N,C,G].concat(p);let w=[];for(let x=0;x<p.length;x+=3){let A=Ne(p[x][0],p[x][1],c),U=Ne(p[x+1][0],p[x+1][1],c),F=Ne(p[x+2][0],p[x+2][1],c);w.push([A[0],A[1],U[0],U[1],F[0],F[1]])}return w}}var Ai={randOffset:Ti,randOffsetWithRange:Di,ellipse:$i,doubleLineOps:Ii};function Ft(e,t,n,r,i){return{type:"path",ops:ae(e,t,n,r,i)}}function Le(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let o=0;o<r-1;o++)i.push(...ae(e[o][0],e[o][1],e[o+1][0],e[o+1][1],n));return t&&i.push(...ae(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:"path",ops:i}}else if(r===2)return Ft(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function Fi(e,t){return Le(e,!0,t)}function ar(e,t,n,r,i){let o=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];return Fi(o,i)}function $t(e,t){if(e.length){let r=typeof e[0][0]=="number"?[e]:e,i=rt(r[0],1*(1+t.roughness*.2),t),o=t.disableMultiStroke?[]:rt(r[0],1.5*(1+t.roughness*.22),ir(t));for(let a=1;a<r.length;a++){let s=r[a];if(s.length){let d=rt(s,1*(1+t.roughness*.2),t),l=t.disableMultiStroke?[]:rt(s,1.5*(1+t.roughness*.22),ir(t));for(let c of d)c.op!=="move"&&i.push(c);for(let c of l)c.op!=="move"&&o.push(c)}}return{type:"path",ops:i.concat(o)}}return{type:"path",ops:[]}}function $i(e,t,n,r,i){let o=Tt(n,r,i);return st(e,t,i,o).opset}function Tt(e,t,n){let r=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),o=Math.PI*2/i,a=Math.abs(e/2),s=Math.abs(t/2),d=1-n.curveFitting;return a+=b(a*d,n),s+=b(s*d,n),{increment:o,rx:a,ry:s}}function st(e,t,n,r){let[i,o]=or(r.increment,e,t,r.rx,r.ry,1,r.increment*it(.1,it(.4,1,n),n),n),a=ot(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[s]=or(r.increment,e,t,r.rx,r.ry,1.5,0,n),d=ot(s,null,n);a=a.concat(d)}return{estimatedPoints:o,opset:{type:"path",ops:a}}}function Dt(e,t,n,r,i,o,a,s,d){let l=e,c=t,p=Math.abs(n/2),u=Math.abs(r/2);p+=b(p*.01,d),u+=b(u*.01,d);let f=i,m=o;for(;f<0;)f+=Math.PI*2,m+=Math.PI*2;m-f>Math.PI*2&&(f=0,m=Math.PI*2);let h=Math.PI*2/d.curveStepCount,y=Math.min(h/2,(m-f)/2),g=sr(y,l,c,p,u,f,m,1,d);if(!d.disableMultiStroke){let S=sr(y,l,c,p,u,f,m,1.5,d);g.push(...S)}return a&&(s?g.push(...ae(l,c,l+p*Math.cos(f),c+u*Math.sin(f),d),...ae(l,c,l+p*Math.cos(m),c+u*Math.sin(m),d)):g.push({op:"lineTo",data:[l,c]},{op:"lineTo",data:[l+p*Math.cos(f),c+u*Math.sin(f)]})),{type:"path",ops:g}}function It(e,t){let n=je(Pe(ve(e))),r=[],i=[0,0],o=[0,0];for(let{key:a,data:s}of n)switch(a){case"M":{o=[s[0],s[1]],i=[s[0],s[1]];break}case"L":r.push(...ae(o[0],o[1],s[0],s[1],t)),o=[s[0],s[1]];break;case"C":{let[d,l,c,p,u,f]=s;r.push(...Pi(d,l,c,p,u,f,o,t)),o=[u,f];break}case"Z":r.push(...ae(o[0],o[1],i[0],i[1],t)),o=[i[0],i[1]];break}return{type:"path",ops:r}}function at(e,t){let n=[];for(let r of e)if(r.length){let i=t.maxRandomnessOffset||0,o=r.length;if(o>2){n.push({op:"move",data:[r[0][0]+b(i,t),r[0][1]+b(i,t)]});for(let a=1;a<o;a++)n.push({op:"lineTo",data:[r[a][0]+b(i,t),r[a][1]+b(i,t)]})}}return{type:"fillPath",ops:n}}function ye(e,t){return tr(t,Ai).fillPolygons(e,t)}function cr(e,t,n,r,i,o,a){let s=e,d=t,l=Math.abs(n/2),c=Math.abs(r/2);l+=b(l*.01,a),c+=b(c*.01,a);let p=i,u=o;for(;p<0;)p+=Math.PI*2,u+=Math.PI*2;u-p>Math.PI*2&&(p=0,u=Math.PI*2);let f=(u-p)/a.curveStepCount,m=[];for(let h=p;h<=u;h=h+f)m.push([s+l*Math.cos(h),d+c*Math.sin(h)]);return m.push([s+l*Math.cos(u),d+c*Math.sin(u)]),m.push([s,d]),ye([m],a)}function Ti(e,t){return b(e,t)}function Di(e,t,n){return it(e,t,n)}function Ii(e,t,n,r,i){return ae(e,t,n,r,i,!0)}function ir(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function lr(e){return e.randomizer||(e.randomizer=new tt(e.seed||0)),e.randomizer.next()}function it(e,t,n,r=1){return n.roughness*r*(lr(n)*(t-e)+e)}function b(e,t,n=1){return it(-e,e,t,n)}function ae(e,t,n,r,i,o=!1){let a=o?i.disableMultiStrokeFill:i.disableMultiStroke,s=At(e,t,n,r,i,!0,!1);if(a)return s;let d=At(e,t,n,r,i,!0,!0);return s.concat(d)}function At(e,t,n,r,i,o,a){let s=Math.pow(e-n,2)+Math.pow(t-r,2),d=Math.sqrt(s),l=1;d<200?l=1:d>500?l=.4:l=-.0016668*d+1.233334;let c=i.maxRandomnessOffset||0;c*c*100>s&&(c=d/10);let p=c/2,u=.2+lr(i)*.2,f=i.bowing*i.maxRandomnessOffset*(r-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-n)/200;f=b(f,i,l),m=b(m,i,l);let h=[],y=()=>b(p,i,l),g=()=>b(c,i,l),S=i.preserveVertices;return o&&(a?h.push({op:"move",data:[e+(S?0:y()),t+(S?0:y())]}):h.push({op:"move",data:[e+(S?0:b(c,i,l)),t+(S?0:b(c,i,l))]})),a?h.push({op:"bcurveTo",data:[f+e+(n-e)*u+y(),m+t+(r-t)*u+y(),f+e+2*(n-e)*u+y(),m+t+2*(r-t)*u+y(),n+(S?0:y()),r+(S?0:y())]}):h.push({op:"bcurveTo",data:[f+e+(n-e)*u+g(),m+t+(r-t)*u+g(),f+e+2*(n-e)*u+g(),m+t+2*(r-t)*u+g(),n+(S?0:g()),r+(S?0:g())]}),h}function rt(e,t,n){if(!e.length)return[];let r=[];r.push([e[0][0]+b(t,n),e[0][1]+b(t,n)]),r.push([e[0][0]+b(t,n),e[0][1]+b(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+b(t,n),e[i][1]+b(t,n)]),i===e.length-1&&r.push([e[i][0]+b(t,n),e[i][1]+b(t,n)]);return ot(r,null,n)}function ot(e,t,n){let r=e.length,i=[];if(r>3){let o=[],a=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let s=1;s+2<r;s++){let d=e[s];o[0]=[d[0],d[1]],o[1]=[d[0]+(a*e[s+1][0]-a*e[s-1][0])/6,d[1]+(a*e[s+1][1]-a*e[s-1][1])/6],o[2]=[e[s+1][0]+(a*e[s][0]-a*e[s+2][0])/6,e[s+1][1]+(a*e[s][1]-a*e[s+2][1])/6],o[3]=[e[s+1][0],e[s+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 s=n.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+b(s,n),t[1]+b(s,n)]})}}else r===3?(i.push({op:"move",data:[e[1][0],e[1][1]]}),i.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...At(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return i}function or(e,t,n,r,i,o,a,s){let d=s.roughness===0,l=[],c=[];if(d){e=e/4,c.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let p=0;p<=Math.PI*2;p=p+e){let u=[t+r*Math.cos(p),n+i*Math.sin(p)];l.push(u),c.push(u)}c.push([t+r*Math.cos(0),n+i*Math.sin(0)]),c.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let p=b(.5,s)-Math.PI/2;c.push([b(o,s)+t+.9*r*Math.cos(p-e),b(o,s)+n+.9*i*Math.sin(p-e)]);let u=Math.PI*2+p-.01;for(let f=p;f<u;f=f+e){let m=[b(o,s)+t+r*Math.cos(f),b(o,s)+n+i*Math.sin(f)];l.push(m),c.push(m)}c.push([b(o,s)+t+r*Math.cos(p+Math.PI*2+a*.5),b(o,s)+n+i*Math.sin(p+Math.PI*2+a*.5)]),c.push([b(o,s)+t+.98*r*Math.cos(p+a),b(o,s)+n+.98*i*Math.sin(p+a)]),c.push([b(o,s)+t+.9*r*Math.cos(p+a*.5),b(o,s)+n+.9*i*Math.sin(p+a*.5)])}return[c,l]}function sr(e,t,n,r,i,o,a,s,d){let l=o+b(.1,d),c=[];c.push([b(s,d)+t+.9*r*Math.cos(l-e),b(s,d)+n+.9*i*Math.sin(l-e)]);for(let p=l;p<=a;p=p+e)c.push([b(s,d)+t+r*Math.cos(p),b(s,d)+n+i*Math.sin(p)]);return c.push([t+r*Math.cos(a),n+i*Math.sin(a)]),c.push([t+r*Math.cos(a),n+i*Math.sin(a)]),ot(c,null,d)}function Pi(e,t,n,r,i,o,a,s){let d=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],c=[0,0],p=s.disableMultiStroke?1:2,u=s.preserveVertices;for(let f=0;f<p;f++)f===0?d.push({op:"move",data:[a[0],a[1]]}):d.push({op:"move",data:[a[0]+(u?0:b(l[0],s)),a[1]+(u?0:b(l[0],s))]}),c=u?[i,o]:[i+b(l[f],s),o+b(l[f],s)],d.push({op:"bcurveTo",data:[e+b(l[f],s),t+b(l[f],s),n+b(l[f],s),r+b(l[f],s),c[0],c[1]]});return d}function _e(e){return[...e]}function Pt(e,t=0){let n=e.length;if(n<3)throw new Error("A curve must have at least three points.");let r=[];if(n===3)r.push(_e(e[0]),_e(e[1]),_e(e[2]),_e(e[2]));else{let i=[];i.push(e[0],e[0]);for(let s=1;s<e.length;s++)i.push(e[s]),s===e.length-1&&i.push(e[s]);let o=[],a=1-t;r.push(_e(i[0]));for(let s=1;s+2<i.length;s++){let d=i[s];o[0]=[d[0],d[1]],o[1]=[d[0]+(a*i[s+1][0]-a*i[s-1][0])/6,d[1]+(a*i[s+1][1]-a*i[s-1][1])/6],o[2]=[i[s+1][0]+(a*i[s][0]-a*i[s+2][0])/6,i[s+1][1]+(a*i[s][1]-a*i[s+2][1])/6],o[3]=[i[s+1][0],i[s+1][1]],r.push(o[1],o[2],o[3])}}return r}function Ni(e,t){return Math.sqrt(ct(e,t))}function ct(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function ji(e,t,n){let r=ct(t,n);if(r===0)return ct(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),ct(e,ge(t,n,i))}function ge(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Li(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],o=e[t+3],a=3*r[0]-2*n[0]-o[0];a*=a;let s=3*r[1]-2*n[1]-o[1];s*=s;let d=3*i[0]-2*o[0]-n[0];d*=d;let l=3*i[1]-2*o[1]-n[1];return l*=l,a<d&&(a=d),s<l&&(s=l),a+s}function Nt(e,t,n,r){let i=r||[];if(Li(e,t)<n){let o=e[t+0];i.length?Ni(i[i.length-1],o)>1&&i.push(o):i.push(o),i.push(e[t+3])}else{let a=e[t+0],s=e[t+1],d=e[t+2],l=e[t+3],c=ge(a,s,.5),p=ge(s,d,.5),u=ge(d,l,.5),f=ge(c,p,.5),m=ge(p,u,.5),h=ge(f,m,.5);Nt([a,c,f,h],0,n,i),Nt([h,m,u,l],0,n,i)}return i}function dr(e,t){return lt(e,0,e.length,t)}function lt(e,t,n,r,i){let o=i||[],a=e[t],s=e[n-1],d=0,l=1;for(let c=t+1;c<n-1;++c){let p=ji(e[c],a,s);p>d&&(d=p,l=c)}return Math.sqrt(d)>r?(lt(e,t,l+1,r,o),lt(e,l,n,r,o)):(o.length||o.push(a),o.push(s)),o}function ze(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let o=0;o<i;o++){let a=o*3;Nt(e,a,t,r)}return n&&n>0?lt(r,0,r.length,n):r}function pr(e,t,n){let r=ve(e),i=je(Pe(r)),o=[],a=[],s=[0,0],d=[],l=()=>{d.length>=4&&a.push(...ze(d,t)),d=[]},c=()=>{l(),a.length&&(o.push(a),a=[])};for(let{key:u,data:f}of i)switch(u){case"M":c(),s=[f[0],f[1]],a.push(s);break;case"L":l(),a.push([f[0],f[1]]);break;case"C":if(!d.length){let m=a.length?a[a.length-1]:s;d.push([m[0],m[1]])}d.push([f[0],f[1]]),d.push([f[2],f[3]]),d.push([f[4],f[5]]);break;case"Z":l(),a.push([s[0],s[1]]);break}if(c(),!n)return o;let p=[];for(let u of o){let f=dr(u,n);f.length&&p.push(f)}return p}var B="none",dt=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 nr()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,r){return{shape:t,sets:n||[],options:r||this.defaultOptions}}line(t,n,r,i,o){let a=this._o(o);return this._d("line",[Ft(t,n,r,i,a)],a)}rectangle(t,n,r,i,o){let a=this._o(o),s=[],d=ar(t,n,r,i,a);if(a.fill){let l=[[t,n],[t+r,n],[t+r,n+i],[t,n+i]];a.fillStyle==="solid"?s.push(at([l],a)):s.push(ye([l],a))}return a.stroke!==B&&s.push(d),this._d("rectangle",s,a)}ellipse(t,n,r,i,o){let a=this._o(o),s=[],d=Tt(r,i,a),l=st(t,n,a,d);if(a.fill)if(a.fillStyle==="solid"){let c=st(t,n,a,d).opset;c.type="fillPath",s.push(c)}else s.push(ye([l.estimatedPoints],a));return a.stroke!==B&&s.push(l.opset),this._d("ellipse",s,a)}circle(t,n,r,i){let o=this.ellipse(t,n,r,r,i);return o.shape="circle",o}linearPath(t,n){let r=this._o(n);return this._d("linearPath",[Le(t,!1,r)],r)}arc(t,n,r,i,o,a,s=!1,d){let l=this._o(d),c=[],p=Dt(t,n,r,i,o,a,s,!0,l);if(s&&l.fill)if(l.fillStyle==="solid"){let u=Object.assign({},l);u.disableMultiStroke=!0;let f=Dt(t,n,r,i,o,a,!0,!1,u);f.type="fillPath",c.push(f)}else c.push(cr(t,n,r,i,o,a,l));return l.stroke!==B&&c.push(p),this._d("arc",c,l)}curve(t,n){let r=this._o(n),i=[],o=$t(t,r);if(r.fill&&r.fill!==B)if(r.fillStyle==="solid"){let a=$t(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{let a=[],s=t;if(s.length){let l=typeof s[0][0]=="number"?[s]:s;for(let c of l)c.length<3?a.push(...c):c.length===3?a.push(...ze(Pt([c[0],c[0],c[1],c[2]]),10,(1+r.roughness)/2)):a.push(...ze(Pt(c),10,(1+r.roughness)/2))}a.length&&i.push(ye([a],r))}return r.stroke!==B&&i.push(o),this._d("curve",i,r)}polygon(t,n){let r=this._o(n),i=[],o=Le(t,!0,r);return r.fill&&(r.fillStyle==="solid"?i.push(at([t],r)):i.push(ye([t],r))),r.stroke!==B&&i.push(o),this._d("polygon",i,r)}path(t,n){let r=this._o(n),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!==B,a=r.stroke!==B,s=!!(r.simplification&&r.simplification<1),d=s?4-4*(r.simplification||1):(1+r.roughness)/2,l=pr(t,1,d),c=It(t,r);if(o)if(r.fillStyle==="solid")if(l.length===1){let p=It(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(p.ops)})}else i.push(at(l,r));else i.push(ye(l,r));return a&&(s?l.forEach(p=>{i.push(Le(p,!1,r))}):i.push(c)),this._d("path",i,r)}opsToPath(t,n){let r="";for(let i of t.ops){let o=typeof n=="number"&&n>=0?i.data.map(a=>+a.toFixed(n)):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]} `;break}}return r.trim()}toPaths(t){let n=t.sets||[],r=t.options||this.defaultOptions,i=[];for(let o of n){let a=null;switch(o.type){case"path":a={d:this.opsToPath(o),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:B};break;case"fillPath":a={d:this.opsToPath(o),stroke:B,strokeWidth:0,fill:r.fill||B};break;case"fillSketch":a=this.fillSketch(o,r);break}a&&i.push(a)}return i}fillSketch(t,n){let r=n.fillWeight;return r<0&&(r=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||B,strokeWidth:r,fill:B}}_mergedShape(t){return t.filter((n,r)=>r===0?!0:n.op!=="move")}};var Z=new dt;function ur(e){return{roughness:e?.roughness??1,bowing:e?.bowing??1,passes:e?.passes??2,strokeWidth:e?.strokeWidth??1.6,fill:e?.fill??"none",hachureAngle:e?.hachureAngle??-41,hachureGap:e?.hachureGap??5,fillWeight:e?.fillWeight??.9}}function _i(e,t,n,r,i){return{seed:t,roughness:e.roughness,bowing:e.bowing,stroke:n,strokeWidth:r,disableMultiStroke:e.passes<2,...i?{fill:i,fillStyle:e.fill==="solid"?"solid":"hachure",fillWeight:e.fillWeight,hachureGap:e.hachureGap,hachureAngle:e.hachureAngle}:{},preserveVertices:!1}}function zi(e={}){return[`stroke-linecap="${e.lineCap??"round"}"`,`stroke-linejoin="${e.lineJoin??"round"}"`,...e.miterLimit!==void 0?[`stroke-miterlimit="${z(String(e.miterLimit))}"`]:[],...e.dashArray!==void 0?[`stroke-dasharray="${z(e.dashArray)}"`]:[],...e.dashOffset!==void 0?[`stroke-dashoffset="${z(String(e.dashOffset))}"`]:[],...e.opacity!==void 0?[`stroke-opacity="${z(String(e.opacity))}"`]:[],...e.pathLength!==void 0?[`pathLength="${z(String(e.pathLength))}"`]:[],...e.paintOrder!==void 0?[`paint-order="${z(e.paintOrder)}"`]:[],...e.nonScaling?['vector-effect="non-scaling-stroke"']:[]].join(" ")}function ce(e,t,n,r,i,o={},a){let s=[],d=zi(o),l=d?` ${d}`:" ",c=a===void 0?"":` stroke-opacity="${z(String(a))}"`;for(let p of e){let u=Z.opsToPath(p,2);u&&(p.type==="path"?s.push(`<path d="${u}" fill="none" stroke="${t}" stroke-width="${n}"${l}${c} />`):p.type==="fillPath"?s.push(`<path d="${u}" fill="${r}" fill-opacity="${z(String(a??.92))}" stroke="none" />`):p.type==="fillSketch"&&s.push(`<path d="${u}" fill="none" stroke="${r}" stroke-width="${i.fillWeight}"${c} />`))}return s.join(`
|
|
1
|
+
import{a as Qn,b as $}from"./chunk-RLS545DI.js";import{a as Hn}from"./chunk-WN7SFUCZ.js";import{b as Wn,c as qn}from"./chunk-QYJMRNS3.js";import{b as vn}from"./chunk-T7IJ6V4B.js";import"./chunk-5Q4S74UO.js";import"./chunk-STQRDZ67.js";import{a as mn,b as hn}from"./chunk-A7L4WWVW.js";import{a as Ot,b as kn,c as On}from"./chunk-EBPTM2RP.js";import{b as dn,c as pn}from"./chunk-KJVNXJ5Y.js";import"./chunk-M6BT2HIP.js";import{a as Un,b as Jn,c as Xn,d as Kn,f as Yn,g as Zn}from"./chunk-QMZ4Y6I7.js";import{b as un,d as fn,f as Rt}from"./chunk-FFOHLPDA.js";import{b as wt,c as Et}from"./chunk-I6VE56S7.js";import"./chunk-FLD63DXE.js";import"./chunk-32FWKUUV.js";import{$ as Xe,A as Rn,Aa as In,B as xt,Ba as ie,C as Ie,Ca as Pn,Da as Nn,E as kt,Ea as jn,Fa as Ln,Ga as _n,Ha as zn,Ia as Bn,Ja as Gn,K as xn,Ka as Vn,O as z,R as vt,S as wn,d as yn,da as En,g as gn,ga as Mn,h as bn,ha as re,ra as Cn,sa as An,ta as Fn,ua as $n,va as Tn,w as Sn,x as Je,za as Dn}from"./chunk-EX6TP7QM.js";import{e as He,f as Ue}from"./chunk-P7HMSKHJ.js";function Mt(e,t,n){if(e&&e.length){let[r,i]=t,o=Math.PI/180*n,a=Math.cos(o),s=Math.sin(o);for(let d of e){let[l,c]=d;d[0]=(l-r)*a-(c-i)*s+r,d[1]=(l-r)*s+(c-i)*a+i}}}function vi(e,t,n){let r=[];e.forEach(i=>r.push(...i)),Mt(r,t,n)}function wi(e,t){return e[0]===t[0]&&e[1]===t[1]}function er(e,t,n,r=1){let i=n,o=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,s=[0,0];if(i)for(let l of a)Mt(l,s,i);let d=Ei(a,o,r);if(i){for(let l of a)Mt(l,s,-i);vi(d,s,-i)}return d}function Ei(e,t,n){let r=[];for(let l of e){let c=[...l];wi(c[0],c[c.length-1])||c.push([c[0][0],c[0][1]]),c.length>2&&r.push(c)}let i=[];t=Math.max(t,.1);let o=[];for(let l of r)for(let c=0;c<l.length-1;c++){let p=l[c],u=l[c+1];if(p[1]!==u[1]){let f=Math.min(p[1],u[1]);o.push({ymin:f,ymax:Math.max(p[1],u[1]),x:f===p[1]?p[0]:u[0],islope:(u[0]-p[0])/(u[1]-p[1])})}}if(o.sort((l,c)=>l.ymin<c.ymin?-1:l.ymin>c.ymin?1:l.x<c.x?-1:l.x>c.x?1:l.ymax===c.ymax?0:(l.ymax-c.ymax)/Math.abs(l.ymax-c.ymax)),!o.length)return i;let a=[],s=o[0].ymin,d=0;for(;a.length||o.length;){if(o.length){let l=-1;for(let p=0;p<o.length&&!(o[p].ymin>s);p++)l=p;o.splice(0,l+1).forEach(p=>{a.push({s,edge:p})})}if(a=a.filter(l=>!(l.edge.ymax<=s)),a.sort((l,c)=>l.edge.x===c.edge.x?0:(l.edge.x-c.edge.x)/Math.abs(l.edge.x-c.edge.x)),(n!==1||d%t===0)&&a.length>1)for(let l=0;l<a.length;l=l+2){let c=l+1;if(c>=a.length)break;let p=a[l].edge,u=a[c].edge;i.push([[Math.round(p.x),s],[Math.round(u.x),s]])}s+=n,a.forEach(l=>{l.edge.x=l.edge.x+n*l.edge.islope}),d++}return i}function X(e,t){var n;let r=t.hachureAngle+90,i=t.hachureGap;i<0&&(i=t.strokeWidth*4),i=Math.round(Math.max(i,.1));let o=1;return t.roughness>=1&&(((n=t.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(o=i),er(e,i,r,o||1)}var oe=class{constructor(t){this.helper=t}fillPolygons(t,n){return this._fillPolygons(t,n)}_fillPolygons(t,n){let r=X(t,n);return{type:"fillSketch",ops:this.renderLines(r,n)}}renderLines(t,n){let r=[];for(let i of t)r.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],n));return r}};function se(e){let t=e[0],n=e[1];return Math.sqrt(Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2))}var Ke=class extends oe{fillPolygons(t,n){let r=n.hachureGap;r<0&&(r=n.strokeWidth*4),r=Math.max(r,.1);let i=Object.assign({},n,{hachureGap:r}),o=X(t,i),a=Math.PI/180*n.hachureAngle,s=[],d=r*.5*Math.cos(a),l=r*.5*Math.sin(a);for(let[p,u]of o)se([p,u])&&s.push([[p[0]-d,p[1]+l],[...u]],[[p[0]+d,p[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(s,n)}}};var Ye=class extends oe{fillPolygons(t,n){let r=this._fillPolygons(t,n),i=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),o=this._fillPolygons(t,i);return r.ops=r.ops.concat(o.ops),r}};var Ze=class{constructor(t){this.helper=t}fillPolygons(t,n){n=Object.assign({},n,{hachureAngle:0});let r=X(t,n);return this.dotsOnLines(r,n)}dotsOnLines(t,n){let r=[],i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);let o=n.fillWeight;o<0&&(o=n.strokeWidth/2);let a=i/4;for(let s of t){let d=se(s),l=d/i,c=Math.ceil(l)-1,p=d-c*i,u=(s[0][0]+s[1][0])/2-i/4,f=Math.min(s[0][1],s[1][1]);for(let m=0;m<c;m++){let h=f+p+m*i,y=u-a+Math.random()*2*a,g=h-a+Math.random()*2*a,S=this.helper.ellipse(y,g,o,o,n);r.push(...S.ops)}}return{type:"fillSketch",ops:r}}};var Qe=class{constructor(t){this.helper=t}fillPolygons(t,n){let r=X(t,n);return{type:"fillSketch",ops:this.dashedLine(r,n)}}dashedLine(t,n){let r=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,i=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,o=[];return t.forEach(a=>{let s=se(a),d=Math.floor(s/(r+i)),l=(s+i-d*(r+i))/2,c=a[0],p=a[1];c[0]>p[0]&&(c=a[1],p=a[0]);let u=Math.atan((p[1]-c[1])/(p[0]-c[0]));for(let f=0;f<d;f++){let m=f*(r+i),h=m+r,y=[c[0]+m*Math.cos(u)+l*Math.cos(u),c[1]+m*Math.sin(u)+l*Math.sin(u)],g=[c[0]+h*Math.cos(u)+l*Math.cos(u),c[1]+h*Math.sin(u)+l*Math.sin(u)];o.push(...this.helper.doubleLineOps(y[0],y[1],g[0],g[1],n))}}),o}};var et=class{constructor(t){this.helper=t}fillPolygons(t,n){let r=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,i=n.zigzagOffset<0?r:n.zigzagOffset;n=Object.assign({},n,{hachureGap:r+i});let o=X(t,n);return{type:"fillSketch",ops:this.zigzagLines(o,i,n)}}zigzagLines(t,n,r){let i=[];return t.forEach(o=>{let a=se(o),s=Math.round(a/(2*n)),d=o[0],l=o[1];d[0]>l[0]&&(d=o[1],l=o[0]);let c=Math.atan((l[1]-d[1])/(l[0]-d[0]));for(let p=0;p<s;p++){let u=p*2*n,f=(p+1)*2*n,m=Math.sqrt(2*Math.pow(n,2)),h=[d[0]+u*Math.cos(c),d[1]+u*Math.sin(c)],y=[d[0]+f*Math.cos(c),d[1]+f*Math.sin(c)],g=[h[0]+m*Math.cos(c+Math.PI/4),h[1]+m*Math.sin(c+Math.PI/4)];i.push(...this.helper.doubleLineOps(h[0],h[1],g[0],g[1],r),...this.helper.doubleLineOps(g[0],g[1],y[0],y[1],r))}}),i}};var j={};function tr(e,t){let n=e.fillStyle||"hachure";if(!j[n])switch(n){case"zigzag":j[n]||(j[n]=new Ke(t));break;case"cross-hatch":j[n]||(j[n]=new Ye(t));break;case"dots":j[n]||(j[n]=new Ze(t));break;case"dashed":j[n]||(j[n]=new Qe(t));break;case"zigzag-line":j[n]||(j[n]=new et(t));break;default:n="hachure",j[n]||(j[n]=new oe(t));break}return j[n]}function nr(){return Math.floor(Math.random()*2**31)}var tt=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};var nt={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 Mi(e){let t=new Array;for(;e!=="";)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:2,text:""},t}function Ct(e,t){return e.type===t}function ve(e){let t=[],n=Mi(e),r="BOD",i=0,o=n[i];for(;!Ct(o,2);){let a=0,s=[];if(r==="BOD")if(o.text==="M"||o.text==="m")i++,a=nt[o.text],r=o.text;else return ve("M0,0"+e);else Ct(o,1)?a=nt[r]:(i++,a=nt[o.text],r=o.text);if(i+a<n.length){for(let d=i;d<i+a;d++){let l=n[d];if(Ct(l,1))s[s.length]=+l.text;else throw new Error("Param not a number: "+r+","+l.text)}if(typeof nt[r]=="number"){let d={key:r,data:s};t.push(d),i+=a,o=n[i],r==="M"&&(r="L"),r==="m"&&(r="l")}else throw new Error("Bad segment: "+r)}else throw new Error("Path data ended short")}return t}function Pe(e){let t=0,n=0,r=0,i=0,o=[];for(let{key:a,data:s}of e)switch(a){case"M":o.push({key:"M",data:[...s]}),[t,n]=s,[r,i]=s;break;case"m":t+=s[0],n+=s[1],o.push({key:"M",data:[t,n]}),r=t,i=n;break;case"L":o.push({key:"L",data:[...s]}),[t,n]=s;break;case"l":t+=s[0],n+=s[1],o.push({key:"L",data:[t,n]});break;case"C":o.push({key:"C",data:[...s]}),t=s[4],n=s[5];break;case"c":{let d=s.map((l,c)=>c%2?l+n:l+t);o.push({key:"C",data:d}),t=d[4],n=d[5];break}case"Q":o.push({key:"Q",data:[...s]}),t=s[2],n=s[3];break;case"q":{let d=s.map((l,c)=>c%2?l+n:l+t);o.push({key:"Q",data:d}),t=d[2],n=d[3];break}case"A":o.push({key:"A",data:[...s]}),t=s[5],n=s[6];break;case"a":t+=s[5],n+=s[6],o.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case"H":o.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...s]}),n=s[0];break;case"v":n+=s[0],o.push({key:"V",data:[n]});break;case"S":o.push({key:"S",data:[...s]}),t=s[2],n=s[3];break;case"s":{let d=s.map((l,c)=>c%2?l+n:l+t);o.push({key:"S",data:d}),t=d[2],n=d[3];break}case"T":o.push({key:"T",data:[...s]}),t=s[0],n=s[1];break;case"t":t+=s[0],n+=s[1],o.push({key:"T",data:[t,n]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=r,n=i;break}return o}function je(e){let t=[],n="",r=0,i=0,o=0,a=0,s=0,d=0;for(let{key:l,data:c}of e){switch(l){case"M":t.push({key:"M",data:[...c]}),[r,i]=c,[o,a]=c;break;case"C":t.push({key:"C",data:[...c]}),r=c[4],i=c[5],s=c[2],d=c[3];break;case"L":t.push({key:"L",data:[...c]}),[r,i]=c;break;case"H":r=c[0],t.push({key:"L",data:[r,i]});break;case"V":i=c[0],t.push({key:"L",data:[r,i]});break;case"S":{let p=0,u=0;n==="C"||n==="S"?(p=r+(r-s),u=i+(i-d)):(p=r,u=i),t.push({key:"C",data:[p,u,...c]}),s=c[0],d=c[1],r=c[2],i=c[3];break}case"T":{let[p,u]=c,f=0,m=0;n==="Q"||n==="T"?(f=r+(r-s),m=i+(i-d)):(f=r,m=i);let h=r+2*(f-r)/3,y=i+2*(m-i)/3,g=p+2*(f-p)/3,S=u+2*(m-u)/3;t.push({key:"C",data:[h,y,g,S,p,u]}),s=f,d=m,r=p,i=u;break}case"Q":{let[p,u,f,m]=c,h=r+2*(p-r)/3,y=i+2*(u-i)/3,g=f+2*(p-f)/3,S=m+2*(u-m)/3;t.push({key:"C",data:[h,y,g,S,f,m]}),s=p,d=u,r=f,i=m;break}case"A":{let p=Math.abs(c[0]),u=Math.abs(c[1]),f=c[2],m=c[3],h=c[4],y=c[5],g=c[6];p===0||u===0?(t.push({key:"C",data:[r,i,y,g,y,g]}),r=y,i=g):(r!==y||i!==g)&&(rr(r,i,y,g,p,u,f,m,h).forEach(function(k){t.push({key:"C",data:k})}),r=y,i=g);break}case"Z":t.push({key:"Z",data:[]}),r=o,i=a;break}n=l}return t}function Ci(e){return Math.PI*e/180}function Ne(e,t,n){let r=e*Math.cos(n)-t*Math.sin(n),i=e*Math.sin(n)+t*Math.cos(n);return[r,i]}function rr(e,t,n,r,i,o,a,s,d,l){let c=Ci(a),p=[],u=0,f=0,m=0,h=0;if(l)[u,f,m,h]=l;else{[e,t]=Ne(e,t,-c),[n,r]=Ne(n,r,-c);let w=(e-n)/2,x=(t-r)/2,A=w*w/(i*i)+x*x/(o*o);A>1&&(A=Math.sqrt(A),i=A*i,o=A*o);let U=s===d?-1:1,F=i*i,R=o*o,Te=F*R-F*x*x-R*w*w,J=F*x*x+R*w*w,ne=U*Math.sqrt(Math.abs(Te/J));m=ne*i*x/o+(e+n)/2,h=ne*-o*w/i+(t+r)/2,u=Math.asin(parseFloat(((t-h)/o).toFixed(9))),f=Math.asin(parseFloat(((r-h)/o).toFixed(9))),e<m&&(u=Math.PI-u),n<m&&(f=Math.PI-f),u<0&&(u=Math.PI*2+u),f<0&&(f=Math.PI*2+f),d&&u>f&&(u=u-Math.PI*2),!d&&f>u&&(f=f-Math.PI*2)}let y=f-u;if(Math.abs(y)>Math.PI*120/180){let w=f,x=n,A=r;d&&f>u?f=u+Math.PI*120/180*1:f=u+Math.PI*120/180*-1,n=m+i*Math.cos(f),r=h+o*Math.sin(f),p=rr(n,r,x,A,i,o,a,0,d,[f,w,m,h])}y=f-u;let g=Math.cos(u),S=Math.sin(u),k=Math.cos(f),H=Math.sin(f),v=Math.tan(y/4),L=4/3*i*v,Y=4/3*o*v,_=[e,t],N=[e+L*S,t-Y*g],C=[n+L*H,r-Y*k],G=[n,r];if(N[0]=2*_[0]-N[0],N[1]=2*_[1]-N[1],l)return[N,C,G].concat(p);{p=[N,C,G].concat(p);let w=[];for(let x=0;x<p.length;x+=3){let A=Ne(p[x][0],p[x][1],c),U=Ne(p[x+1][0],p[x+1][1],c),F=Ne(p[x+2][0],p[x+2][1],c);w.push([A[0],A[1],U[0],U[1],F[0],F[1]])}return w}}var Ai={randOffset:Ti,randOffsetWithRange:Di,ellipse:$i,doubleLineOps:Ii};function Ft(e,t,n,r,i){return{type:"path",ops:ae(e,t,n,r,i)}}function Le(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let o=0;o<r-1;o++)i.push(...ae(e[o][0],e[o][1],e[o+1][0],e[o+1][1],n));return t&&i.push(...ae(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:"path",ops:i}}else if(r===2)return Ft(e[0][0],e[0][1],e[1][0],e[1][1],n);return{type:"path",ops:[]}}function Fi(e,t){return Le(e,!0,t)}function ar(e,t,n,r,i){let o=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];return Fi(o,i)}function $t(e,t){if(e.length){let r=typeof e[0][0]=="number"?[e]:e,i=rt(r[0],1*(1+t.roughness*.2),t),o=t.disableMultiStroke?[]:rt(r[0],1.5*(1+t.roughness*.22),ir(t));for(let a=1;a<r.length;a++){let s=r[a];if(s.length){let d=rt(s,1*(1+t.roughness*.2),t),l=t.disableMultiStroke?[]:rt(s,1.5*(1+t.roughness*.22),ir(t));for(let c of d)c.op!=="move"&&i.push(c);for(let c of l)c.op!=="move"&&o.push(c)}}return{type:"path",ops:i.concat(o)}}return{type:"path",ops:[]}}function $i(e,t,n,r,i){let o=Tt(n,r,i);return st(e,t,i,o).opset}function Tt(e,t,n){let r=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),o=Math.PI*2/i,a=Math.abs(e/2),s=Math.abs(t/2),d=1-n.curveFitting;return a+=b(a*d,n),s+=b(s*d,n),{increment:o,rx:a,ry:s}}function st(e,t,n,r){let[i,o]=or(r.increment,e,t,r.rx,r.ry,1,r.increment*it(.1,it(.4,1,n),n),n),a=ot(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[s]=or(r.increment,e,t,r.rx,r.ry,1.5,0,n),d=ot(s,null,n);a=a.concat(d)}return{estimatedPoints:o,opset:{type:"path",ops:a}}}function Dt(e,t,n,r,i,o,a,s,d){let l=e,c=t,p=Math.abs(n/2),u=Math.abs(r/2);p+=b(p*.01,d),u+=b(u*.01,d);let f=i,m=o;for(;f<0;)f+=Math.PI*2,m+=Math.PI*2;m-f>Math.PI*2&&(f=0,m=Math.PI*2);let h=Math.PI*2/d.curveStepCount,y=Math.min(h/2,(m-f)/2),g=sr(y,l,c,p,u,f,m,1,d);if(!d.disableMultiStroke){let S=sr(y,l,c,p,u,f,m,1.5,d);g.push(...S)}return a&&(s?g.push(...ae(l,c,l+p*Math.cos(f),c+u*Math.sin(f),d),...ae(l,c,l+p*Math.cos(m),c+u*Math.sin(m),d)):g.push({op:"lineTo",data:[l,c]},{op:"lineTo",data:[l+p*Math.cos(f),c+u*Math.sin(f)]})),{type:"path",ops:g}}function It(e,t){let n=je(Pe(ve(e))),r=[],i=[0,0],o=[0,0];for(let{key:a,data:s}of n)switch(a){case"M":{o=[s[0],s[1]],i=[s[0],s[1]];break}case"L":r.push(...ae(o[0],o[1],s[0],s[1],t)),o=[s[0],s[1]];break;case"C":{let[d,l,c,p,u,f]=s;r.push(...Pi(d,l,c,p,u,f,o,t)),o=[u,f];break}case"Z":r.push(...ae(o[0],o[1],i[0],i[1],t)),o=[i[0],i[1]];break}return{type:"path",ops:r}}function at(e,t){let n=[];for(let r of e)if(r.length){let i=t.maxRandomnessOffset||0,o=r.length;if(o>2){n.push({op:"move",data:[r[0][0]+b(i,t),r[0][1]+b(i,t)]});for(let a=1;a<o;a++)n.push({op:"lineTo",data:[r[a][0]+b(i,t),r[a][1]+b(i,t)]})}}return{type:"fillPath",ops:n}}function ye(e,t){return tr(t,Ai).fillPolygons(e,t)}function cr(e,t,n,r,i,o,a){let s=e,d=t,l=Math.abs(n/2),c=Math.abs(r/2);l+=b(l*.01,a),c+=b(c*.01,a);let p=i,u=o;for(;p<0;)p+=Math.PI*2,u+=Math.PI*2;u-p>Math.PI*2&&(p=0,u=Math.PI*2);let f=(u-p)/a.curveStepCount,m=[];for(let h=p;h<=u;h=h+f)m.push([s+l*Math.cos(h),d+c*Math.sin(h)]);return m.push([s+l*Math.cos(u),d+c*Math.sin(u)]),m.push([s,d]),ye([m],a)}function Ti(e,t){return b(e,t)}function Di(e,t,n){return it(e,t,n)}function Ii(e,t,n,r,i){return ae(e,t,n,r,i,!0)}function ir(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function lr(e){return e.randomizer||(e.randomizer=new tt(e.seed||0)),e.randomizer.next()}function it(e,t,n,r=1){return n.roughness*r*(lr(n)*(t-e)+e)}function b(e,t,n=1){return it(-e,e,t,n)}function ae(e,t,n,r,i,o=!1){let a=o?i.disableMultiStrokeFill:i.disableMultiStroke,s=At(e,t,n,r,i,!0,!1);if(a)return s;let d=At(e,t,n,r,i,!0,!0);return s.concat(d)}function At(e,t,n,r,i,o,a){let s=Math.pow(e-n,2)+Math.pow(t-r,2),d=Math.sqrt(s),l=1;d<200?l=1:d>500?l=.4:l=-.0016668*d+1.233334;let c=i.maxRandomnessOffset||0;c*c*100>s&&(c=d/10);let p=c/2,u=.2+lr(i)*.2,f=i.bowing*i.maxRandomnessOffset*(r-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-n)/200;f=b(f,i,l),m=b(m,i,l);let h=[],y=()=>b(p,i,l),g=()=>b(c,i,l),S=i.preserveVertices;return o&&(a?h.push({op:"move",data:[e+(S?0:y()),t+(S?0:y())]}):h.push({op:"move",data:[e+(S?0:b(c,i,l)),t+(S?0:b(c,i,l))]})),a?h.push({op:"bcurveTo",data:[f+e+(n-e)*u+y(),m+t+(r-t)*u+y(),f+e+2*(n-e)*u+y(),m+t+2*(r-t)*u+y(),n+(S?0:y()),r+(S?0:y())]}):h.push({op:"bcurveTo",data:[f+e+(n-e)*u+g(),m+t+(r-t)*u+g(),f+e+2*(n-e)*u+g(),m+t+2*(r-t)*u+g(),n+(S?0:g()),r+(S?0:g())]}),h}function rt(e,t,n){if(!e.length)return[];let r=[];r.push([e[0][0]+b(t,n),e[0][1]+b(t,n)]),r.push([e[0][0]+b(t,n),e[0][1]+b(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+b(t,n),e[i][1]+b(t,n)]),i===e.length-1&&r.push([e[i][0]+b(t,n),e[i][1]+b(t,n)]);return ot(r,null,n)}function ot(e,t,n){let r=e.length,i=[];if(r>3){let o=[],a=1-n.curveTightness;i.push({op:"move",data:[e[1][0],e[1][1]]});for(let s=1;s+2<r;s++){let d=e[s];o[0]=[d[0],d[1]],o[1]=[d[0]+(a*e[s+1][0]-a*e[s-1][0])/6,d[1]+(a*e[s+1][1]-a*e[s-1][1])/6],o[2]=[e[s+1][0]+(a*e[s][0]-a*e[s+2][0])/6,e[s+1][1]+(a*e[s][1]-a*e[s+2][1])/6],o[3]=[e[s+1][0],e[s+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 s=n.maxRandomnessOffset;i.push({op:"lineTo",data:[t[0]+b(s,n),t[1]+b(s,n)]})}}else r===3?(i.push({op:"move",data:[e[1][0],e[1][1]]}),i.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...At(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return i}function or(e,t,n,r,i,o,a,s){let d=s.roughness===0,l=[],c=[];if(d){e=e/4,c.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let p=0;p<=Math.PI*2;p=p+e){let u=[t+r*Math.cos(p),n+i*Math.sin(p)];l.push(u),c.push(u)}c.push([t+r*Math.cos(0),n+i*Math.sin(0)]),c.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let p=b(.5,s)-Math.PI/2;c.push([b(o,s)+t+.9*r*Math.cos(p-e),b(o,s)+n+.9*i*Math.sin(p-e)]);let u=Math.PI*2+p-.01;for(let f=p;f<u;f=f+e){let m=[b(o,s)+t+r*Math.cos(f),b(o,s)+n+i*Math.sin(f)];l.push(m),c.push(m)}c.push([b(o,s)+t+r*Math.cos(p+Math.PI*2+a*.5),b(o,s)+n+i*Math.sin(p+Math.PI*2+a*.5)]),c.push([b(o,s)+t+.98*r*Math.cos(p+a),b(o,s)+n+.98*i*Math.sin(p+a)]),c.push([b(o,s)+t+.9*r*Math.cos(p+a*.5),b(o,s)+n+.9*i*Math.sin(p+a*.5)])}return[c,l]}function sr(e,t,n,r,i,o,a,s,d){let l=o+b(.1,d),c=[];c.push([b(s,d)+t+.9*r*Math.cos(l-e),b(s,d)+n+.9*i*Math.sin(l-e)]);for(let p=l;p<=a;p=p+e)c.push([b(s,d)+t+r*Math.cos(p),b(s,d)+n+i*Math.sin(p)]);return c.push([t+r*Math.cos(a),n+i*Math.sin(a)]),c.push([t+r*Math.cos(a),n+i*Math.sin(a)]),ot(c,null,d)}function Pi(e,t,n,r,i,o,a,s){let d=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],c=[0,0],p=s.disableMultiStroke?1:2,u=s.preserveVertices;for(let f=0;f<p;f++)f===0?d.push({op:"move",data:[a[0],a[1]]}):d.push({op:"move",data:[a[0]+(u?0:b(l[0],s)),a[1]+(u?0:b(l[0],s))]}),c=u?[i,o]:[i+b(l[f],s),o+b(l[f],s)],d.push({op:"bcurveTo",data:[e+b(l[f],s),t+b(l[f],s),n+b(l[f],s),r+b(l[f],s),c[0],c[1]]});return d}function _e(e){return[...e]}function Pt(e,t=0){let n=e.length;if(n<3)throw new Error("A curve must have at least three points.");let r=[];if(n===3)r.push(_e(e[0]),_e(e[1]),_e(e[2]),_e(e[2]));else{let i=[];i.push(e[0],e[0]);for(let s=1;s<e.length;s++)i.push(e[s]),s===e.length-1&&i.push(e[s]);let o=[],a=1-t;r.push(_e(i[0]));for(let s=1;s+2<i.length;s++){let d=i[s];o[0]=[d[0],d[1]],o[1]=[d[0]+(a*i[s+1][0]-a*i[s-1][0])/6,d[1]+(a*i[s+1][1]-a*i[s-1][1])/6],o[2]=[i[s+1][0]+(a*i[s][0]-a*i[s+2][0])/6,i[s+1][1]+(a*i[s][1]-a*i[s+2][1])/6],o[3]=[i[s+1][0],i[s+1][1]],r.push(o[1],o[2],o[3])}}return r}function Ni(e,t){return Math.sqrt(ct(e,t))}function ct(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function ji(e,t,n){let r=ct(t,n);if(r===0)return ct(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),ct(e,ge(t,n,i))}function ge(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Li(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],o=e[t+3],a=3*r[0]-2*n[0]-o[0];a*=a;let s=3*r[1]-2*n[1]-o[1];s*=s;let d=3*i[0]-2*o[0]-n[0];d*=d;let l=3*i[1]-2*o[1]-n[1];return l*=l,a<d&&(a=d),s<l&&(s=l),a+s}function Nt(e,t,n,r){let i=r||[];if(Li(e,t)<n){let o=e[t+0];i.length?Ni(i[i.length-1],o)>1&&i.push(o):i.push(o),i.push(e[t+3])}else{let a=e[t+0],s=e[t+1],d=e[t+2],l=e[t+3],c=ge(a,s,.5),p=ge(s,d,.5),u=ge(d,l,.5),f=ge(c,p,.5),m=ge(p,u,.5),h=ge(f,m,.5);Nt([a,c,f,h],0,n,i),Nt([h,m,u,l],0,n,i)}return i}function dr(e,t){return lt(e,0,e.length,t)}function lt(e,t,n,r,i){let o=i||[],a=e[t],s=e[n-1],d=0,l=1;for(let c=t+1;c<n-1;++c){let p=ji(e[c],a,s);p>d&&(d=p,l=c)}return Math.sqrt(d)>r?(lt(e,t,l+1,r,o),lt(e,l,n,r,o)):(o.length||o.push(a),o.push(s)),o}function ze(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let o=0;o<i;o++){let a=o*3;Nt(e,a,t,r)}return n&&n>0?lt(r,0,r.length,n):r}function pr(e,t,n){let r=ve(e),i=je(Pe(r)),o=[],a=[],s=[0,0],d=[],l=()=>{d.length>=4&&a.push(...ze(d,t)),d=[]},c=()=>{l(),a.length&&(o.push(a),a=[])};for(let{key:u,data:f}of i)switch(u){case"M":c(),s=[f[0],f[1]],a.push(s);break;case"L":l(),a.push([f[0],f[1]]);break;case"C":if(!d.length){let m=a.length?a[a.length-1]:s;d.push([m[0],m[1]])}d.push([f[0],f[1]]),d.push([f[2],f[3]]),d.push([f[4],f[5]]);break;case"Z":l(),a.push([s[0],s[1]]);break}if(c(),!n)return o;let p=[];for(let u of o){let f=dr(u,n);f.length&&p.push(f)}return p}var B="none",dt=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 nr()}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,n,r){return{shape:t,sets:n||[],options:r||this.defaultOptions}}line(t,n,r,i,o){let a=this._o(o);return this._d("line",[Ft(t,n,r,i,a)],a)}rectangle(t,n,r,i,o){let a=this._o(o),s=[],d=ar(t,n,r,i,a);if(a.fill){let l=[[t,n],[t+r,n],[t+r,n+i],[t,n+i]];a.fillStyle==="solid"?s.push(at([l],a)):s.push(ye([l],a))}return a.stroke!==B&&s.push(d),this._d("rectangle",s,a)}ellipse(t,n,r,i,o){let a=this._o(o),s=[],d=Tt(r,i,a),l=st(t,n,a,d);if(a.fill)if(a.fillStyle==="solid"){let c=st(t,n,a,d).opset;c.type="fillPath",s.push(c)}else s.push(ye([l.estimatedPoints],a));return a.stroke!==B&&s.push(l.opset),this._d("ellipse",s,a)}circle(t,n,r,i){let o=this.ellipse(t,n,r,r,i);return o.shape="circle",o}linearPath(t,n){let r=this._o(n);return this._d("linearPath",[Le(t,!1,r)],r)}arc(t,n,r,i,o,a,s=!1,d){let l=this._o(d),c=[],p=Dt(t,n,r,i,o,a,s,!0,l);if(s&&l.fill)if(l.fillStyle==="solid"){let u=Object.assign({},l);u.disableMultiStroke=!0;let f=Dt(t,n,r,i,o,a,!0,!1,u);f.type="fillPath",c.push(f)}else c.push(cr(t,n,r,i,o,a,l));return l.stroke!==B&&c.push(p),this._d("arc",c,l)}curve(t,n){let r=this._o(n),i=[],o=$t(t,r);if(r.fill&&r.fill!==B)if(r.fillStyle==="solid"){let a=$t(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{let a=[],s=t;if(s.length){let l=typeof s[0][0]=="number"?[s]:s;for(let c of l)c.length<3?a.push(...c):c.length===3?a.push(...ze(Pt([c[0],c[0],c[1],c[2]]),10,(1+r.roughness)/2)):a.push(...ze(Pt(c),10,(1+r.roughness)/2))}a.length&&i.push(ye([a],r))}return r.stroke!==B&&i.push(o),this._d("curve",i,r)}polygon(t,n){let r=this._o(n),i=[],o=Le(t,!0,r);return r.fill&&(r.fillStyle==="solid"?i.push(at([t],r)):i.push(ye([t],r))),r.stroke!==B&&i.push(o),this._d("polygon",i,r)}path(t,n){let r=this._o(n),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!==B,a=r.stroke!==B,s=!!(r.simplification&&r.simplification<1),d=s?4-4*(r.simplification||1):(1+r.roughness)/2,l=pr(t,1,d),c=It(t,r);if(o)if(r.fillStyle==="solid")if(l.length===1){let p=It(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(p.ops)})}else i.push(at(l,r));else i.push(ye(l,r));return a&&(s?l.forEach(p=>{i.push(Le(p,!1,r))}):i.push(c)),this._d("path",i,r)}opsToPath(t,n){let r="";for(let i of t.ops){let o=typeof n=="number"&&n>=0?i.data.map(a=>+a.toFixed(n)):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]} `;break}}return r.trim()}toPaths(t){let n=t.sets||[],r=t.options||this.defaultOptions,i=[];for(let o of n){let a=null;switch(o.type){case"path":a={d:this.opsToPath(o),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:B};break;case"fillPath":a={d:this.opsToPath(o),stroke:B,strokeWidth:0,fill:r.fill||B};break;case"fillSketch":a=this.fillSketch(o,r);break}a&&i.push(a)}return i}fillSketch(t,n){let r=n.fillWeight;return r<0&&(r=n.strokeWidth/2),{d:this.opsToPath(t),stroke:n.fill||B,strokeWidth:r,fill:B}}_mergedShape(t){return t.filter((n,r)=>r===0?!0:n.op!=="move")}};var Z=new dt;function ur(e){return{roughness:e?.roughness??1,bowing:e?.bowing??1,passes:e?.passes??2,strokeWidth:e?.strokeWidth??1.6,fill:e?.fill??"none",hachureAngle:e?.hachureAngle??-41,hachureGap:e?.hachureGap??5,fillWeight:e?.fillWeight??.9}}function _i(e,t,n,r,i){return{seed:t,roughness:e.roughness,bowing:e.bowing,stroke:n,strokeWidth:r,disableMultiStroke:e.passes<2,...i?{fill:i,fillStyle:e.fill==="solid"?"solid":"hachure",fillWeight:e.fillWeight,hachureGap:e.hachureGap,hachureAngle:e.hachureAngle}:{},preserveVertices:!1}}function zi(e={}){return[`stroke-linecap="${e.lineCap??"round"}"`,`stroke-linejoin="${e.lineJoin??"round"}"`,...e.miterLimit!==void 0?[`stroke-miterlimit="${z(String(e.miterLimit))}"`]:[],...e.dashArray!==void 0?[`stroke-dasharray="${z(e.dashArray)}"`]:[],...e.dashOffset!==void 0?[`stroke-dashoffset="${z(String(e.dashOffset))}"`]:[],...e.opacity!==void 0?[`stroke-opacity="${z(String(e.opacity))}"`]:[],...e.pathLength!==void 0?[`pathLength="${z(String(e.pathLength))}"`]:[],...e.paintOrder!==void 0?[`paint-order="${z(e.paintOrder)}"`]:[],...e.nonScaling?['vector-effect="non-scaling-stroke"']:[]].join(" ")}function ce(e,t,n,r,i,o={},a){let s=[],d=zi(o),l=d?` ${d}`:" ",c=a===void 0?"":` stroke-opacity="${z(String(a))}"`;for(let p of e){let u=Z.opsToPath(p,2);u&&(p.type==="path"?s.push(`<path d="${u}" fill="none" stroke="${t}" stroke-width="${n}"${l}${c} />`):p.type==="fillPath"?s.push(`<path d="${u}" fill="${r}" fill-opacity="${z(String(a??.92))}" stroke="none" />`):p.type==="fillSketch"&&s.push(`<path d="${u}" fill="none" stroke="${r}" stroke-width="${i.fillWeight}"${c} />`))}return s.join(`
|
|
2
2
|
`)}function Bi(e,t,n,r,i){let o=Math.min(i,n/2,r/2);return`M ${e+o} ${t} L ${e+n-o} ${t} Q ${e+n} ${t} ${e+n} ${t+o} L ${e+n} ${t+r-o} Q ${e+n} ${t+r} ${e+n-o} ${t+r} L ${e+o} ${t+r} Q ${e} ${t+r} ${e} ${t+r-o} L ${e} ${t+o} Q ${e} ${t} ${e+o} ${t} Z`}function fr(e,t,n,r,i,o,a,s,d){return mr(e,t,n,r,i,o,a,s,d)}function mr(e,t,n,r,i,o,a,s,d){let l={...s,...a!==void 0?{dashArray:a}:{}},c=_i(o,t,n,r,i);try{switch(e.kind){case"rect":return(e.rx??0)>.5?ce(Z.path(Bi(e.x,e.y,e.width,e.height,e.rx),c).sets,n,r,i,o,l,d):ce(Z.rectangle(e.x,e.y,e.width,e.height,c).sets,n,r,i,o,l,d);case"circle":return ce(Z.circle(e.cx,e.cy,e.r*2,c).sets,n,r,i,o,l,d);case"ellipse":return ce(Z.ellipse(e.cx,e.cy,e.rx*2,e.ry*2,c).sets,n,r,i,o,l,d);case"line":return ce(Z.line(e.x1,e.y1,e.x2,e.y2,c).sets,n,r,void 0,o,l,d);case"polygon":return ce(Z.polygon(e.points.map(p=>[p.x,p.y]),c).sets,n,r,i,o,l,d);case"polyline":return ce(Z.linearPath(e.points.map(p=>[p.x,p.y]),c).sets,n,r,void 0,o,l,d);case"path":return ce(Z.path(e.d,c).sets,n,r,i,o,l,d);case"compound":return""}}catch{return""}}function we(e,t,n,r,i,o,a,s,d){if(e.sketcher){let l=e.sketcher(t,{seed:n,stroke:r,width:i,fill:o,p:e.p,style:e.ctx.style,dash:a,strokeProjection:s,opacity:d});if(l!==null)return l}return mr(t,n,r,i,o,e.p,a,s,d)}function hr(e,t,n){return e.replace(`<${t} `,`<${t} ${n} `)}function yr(e){if(e===void 0)return 1;let t=typeof e=="number"?e:parseFloat(e);return Number.isNaN(t)?1:t}function pt(e,t){return e!==void 0?e:t}function Gi(e,t){return/style="/.test(e)?e.replace(/style="([^"]*)"/,(n,r)=>{let i=r.trim().length===0||/;\s*$/.test(r)?"":";";return`style="${r}${i}stroke:none"`}):hr(e,t,'style="stroke:none"')}function jt(e,t){return!t||e===""?e:t.kind==="rotate"?`<g transform="rotate(${t.angle} ${t.cx} ${t.cy})">${e}</g>`:e}function Vi(e,t){let n=t.p,r=re(e),i=Dn(r),o=e.geometry.kind==="compound"?e.geometry.children:[e.geometry];if(i.length<o.length)return r;let a=r.split(`
|
|
3
3
|
`),s=c=>a.length===1&&c===0?r:a[c]??"",d=[];for(let c=0;c<o.length;c++){let p=i[c],u=pt(p.attrs.get("stroke"),e.paint.stroke),f=pt(p.attrs.get("fill"),e.paint.fill),m=Et(t.ctx.seed,e.id,`outline:${c}`)||1,h=yr(pt(p.attrs.get("stroke-width"),e.paint.strokeWidth)),y=pt(p.attrs.get("stroke-dasharray"),e.paint.strokeDasharray),g=u!==void 0&&u!=="none"&&h>0,S=f!==void 0&&f!=="none",k=S&&n.fill!=="none"?f:void 0;if(!g){if(k){let L=we(t,o[c],m,"none",0,k,y,void 0,e.paint.opacity);if(L){d.push(jt(L,e.transform));continue}}d.push(s(c));continue}let H=Math.max(.6,Math.min(n.strokeWidth*h,n.strokeWidth*4)),v=we(t,o[c],m,u,H,k,y,void 0,e.paint.opacity);if(!v){d.push(s(c));continue}S&&n.fill==="none"&&!Wi(f)&&d.push(Gi(s(c),p.tag)),d.push(jt(v,e.transform))}let l=d.filter(Boolean).join(`
|
|
4
4
|
`);return e.identity&&!/\sdata-id=/.test(l)?En(l,e.identity):l}function Wi(e){return e.startsWith("var(--_node-fill")||e.startsWith("var(--_group")||e==="var(--bg)"||e==="var(--surface)"}function qi(e,t){let n=re(e);if(e.lineStyle==="invisible"||n==="")return n;let r=e.stroke.color,i=yr(e.stroke.width);if(i<=0)return n;let o=t.p.strokeWidth*i,a=Et(t.ctx.seed,e.id,"stroke")||1,s=e.stroke.dash?typeof e.stroke.dash.array=="string"?e.stroke.dash.array:e.stroke.dash.array.join(" "):void 0,d={...s!==void 0?{dashArray:s}:{},...e.stroke.dash?.offset!==void 0?{dashOffset:e.stroke.dash.offset}:{},lineCap:e.stroke.lineCap,lineJoin:e.stroke.lineJoin,miterLimit:e.stroke.miterLimit,...e.stroke.opacity!==void 0?{opacity:e.stroke.opacity}:{},...e.stroke.pathLength!==void 0?{pathLength:e.stroke.pathLength}:{},...e.stroke.paintOrder!==void 0?{paintOrder:e.stroke.paintOrder}:{},nonScaling:e.stroke.nonScaling},l="",c=e.route.geometry;if(c.kind==="polyline")l=we(t,{kind:"polyline",points:c.points},a,r,o,void 0,s,d);else if(c.kind==="line")l=we(t,c,a,r,o,void 0,s,d);else{let f=Mn(c,e.route.closed);if(f.length===1&&(l=we(t,{kind:"path",d:c.d},a,r,o,void 0,s,d)),!l&&c.points.length>1){let m=f.map((h,y)=>{let g=h.points[0],S=h.points.at(-1),k=h.closed&&g&&S&&(g.x!==S.x||g.y!==S.y)?[...h.points,g]:h.points;return we(t,{kind:"polyline",points:[...k]},a+y,r,o,void 0,s,d)});l=m.every(Boolean)?m.join(`
|
|
@@ -9,4 +9,4 @@ ${jt(l,e.transform)}`}function Hi(e){return re(e).replace(/<text /g,'<text paint
|
|
|
9
9
|
`)}}}var gr=_t("rough");var{PI:Ji}=Math,Be=Ji+1e-4,br=.5,Sr=[1,1];function Rr(e,t,n,r=i=>i){return e*r(.5-t*(.5-n))}var{min:zt}=Math;function Ar(e,t,n){let r=zt(1,t/n);return zt(1,e+(zt(1,1-r)-e)*(r*.275))}function Xi(e){return[-e[0],-e[1]]}function K(e,t){return[e[0]+t[0],e[1]+t[1]]}function xr(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function ue(e,t){return[e[0]-t[0],e[1]-t[1]]}function Vt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function pe(e,t){return[e[0]*t,e[1]*t]}function Bt(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function Ki(e,t){return[e[0]/t,e[1]/t]}function Fr(e){return[e[1],-e[0]]}function Gt(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function kr(e,t){return e[0]*t[0]+e[1]*t[1]}function Yi(e,t){return e[0]===t[0]&&e[1]===t[1]}function Zi(e){return Math.hypot(e[0],e[1])}function Or(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function $r(e){return Ki(e,Zi(e))}function Qi(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Wt(e,t,n){let r=Math.sin(n),i=Math.cos(n),o=e[0]-t[0],a=e[1]-t[1],s=o*i-a*r,d=o*r+a*i;return[s+t[0],d+t[1]]}function vr(e,t,n,r){let i=Math.sin(r),o=Math.cos(r),a=t[0]-n[0],s=t[1]-n[1],d=a*o-s*i,l=a*i+s*o;return e[0]=d+n[0],e[1]=l+n[1],e}function wr(e,t,n){return K(e,pe(ue(t,e),n))}function eo(e,t,n,r){let i=n[0]-t[0],o=n[1]-t[1];return e[0]=t[0]+i*r,e[1]=t[1]+o*r,e}function Tr(e,t,n){return K(e,pe(t,n))}var M=[0,0],le=[0,0],de=[0,0];function to(e,t){let n=Tr(e,$r(Fr(ue(e,K(e,[1,1])))),-t),r=[],i=1/13;for(let o=i;o<=1;o+=i)r.push(Wt(n,e,Be*2*o));return r}function no(e,t,n){let r=[],i=1/n;for(let o=i;o<=1;o+=i)r.push(Wt(t,e,Be*o));return r}function ro(e,t,n){let r=ue(t,n),i=pe(r,.5),o=pe(r,.51);return[ue(e,i),ue(e,o),K(e,o),K(e,i)]}function io(e,t,n,r){let i=[],o=Tr(e,t,n),a=1/r;for(let s=a;s<1;s+=a)i.push(Wt(o,e,Be*3*s));return i}function oo(e,t,n){return[K(e,pe(t,n)),K(e,pe(t,n*.99)),ue(e,pe(t,n*.99)),ue(e,pe(t,n))]}function Er(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function so(e,t,n){return e.slice(0,10).reduce((r,i)=>{let o=i.pressure;return t&&(o=Ar(r,i.distance,n)),(r+o)/2},e[0].pressure)}function ao(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:o=!0,easing:a=R=>R,start:s={},end:d={},last:l=!1}=t,{cap:c=!0,easing:p=R=>R*(2-R)}=s,{cap:u=!0,easing:f=R=>--R*R*R+1}=d;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=Er(s.taper,n,m),y=Er(d.taper,n,m),g=(n*r)**2,S=[],k=[],H=so(e,o,n),v=Rr(n,i,e[e.length-1].pressure,a),L,Y=e[0].vector,_=e[0].point,N=_,C=_,G=N,w=!1;for(let R=0;R<e.length;R++){let{pressure:Te}=e[R],{point:J,vector:ne,distance:Ri,runningLength:De}=e[R],We=R===e.length-1;if(!We&&m-De<3)continue;i?(o&&(Te=Ar(H,Ri,n)),v=Rr(n,i,Te,a)):v=n/2,L===void 0&&(L=v);let xi=De<h?p(De/h):1,ki=m-De<y?f((m-De)/y):1;v=Math.max(.01,v*Math.min(xi,ki));let cn=(We?e[R]:e[R+1]).vector,St=We?1:kr(ne,cn),Oi=kr(ne,Y)<0&&!w,ln=St!==null&&St<0;if(Oi||ln){Gt(M,Y),Bt(M,M,v);for(let qe=0;qe<=1;qe+=.07692307692307693)Vt(le,J,M),vr(le,le,J,Be*qe),C=[le[0],le[1]],S.push(C),xr(de,J,M),vr(de,de,J,Be*-qe),G=[de[0],de[1]],k.push(G);_=C,N=G,ln&&(w=!0);continue}if(w=!1,We){Gt(M,ne),Bt(M,M,v),S.push(ue(J,M)),k.push(K(J,M));continue}eo(M,cn,ne,St),Gt(M,M),Bt(M,M,v),Vt(le,J,M),C=[le[0],le[1]],(R<=1||Or(_,C)>g)&&(S.push(C),_=C),xr(de,J,M),G=[de[0],de[1]],(R<=1||Or(N,G)>g)&&(k.push(G),N=G),H=Te,Y=ne}let x=[e[0].point[0],e[0].point[1]],A=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:K(e[0].point,[1,1]),U=[],F=[];if(e.length===1){if(!(h||y)||l)return to(x,L||v)}else{h||y&&e.length===1||(c?U.push(...no(x,k[0],13)):U.push(...ro(x,S[0],k[0])));let R=Fr(Xi(e[e.length-1].vector));y||h&&e.length===1?F.push(A):u?F.push(...io(A,R,v,29)):F.push(...oo(A,R,v))}return S.concat(F,k.reverse(),U)}var Mr=[0,0];function Cr(e){return e!=null&&e>=0}function co(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let o=.15+(1-n)*.85,a=Array.isArray(e[0])?e:e.map(({x:u,y:f,pressure:m=br})=>[u,f,m]);if(a.length===2){let u=a[1];a=a.slice(0,-1);for(let f=1;f<5;f++)a.push(wr(a[0],u,f/4))}a.length===1&&(a=[...a,[...K(a[0],Sr),...a[0].slice(2)]]);let s=[{point:[a[0][0],a[0][1]],pressure:Cr(a[0][2])?a[0][2]:.25,vector:[...Sr],distance:0,runningLength:0}],d=!1,l=0,c=s[0],p=a.length-1;for(let u=1;u<a.length;u++){let f=i&&u===p?[a[u][0],a[u][1]]:wr(c.point,a[u],o);if(Yi(c.point,f))continue;let m=Qi(f,c.point);if(l+=m,u<p&&!d){if(l<r)continue;d=!0}Vt(Mr,c.point,f),c={point:f,pressure:Cr(a[u][2])?a[u][2]:br,vector:$r(Mr),distance:m,runningLength:l},s.push(c)}return s[0].vector=s[1]?.vector||[0,0],s}function Dr(e,t={}){return ao(co(e,t),t)}var fe=e=>Math.round(e*1e3)/1e3,Ir=(e,t,n)=>e+(t-e)*n,lo=e=>Math.max(0,Math.min(1,e));function Pr(e){switch(e.kind){case"rect":return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];case"polygon":return e.points;case"circle":{let t=[];for(let n=0;n<24;n++){let r=n/24*Math.PI*2;t.push({x:e.cx+Math.cos(r)*e.r,y:e.cy+Math.sin(r)*e.r})}return t}case"ellipse":{let t=[];for(let n=0;n<28;n++){let r=n/28*Math.PI*2;t.push({x:e.cx+Math.cos(r)*e.rx,y:e.cy+Math.sin(r)*e.ry})}return t}default:return null}}function po(e){if(e.length<2)return"";let t=[`M${fe(e[0][0])},${fe(e[0][1])}`];for(let n=1;n<e.length;n++){let[r,i]=e[n],[o,a]=e[(n+1)%e.length];t.push(`Q${fe(r)},${fe(i)} ${fe((r+o)/2)},${fe((i+a)/2)}`)}return t.push("Z"),t.join(" ")}function uo(e,t,n,r){let i=n?[...e,e[0]]:e,o=[];for(let s=0;s<i.length-1;s++){let d=i[s],l=i[s+1],c=Math.hypot(l.x-d.x,l.y-d.y)||1,p=Math.max(1,Math.ceil(c/14)),u=-(l.y-d.y)/c,f=(l.x-d.x)/c;for(let m=0;m<p;m++){if(s>0&&m===0)continue;let h=m/p,g=!n&&(s===0&&m===0||s===i.length-2&&m===p)?0:(t()-.5)*2*r,S={x:Ir(d.x,l.x,h)+u*g,y:Ir(d.y,l.y,h)+f*g},k=(s+h)/Math.max(1,i.length-1),H=lo(.52+Math.sin(k*Math.PI*2)*.12+(t()-.5)*.16);o.push([S.x,S.y,H])}}let a=i[i.length-1];return o.push([a.x,a.y,n?o[0]?.[2]??.55:.46]),o}function qt(e,t,n){if(e.length<2)return"";let r=uo(e,t,n.closed,1),i=Dr(r,{size:n.width,thinning:.58,smoothing:.62,streamline:.35,simulatePressure:!1,start:{cap:!0,taper:n.closed?0:10},end:{cap:!0,taper:n.closed?0:14},last:!0});return po(i)}function fo(e,t,n,r,i){let a=e.map(s=>({x:s.x+(t()-.5)*3,y:s.y+(t()-.5)*3})).map((s,d)=>`${d?"L":"M"}${fe(s.x)},${fe(s.y)}`).join(" ")+" Z";return`<path d="${a}" fill="${n}" fill-opacity="${r}" stroke="none" />
|
|
10
10
|
<path d="${a}" fill="none" stroke="${n}" stroke-width="1.4" stroke-opacity="${i}" />`}var mo=(e,t)=>{let n=t.style?.stroke??"jittered",i=(t.style?.fill??"none")==="wash"&&t.fill!==void 0,o=n==="freehand",a=t.opacity===void 0?void 0:Number(t.opacity);if(!i&&!o)return null;let s=[];if(i){let l=wt((t.seed^2654435769)>>>0),c=e.kind==="path"?null:Pr(e);c?s.push(fo(c,l,t.fill,a??t.style?.washOpacity??.3,t.style?.washEdge??.34)):e.kind==="path"&&s.push(`<path d="${e.d}" fill="${t.fill}" fill-opacity="${a??t.style?.washOpacity??.3}" stroke="${t.fill}" stroke-width="1.4" stroke-opacity="${t.style?.washEdge??.34}" />`)}if(o&&!t.dash){let l=wt(t.seed||1),c=Math.max(2.5,t.width*2.2),p="";if(e.kind==="polyline")p=qt(e.points,l,{width:c,closed:!1});else if(e.kind==="line")p=qt([{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}],l,{width:c,closed:!1});else{let u=Pr(e);u&&(p=qt(u,l,{width:c,closed:!0}))}if(p){let u=t.strokeProjection?[...t.strokeProjection.opacity!==void 0?[`opacity="${z(String(t.strokeProjection.opacity))}"`]:[],...t.strokeProjection.paintOrder!==void 0?[`paint-order="${z(t.strokeProjection.paintOrder)}"`]:[]].join(" "):"",f=a===void 0?"":` fill-opacity="${z(String(a))}"`;return s.push(`<path d="${p}" fill="${t.stroke}" stroke="none"${f}${u?` ${u}`:""} />`),s.join(`
|
|
11
11
|
`)}}let d=fr(e,t.seed,t.stroke,t.width,i?void 0:t.fill,t.p,t.dash,t.strokeProjection,t.opacity);return d&&s.push(d),s.length>0?s.join(`
|
|
12
|
-
`):null},Nr=_t("hybrid",mo);var ho=Object.freeze([Bn,gr,Nr]);for(let e of ho)Gn(e);function jr(e,t){return e.match(new RegExp(`\\b${t}\\s*=\\s*(["'])(.*?)\\1`,"i"))?.[2]}function Ht(e,t){return jr(e,"style")?.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"))?.[1]?.trim()??jr(e,t)}function Lr(e,t,n){let r=Number.parseFloat(Ht(e,t)??"");return Number.isFinite(r)?r:n}function _r(e,t){let n=Ht(e,"font-weight")?.trim().toLowerCase();if(n===void 0)return t;if(n==="normal")return 400;if(n==="bold")return 700;if(n==="bolder")return t<350?400:t<550?700:900;if(n==="lighter")return t<550?100:t<750?400:700;let r=Number.parseFloat(n);return Number.isFinite(r)?r:t}function yo(e){return/\bclass\s*=\s*(["'])[^"']*\bmono\b/i.test(e)||/(?:^|[,\s])monospace(?:[,\s]|$)/i.test(Ht(e,"font-family")??"")}function go(e,t){let n="";for(let r=t+1;r<e.length;r++){let i=e[r];if(n){i===n&&(n="");continue}if(i==='"'||i==="'"){n=i;continue}if(i===">")return r}return-1}function bo(e){let t=[],n=[],r=0;for(;r<e.length;){let i=e.indexOf("<",r);if(i<0){n.length>0&&r<e.length&&n[n.length-1].children.push({kind:"text-node",raw:e.slice(r)}),r=e.length;break}if(n.length>0&&i>r&&n[n.length-1].children.push({kind:"text-node",raw:e.slice(r,i)}),e.startsWith("<!--",i)){let c=e.indexOf("-->",i+4);if(c<0)return null;r=c+3;continue}let o=go(e,i);if(o<0)return null;let a=e.slice(i,o+1);if(/^<\?/.test(a)||/^<!/.test(a)){r=o+1;continue}let s=a.match(/^<\/\s*([\w:-]+)\s*>$/);if(s){let c=n.pop();if(!c||c.name!==s[1].toLowerCase())return null;c.closeStart=i,r=o+1;continue}let d=a.match(/^<\s*([\w:-]+)([\s\S]*?)(\/?)>$/);if(!d)return null;let l={kind:"element",name:d[1].toLowerCase(),attrs:d[2],openEnd:o+1,closeStart:o+1,children:[]};n.length>0?n[n.length-1].children.push(l):t.push(l),d[3]!=="/"&&n.push(l),r=o+1}return n.length===0?t:null}function zr(e){return e.children.filter(t=>t.kind==="element")}function Br(e,t){let n=t.name==="b"||t.name==="strong";return{size:Lr(t.attrs,"font-size",e.size),weight:n?Math.max(700,_r(t.attrs,e.weight)):_r(t.attrs,e.weight),letterSpacing:Lr(t.attrs,"letter-spacing",e.letterSpacing),mono:e.mono||yo(t.attrs)}}function Ut(e,t){return new RegExp(`\\b${t}\\s*=`,"i").test(e)}function Jt(e){return e.name==="tspan"&&["x","y","dx","dy"].some(t=>Ut(e.attrs,t))}function Gr(e){return zr(e).some(t=>Jt(t)||Gr(t))}function So(e,t){let n=[],r=!1,i=(o,a,s)=>{let d=Br(a,o);if(!(!s&&Jt(o))){if(!s&&Ut(o.attrs,"textLength")){r=!0;return}for(let l of o.children)if(l.kind==="text-node"){let c=He(l.raw);c.length>0&&n.push({text:c,metrics:d})}else i(l,d,!1)}};return i(e,t,!0),{runs:n,blocked:r}}function Ro(e){let t=e.filter(o=>o.text.length>0);if(t.length===0||t.every(o=>o.text.trim().length===0))return null;let n=0,r=0,i=0;for(let o of t){if(!(o.metrics.size>0))return null;let a=yn(o.text).length;r>0&&a>0&&(n+=i),n+=o.metrics.mono?gn(o.text,o.metrics.size,o.metrics.letterSpacing):bn(o.text,o.metrics.size,o.metrics.weight,o.metrics.letterSpacing),r=a,i=o.metrics.letterSpacing}return Math.round(n*1e3)/1e3}function Vr(e,t){let n=bo(e);if(!n)return e;let r=[],i={size:0,weight:400,letterSpacing:0,mono:!1},o=(s,d,l)=>{let c=Br(d,s),p=s.name==="text"&&!l,u=p||l&&Jt(s);if(u&&Ut(s.attrs,"textLength"))return;if(u&&!(p&&Gr(s))){let h=So(s,d),y=h.blocked?null:Ro(h.runs);y!==null&&r.push({offset:s.openEnd-1,text:` textLength="${y}" lengthAdjust="spacingAndGlyphs" data-font-metrics="deterministic-fit"`})}let m=l||p;for(let h of zr(s))o(h,c,m)};for(let s of n)o(s,i,!1);let a=e;for(let s of r.sort((d,l)=>l.offset-d.offset))a=a.slice(0,s.offset)+s.text+a.slice(s.offset);return a}function be(e,t){if(!e||typeof e!="object"||Array.isArray(e))return;let n=e[t];return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}function xo(e,t,n){if(!n)return[];let r=t&&typeof t=="object"&&!Array.isArray(t)?t:void 0,i=be(t,n.section);if(!i)return r&&n.section in r?[{code:"INEFFECTIVE_CONFIG",field:n.section,message:`${e} config section "${n.section}" must be an object; the invalid value has no effect.`}]:[];let o=new Set(n.keys);return Object.keys(i).filter(a=>!o.has(a)).sort().map(a=>({code:"INEFFECTIVE_CONFIG",field:`${n.section}.${a}`,message:`${e} config field "${a}" is unknown and has no effect; check the spelling or remove it.`}))}var D=(e,t)=>({expected:e,valid:t}),T=D("a finite positive number",e=>typeof e=="number"&&Number.isFinite(e)&&e>0),V=D("a finite non-negative number",e=>typeof e=="number"&&Number.isFinite(e)&&e>=0),ko=D("a finite number",e=>typeof e=="number"&&Number.isFinite(e)),O=D("a boolean",e=>typeof e=="boolean"),Xt=D("a non-empty string",e=>typeof e=="string"&&e.trim().length>0),Kt=D("a non-empty array of strings",e=>Array.isArray(e)&&e.length>0&&e.every(t=>typeof t=="string")),Wr=(...e)=>D(`one of: ${e.join(", ")}`,t=>typeof t=="string"&&e.includes(t)),qr=(...e)=>D(`one of: ${e.join(", ")} (case-insensitive)`,t=>typeof t=="string"&&e.some(n=>n.toLowerCase()===t.toLowerCase())),Ee=(e,t,n=!0)=>D(`a finite number ${n?"from":"greater than"} ${e} through ${t}`,r=>typeof r=="number"&&Number.isFinite(r)&&(n?r>=e:r>e)&&r<=t),Q=e=>D(`a finite positive number no greater than ${e}`,t=>typeof t=="number"&&Number.isFinite(t)&&t>0&&t<=e),ut=e=>D(`a finite non-negative number no greater than ${e}`,t=>typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=e),Oo=D("a finite positive number or non-empty CSS size string",e=>typeof e=="number"&&Number.isFinite(e)&&e>0||typeof e=="string"&&e.trim().length>0),Ge=(e,t=!1)=>D(`a numeric value${t?` greater than ${e}`:` of at least ${e}`}`,n=>{let r=typeof n=="number"?n:typeof n=="string"&&/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:px)?$/i.test(n.trim())?Number.parseFloat(n):Number.NaN;return Number.isFinite(r)&&(t?r>e:r>=e)}),vo={flowchart:{nodeSpacing:T,rankSpacing:T,wrappingWidth:T},sequence:Object.fromEntries([...["actorMargin","width","height","diagramMarginX","diagramMarginY","messageMargin","noteMargin","activationWidth"].map(e=>[e,V]),["showSequenceNumbers",O]]),timeline:{disableMulticolor:O,sectionFills:Kt,sectionColours:Kt},journey:Object.fromEntries([...["diagramMarginX","diagramMarginY","leftMargin","maxLabelWidth","width","height","taskMargin"].map(e=>[e,T]),...["taskFontSize","titleFontSize"].map(e=>[e,Oo]),...["taskFontFamily","titleColor","titleFontFamily"].map(e=>[e,Xt]),...["actorColours","sectionFills","sectionColours"].map(e=>[e,Kt]),["useMaxWidth",O]]),radar:{width:Q($.dimension),height:Q($.dimension),marginTop:ut($.margin),marginRight:ut($.margin),marginBottom:ut($.margin),marginLeft:ut($.margin),axisScaleFactor:Q($.factor),axisLabelFactor:Ee($.axisLabelFactorMin,$.factor),curveTension:Ee(0,1),useMaxWidth:O,tickLabels:O},class:{nodeSpacing:V,rankSpacing:V,hierarchicalNamespaces:O},er:{layoutDirection:qr("TB","TD","BT","LR","RL"),nodeSpacing:V,rankSpacing:V},architecture:{padding:Ge(0),iconSize:Ge(0,!0),fontSize:Ge(0,!0),nodeSeparation:Ge(0),idealEdgeLengthMultiplier:Ge(0,!0)},xychart:{width:T,height:T,useMaxWidth:O,useWidth:T,titleFontSize:T,titlePadding:V,chartOrientation:Wr("vertical","horizontal"),plotReservedSpacePercent:Ee(0,100,!1),showDataLabel:O,showTitle:O,showLegend:O,legendFontSize:T,legendPadding:V,xAxis:D("an axis-config object",e=>!!e&&typeof e=="object"&&!Array.isArray(e)),yAxis:D("an axis-config object",e=>!!e&&typeof e=="object"&&!Array.isArray(e))},pie:{textPosition:Ee(0,1),donutHole:Ee(0,.9),legendPosition:Wr("top","bottom","left","right","center")},quadrant:Object.fromEntries([...["chartWidth","chartHeight","titleFontSize","quadrantLabelFontSize","xAxisLabelFontSize","yAxisLabelFontSize","pointLabelFontSize","pointRadius"].map(e=>[e,T]),...["titlePadding","quadrantPadding","xAxisLabelPadding","yAxisLabelPadding","pointTextPadding","quadrantInternalBorderStrokeWidth","quadrantExternalBorderStrokeWidth"].map(e=>[e,V]),["useMaxWidth",O]]),gantt:{displayMode:qr("compact"),barHeight:T,topAxis:O,axisFormat:Xt,tickInterval:D('a positive Mermaid interval such as "1day" or "2week"',e=>typeof e=="string"&&/^[1-9]\d*(?:millisecond|second|minute|hour|day|week|month)$/i.test(e.trim()))},mindmap:{padding:V,maxNodeWidth:T},gitgraph:{showBranches:O,showCommitLabel:O,parallelCommits:O,rotateCommitLabel:O,mainBranchName:Xt,mainBranchOrder:ko}},wo={showLabel:O,labelFontSize:T,labelPadding:V,showTitle:O,titleFontSize:T,titlePadding:V,showTick:O,tickLength:V,tickWidth:T,showAxisLine:O,axisLineWidth:T};function Eo(e){let t=be(e,"themeVariables");if(!t||!("radar"in t))return[];let n=be(t,"radar");if(!n)return[{code:"INEFFECTIVE_CONFIG",field:"themeVariables.radar",message:"themeVariables.radar must be an object; the invalid value has no effect."}];let r=new Set(Qn),i=[],o=new Set(["axisStrokeWidth","curveStrokeWidth","graticuleStrokeWidth"]),a=new Set(["axisLabelFontSize","legendFontSize"]),s=new Set(["curveOpacity","graticuleOpacity"]),d=new Set(["axisColor","graticuleColor"]);for(let l of Object.keys(n).sort(Ue)){let c=n[l],p;r.has(l)?o.has(l)&&!Q($.lineWidth).valid(c)?p=Q($.lineWidth).expected:a.has(l)&&!Q($.fontSize).valid(c)?p=Q($.fontSize).expected:l==="legendBoxSize"&&!Q($.legendBoxSize).valid(c)?p=Q($.legendBoxSize).expected:s.has(l)&&!Ee(0,1).valid(c)?p="a finite number from 0 through 1":d.has(l)&&!Ie(c)&&(p="a safe CSS color without url(), variables, or context-breaking characters"):p="a documented radar theme field",p&&i.push({code:"INEFFECTIVE_CONFIG",field:`themeVariables.radar.${l}`,message:`themeVariables.radar.${l} must be ${p}; the invalid value has no effect.`})}return i}function Mo(e,t,n){if(e==="state")return[];if(!n)return[];let r=be(t,n.section),i=e==="radar"?Eo(t):[],o=(a,s)=>{i.push({code:"INEFFECTIVE_CONFIG",field:a,message:`${a} must be ${s}; the invalid value has no effect.`})};if(e==="mindmap"){let a=t&&typeof t=="object"&&!Array.isArray(t)?t:void 0;a&&"layout"in a&&!["tidy-tree","cose-bilkent","radial"].includes(String(a.layout))&&o("layout",'"cose-bilkent", "radial", or "tidy-tree" for mindmap diagrams')}if(!r)return i;for(let[a,s]of Object.entries(vo[e]??{}))a in r&&!s.valid(r[a])&&o(`${n.section}.${a}`,s.expected);if(e==="xychart")for(let a of["xAxis","yAxis"]){let s=r[a];if(!s||typeof s!="object"||Array.isArray(s))continue;let d=s;for(let l of Object.keys(d).sort()){let c=wo[l];c?c.valid(d[l])||o(`xyChart.${a}.${l}`,c.expected):o(`xyChart.${a}.${l}`,"a documented axis-config field")}}return i}function Co(e,t,n){if(!n)return[];let r=be(t,n.section);if(!r)return[];let i=new Set(n.noopKeys??[]);return Object.keys(r).filter(o=>i.has(o)).sort().map(o=>({code:"INEFFECTIVE_CONFIG",field:`${n.section}.${o}`,message:`${e} config field "${o}" is accepted for Mermaid compatibility but has no effect on this renderer.`}))}function Hr(e){let t=new Set;return e.sort((n,r)=>Ue(n.field,r.field)||Ue(n.message,r.message)).filter(n=>{let r=`${n.code}\0${n.field}\0${n.message}`;return t.has(r)?!1:(t.add(r),!0)})}function Ao(e,t,n){if(!n)return[];let r=t.flatMap(i=>{let o=xo(e,i,n),a=be(i,n.section);return e==="state"?a?Hn([a],!0):o:[...o,...Mo(e,i,n),...Co(e,i,n)]});return Hr(r)}function Ur(e,t,n){let r=n??pn(e)?.config;if(!r)return[];if(e.includes(":")){let i=t&&typeof t=="object"&&!Array.isArray(t)?t:void 0,o=be(t,r.section);if(!o)return i&&r.section in i?[{code:"INEFFECTIVE_CONFIG",field:r.section,message:`${e} config section "${r.section}" must be an object; the invalid value has no effect.`}]:[];let a=new Set(r.keys),s=new Set(r.noopKeys??[]);return Hr(Object.keys(o).flatMap(d=>a.has(d)?s.has(d)?[{code:"INEFFECTIVE_CONFIG",field:`${r.section}.${d}`,message:`${e} config field "${d}" is accepted for compatibility but has no effect on this renderer.`}]:[]:[{code:"INEFFECTIVE_CONFIG",field:`${r.section}.${d}`,message:`${e} config field "${d}" is unknown and has no effect; check the spelling or remove it.`}]))}return Ao(e,[t],r)}var ht=2,Me=`render-contract@${ht}`,$o={svg:{availability:"public",security:"enforced",color:"srgb",terminal:"not-applicable",transports:{library:{availability:"direct",entrypoint:"renderMermaidSVG",evidence:["src/index.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format svg",evidence:["src/cli/index.ts"],format:"svg",order:0,help:"SVG markup",default:!0},codeMode:{availability:"direct",entrypoint:"mermaid.renderMermaidSVGWithReceipt",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"renderMermaidSVGWithReceipt",optionsType:"SvgRenderOptions",returnType:"RenderedSvg"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidSVGWithReceipt",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"direct",entrypoint:"render_svg",evidence:["src/mcp/hosted-server.ts"]},editor:{availability:"direct",entrypoint:"diagram preview / Save SVG",selector:"renderMermaidSVGWithReceipt",evidence:["editor/js/rendering.js","editor/js/export.js"]},website:{availability:"direct",entrypoint:"website build-time renderMermaidSVG",selector:"embedded examples and diagram assets",evidence:["website/build.ts"]}},evidence:["output-security@2",Me]},png:{availability:"public",security:"enforced",color:"srgb",terminal:"not-applicable",transports:{library:{availability:"direct",entrypoint:"renderMermaidPNG / createMermaidBrowserPNGRenderer",selector:"native Node/Bun or injected browser rasterizer",evidence:["src/agent/png.ts","src/browser-png.ts","src/index.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format png",evidence:["src/cli/index.ts"],format:"png",order:3,help:"PNG bytes; requires --output <file.png>; no watch/multi-input"},codeMode:{availability:"unavailable",entrypoint:"none",reason:"PNG rasterization is a host tool, not a sandbox SDK method",evidence:["src/mcp/sdk-decl.ts","src/mcp/facade.ts"]},localMcp:{availability:"direct",entrypoint:"render_png",evidence:["src/mcp/server.ts"]},hostedMcp:{availability:"direct",entrypoint:"render_png",evidence:["src/mcp/hosted-server.ts"]},editor:{availability:"direct",entrypoint:"Save PNG / Copy PNG",selector:"renderMermaidPNGInBrowserWithReceipt",evidence:["editor/js/export.js","src/browser-png.ts"]},website:{availability:"unavailable",entrypoint:"none",reason:"The site build copies curated PNG assets but exposes no PNG render adapter",evidence:["website/build.ts"]}},evidence:["output-security@2","output-color-profile@1",`png-output-policy@${3}`,Me]},ascii:{availability:"public",security:"enforced",color:"terminal-projected",terminal:"projected",transports:{library:{availability:"direct",entrypoint:"renderMermaidASCII",selector:"useAscii: true",evidence:["src/ascii/index.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format ascii",evidence:["src/cli/index.ts"],format:"ascii",order:1,help:"7-bit ASCII art"},codeMode:{availability:"direct",entrypoint:"mermaid.renderMermaidASCIIWithReceipt",selector:"useAscii: true",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"renderMermaidASCIIWithReceipt",optionsType:"AsciiRenderOptions",returnType:"RenderedAscii"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidASCIIWithReceipt({ useAscii: true })",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"direct",entrypoint:"render_ascii",selector:"useAscii: true",evidence:["src/mcp/hosted-server.ts"]},editor:{availability:"direct",entrypoint:"ASCII canvas tab",selector:"renderMermaidASCII({ useAscii: true })",evidence:["editor/js/rendering.js","editor/html/right-panel.html"]},website:{availability:"unavailable",entrypoint:"none",reason:"The site build emits one Unicode diagram asset but no 7-bit ASCII output",evidence:["website/build.ts"]}},evidence:["terminal-style@1",`terminal-output-policy@${1}`,"terminal-control-sanitization",Me]},unicode:{availability:"public",security:"enforced",color:"terminal-projected",terminal:"projected",transports:{library:{availability:"direct",entrypoint:"renderMermaidASCII",selector:"useAscii: false (default)",evidence:["src/ascii/index.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format unicode",evidence:["src/cli/index.ts"],format:"unicode",order:2,help:"Unicode box-drawing text"},codeMode:{availability:"direct",entrypoint:"mermaid.renderMermaidASCIIWithReceipt",selector:"useAscii: false (default)",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"renderMermaidASCIIWithReceipt",optionsType:"AsciiRenderOptions",returnType:"RenderedAscii"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidASCIIWithReceipt({ useAscii: false })",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"direct",entrypoint:"render_ascii",selector:"useAscii: false (default)",evidence:["src/mcp/hosted-server.ts"]},editor:{availability:"direct",entrypoint:"Unicode canvas tab",selector:"renderMermaidASCII({ useAscii: false })",evidence:["editor/js/rendering.js","editor/html/right-panel.html"]},website:{availability:"direct",entrypoint:"website build-time renderMermaidASCII",selector:"diagrams/workflow.txt; useAscii: false",evidence:["website/build.ts"]}},evidence:["terminal-style@1",`terminal-output-policy@${1}`,"terminal-control-sanitization",Me]},html:{availability:"public",security:"enforced",color:"terminal-projected",terminal:"projected",transports:{library:{availability:"projected",entrypoint:"renderMermaidASCII",selector:"colorMode: 'html'",evidence:["src/ascii/index.ts"]},cli:{availability:"unavailable",entrypoint:"none",reason:"HTML text is not a standalone CLI format",evidence:["src/cli/index.ts"]},codeMode:{availability:"projected",entrypoint:"mermaid.renderMermaidASCIIWithReceipt",selector:"colorMode: 'html' (terminal projection; not a standalone CLI format)",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"renderMermaidASCIIWithReceipt",optionsType:"AsciiRenderOptions",returnType:"RenderedAscii"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidASCIIWithReceipt({ colorMode: 'html' })",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidASCIIWithReceipt({ colorMode: 'html' })",evidence:["src/mcp/hosted-server.ts","src/mcp/facade.ts"]},editor:{availability:"unavailable",entrypoint:"none",reason:"The editor exposes diagram, Unicode and ASCII canvas tabs only",evidence:["editor/js/buttons.js","editor/html/right-panel.html"]},website:{availability:"unavailable",entrypoint:"none",reason:"The site does not emit terminal-HTML diagram artifacts",evidence:["website/build.ts"]}},evidence:["terminal-style@1",`terminal-output-policy@${1}`,"terminal-control-sanitization","html-text-escaping",Me]},layout:{availability:"public",security:"not-applicable",color:"not-applicable",terminal:"not-applicable",transports:{library:{availability:"direct",entrypoint:"layoutMermaid",evidence:["src/agent/core.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format layout",evidence:["src/cli/index.ts"],format:"layout",order:4,help:"Layout JSON (nodes, edges, groups, bounds)"},codeMode:{availability:"direct",entrypoint:"mermaid.layoutMermaidWithReceipt",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"layoutMermaidWithReceipt",optionsType:"LayoutRenderOptions",returnType:"RenderedLayoutArtifact"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.layoutMermaidWithReceipt",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.layoutMermaidWithReceipt",evidence:["src/mcp/hosted-server.ts","src/mcp/facade.ts"]},editor:{availability:"indirect",entrypoint:"verification panel",selector:"verifyMermaid(source).layout (consumed, not exported)",evidence:["editor/js/rendering.js"]},website:{availability:"unavailable",entrypoint:"none",reason:"Website verification consumes layout internally but publishes no layout artifact",evidence:["website/build.ts"]}},evidence:["positioned-artifact@1",Me]}};function Se(e){return Object.freeze({...e,evidence:Object.freeze([...e.evidence])})}var rc=Object.freeze(["library","cli","codeMode","localMcp","hostedMcp","editor","website"]),To=Object.freeze(vt.map(e=>{let t=$o[e];return Object.freeze({id:e,...t,transports:Object.freeze({library:Se(t.transports.library),cli:Se(t.transports.cli),codeMode:Se(t.transports.codeMode),localMcp:Se(t.transports.localMcp),hostedMcp:Se(t.transports.hostedMcp),editor:Se(t.transports.editor),website:Se(t.transports.website)}),evidence:Object.freeze([...t.evidence])})})),ni=Object.freeze(To.filter(e=>e.transports.cli.availability==="direct").sort((e,t)=>e.transports.cli.order-t.transports.cli.order)),ic=Object.freeze(ni.map(e=>e.transports.cli.format)),ri=ni.filter(e=>e.transports.cli.default);if(ri.length!==1)throw new Error("Render output contract must declare exactly one default CLI format");var oc=ri[0].transports.cli.format;var Do=["onConfigDiagnostic"],yt=(e,t)=>({type:"string",description:e,...t===void 0?{}:{default:t}}),Oe=(e,t,n={})=>({type:"number",description:e,...t===void 0?{}:{default:t},...n}),I=(e,t)=>Oe(e,t,{minimum:0}),te=(e,t)=>Oe(e,t,{exclusiveMinimum:0}),Zt=e=>Oe(e,void 0,{minimum:1,maximum:1e3}),ee=(e,t)=>({type:"boolean",description:e,...t===void 0?{}:{default:t}}),P=(e,t)=>({...yt(e,t),"x-agentic-mermaid-runtime-validator":"safeCssPaint"}),ii=(e,t)=>({...yt(e,t),"x-agentic-mermaid-runtime-validator":"safeCssFontFamily"}),Ce=(e,t,n=[])=>({type:"object",description:t,additionalProperties:!1,properties:e,...n.length===0?{}:{required:n}}),Qt={type:"string",enum:["uppercase","lowercase","capitalize"]},Io={groupHeaderHeight:te("Architecture group-header height."),groupFontSize:te("Architecture group-label font size."),groupFontWeight:Zt("Architecture group-label font weight."),groupLetterSpacing:Oe("Architecture group-label letter spacing."),groupFont:ii("Architecture group-label font family."),groupTextTransform:{...Qt,description:"Architecture group-label text transform."},groupPaddingX:I("Horizontal padding inside architecture groups."),groupPaddingY:I("Vertical padding inside architecture groups."),groupLabelPaddingX:I("Horizontal padding around architecture group labels."),groupCornerRadius:I("Architecture group corner radius."),groupLineWidth:I("Architecture group border width."),groupText:P("Architecture group-label color."),serviceFontSize:te("Architecture service-label font size."),serviceFontWeight:Zt("Architecture service-label font weight."),serviceLetterSpacing:Oe("Architecture service-label letter spacing."),serviceTextTransform:{...Qt,description:"Architecture service-label text transform."},servicePaddingX:I("Horizontal padding inside architecture services."),servicePaddingY:I("Vertical padding inside architecture services."),serviceCornerRadius:I("Architecture service corner radius."),serviceLineWidth:I("Architecture service border width."),serviceText:P("Architecture service-label color."),edgeFontSize:te("Architecture connector-label font size."),edgeFontWeight:Zt("Architecture connector-label font weight."),edgeLetterSpacing:Oe("Architecture connector-label letter spacing."),edgeTextTransform:{...Qt,description:"Architecture connector-label text transform."},edgeLineWidth:I("Architecture connector width."),edgeBendRadius:I("Architecture connector bend radius."),edgeStroke:P("Architecture connector color."),edgeText:P("Architecture connector-label color."),iconSize:te("Architecture group icon size."),serviceIconSize:te("Architecture service icon size."),junctionOuterRadius:te("Architecture junction outer radius."),junctionInnerRadius:I("Architecture junction inner radius."),groupSurface:P("Architecture group surface color."),groupHeaderSurface:P("Architecture group-header surface color."),groupBorder:P("Architecture group border color."),serviceSurface:P("Architecture service surface color."),serviceBorder:P("Architecture service border color.")},Po={...Ce(Io,"Sparse architecture visual overrides merged over resolved defaults."),"x-agentic-mermaid-runtime-validator":"architectureVisual"},No=(()=>{let e=Un(),t=e.$defs,n=s=>{if(Array.isArray(s))return s.map(n);if(s===null||typeof s!="object")return s;let d=s,l=d.$ref;if(typeof l=="string"&&l.startsWith("#/$defs/")){let c=t?.[l.slice(8)];if(!c)throw new Error(`StyleSpec schema has unresolved local reference ${l}`);return n(c)}return Object.fromEntries(Object.entries(d).filter(([c])=>c!=="$defs").map(([c,p])=>[c,n(p)]))},{$schema:r,$id:i,title:o,...a}=e;return n(a)})(),Jr={anyOf:[{type:"string",description:"Registered Style or Palette name."},No],"x-agentic-mermaid-validation-expectation":"a registered Style name or StyleSpec"},jo={anyOf:[Jr,{type:"array",items:Jr,description:"Style stack merged from left to right."}],description:"A registered name, inline StyleSpec, or left-to-right stack of either.","x-agentic-mermaid-runtime-validator":"styleInput"},en={anyOf:[{type:"null"},{type:"string"},{type:"number"},{type:"boolean"},{type:"array",items:{$ref:"#/$defs/jsonValue"}},{type:"object",additionalProperties:{$ref:"#/$defs/jsonValue"}}],description:"A finite, acyclic JSON value without prototype keys.","x-agentic-mermaid-validation-expectation":"a finite, acyclic JSON value without prototype keys"};function oi(e){if(typeof e!="object"||e===null||Object.isFrozen(e))return e;for(let t of Object.values(e))oi(t);return Object.freeze(e)}var Xr=["flowchart","state","class","er","architecture"],Lo=["flowchart","state","sequence","timeline","class","er","journey","xychart","pie","quadrant","gantt","mindmap","gitgraph"],Ve=oi({bg:{typeScript:"string",description:"Background color or CSS variable.",defaultLabel:"`#FFFFFF`",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Background color or CSS variable.","#FFFFFF"),terminal:"consumed"},fg:{typeScript:"string",description:"Primary foreground and text color.",defaultLabel:"`#27272A`",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Primary foreground and text color.","#27272A"),terminal:"consumed"},line:{typeScript:"string",description:"Connector and secondary-line color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Connector and secondary-line color."),terminal:"consumed"},accent:{typeScript:"string",description:"Arrowhead, highlight, and data accent color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Arrowhead, highlight, and data accent color."),terminal:"consumed"},muted:{typeScript:"string",description:"Secondary text and label color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Secondary text and label color."),terminal:"projected",terminalNote:"terminal themes have no dedicated muted-text role"},surface:{typeScript:"string",description:"Node and group surface color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Node and group surface color."),terminal:"projected",terminalNote:"terminal cells do not paint graphical surfaces"},border:{typeScript:"string",description:"Node and group border color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Node and group border color."),terminal:"consumed"},font:{typeScript:"string",description:"CSS font family or stack.",defaultLabel:"`Inter`",validationExpectation:"be a safe non-fetching CSS font family or stack",schema:ii("CSS font family or stack.","Inter"),terminal:"projected",terminalNote:"the host terminal owns the font face"},style:{typeScript:"StyleInput | StyleInput[]",description:"Registered Style/Palette name, inline StyleSpec, or left-to-right stack.",defaultLabel:"`crisp`",validationExpectation:"be a registered Style name or StyleSpec, or an array of them",schema:jo,terminal:"consumed"},padding:{typeScript:"number",description:"Canvas padding in SVG user units.",defaultLabel:"`40`",validationExpectation:"be a non-negative finite number",schema:I("Canvas padding in SVG user units.",40),terminal:"not-applicable",terminalNote:"terminal output uses paddingX, paddingY, and boxBorderPadding",applicableBuiltinFamilies:["flowchart","state","architecture"]},nodeSpacing:{typeScript:"number",description:"Horizontal spacing between sibling nodes.",defaultLabel:"`24`",validationExpectation:"be a non-negative finite number",schema:I("Horizontal spacing between sibling nodes.",24),terminal:"not-applicable",terminalNote:"terminal layout has a cell-grid spacing contract",applicableBuiltinFamilies:Xr},layerSpacing:{typeScript:"number",description:"Vertical spacing between graph layers.",defaultLabel:"`40`",validationExpectation:"be a non-negative finite number",schema:I("Vertical spacing between graph layers.",40),terminal:"not-applicable",terminalNote:"terminal layout has a cell-grid spacing contract",applicableBuiltinFamilies:Xr},wrappingWidth:{typeScript:"number",description:"Flowchart measured-label wrapping budget in pixels.",defaultLabel:"unset",validationExpectation:"be a positive finite number",schema:te("Flowchart measured-label wrapping budget in pixels."),terminal:"not-applicable",terminalNote:"terminal output uses maxWidth or targetWidth",applicableBuiltinFamilies:["flowchart"]},componentSpacing:{typeScript:"number",description:"Spacing between disconnected graph components for compatible extension families; no built-in family currently consumes it.",defaultLabel:"extension-defined",validationExpectation:"be a non-negative finite number",schema:I("Spacing between disconnected graph components for compatible extension families; no built-in family currently consumes it."),terminal:"not-applicable",terminalNote:"terminal layout has a cell-grid spacing contract",applicableBuiltinFamilies:[]},transparent:{typeScript:"boolean",description:"Omit the painted SVG canvas background.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Omit the painted SVG canvas background.",!1),terminal:"projected",terminalNote:"terminal output has no painted canvas background"},interactive:{typeScript:"boolean",description:"Enable hover tooltips for supported chart data points.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Enable hover tooltips for supported chart data points.",!1),terminal:"projected",terminalNote:"terminal output is a static semantic projection",applicableBuiltinFamilies:["xychart","pie","quadrant"]},shadow:{typeScript:"boolean",description:"Paint explicit drop shadows on node shapes.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Paint explicit drop shadows on node shapes.",!1),terminal:"projected",terminalNote:"elevation projects to borders and labels",applicableBuiltinFamilies:Lo},class:{typeScript:"{ hierarchicalNamespaces?: boolean }",description:"Class-diagram rendering controls.",defaultLabel:"`hierarchicalNamespaces: true`",validationExpectation:"be a class options object",schema:Ce({hierarchicalNamespaces:ee("Nest namespace compounds.",!0)},"Class-diagram rendering controls."),terminal:"not-applicable",terminalNote:"this option configures graphical class layout",applicableBuiltinFamilies:["class"]},architecture:{typeScript:"{ visual?: ArchitectureVisualOverrides }",description:"Sparse architecture renderer visual metric and paint overrides.",defaultLabel:"built-in metrics",validationExpectation:"be an architecture options object",schema:Ce({visual:Po},"Architecture renderer visual metric and paint overrides."),terminal:"not-applicable",terminalNote:"this option configures graphical architecture rendering",applicableBuiltinFamilies:["architecture"]},timeline:{typeScript:"{ maxWidth?: number }",description:"Timeline layout controls.",defaultLabel:"`maxWidth`: unset",validationExpectation:"be a timeline options object",schema:Ce({maxWidth:te("Best-effort width budget for horizontal timelines.")},"Timeline layout controls."),terminal:"not-applicable",terminalNote:"terminal output uses maxWidth or targetWidth",applicableBuiltinFamilies:["timeline"]},journey:{typeScript:"{ experienceCurve?: boolean }",description:"User-journey graphical controls.",defaultLabel:"`experienceCurve: true`",validationExpectation:"be a journey options object",schema:Ce({experienceCurve:ee("Connect journey score markers with an experience curve.",!0)},"User-journey graphical controls."),terminal:"not-applicable",terminalNote:"experience curves are graphical-only",applicableBuiltinFamilies:["journey"]},gantt:{typeScript:"{ dependencyArrows?: boolean; criticalPath?: boolean }",description:"Gantt dependency and critical-path overlays.",defaultLabel:"both `false`",validationExpectation:"be a Gantt options object",schema:Ce({dependencyArrows:ee("Draw scheduled dependency connectors.",!1),criticalPath:ee("Emphasize critical-path tasks and connectors.",!1)},"Gantt dependency and critical-path overlays."),terminal:"not-applicable",terminalNote:"graphical Gantt connector emphasis is not represented in cells",applicableBuiltinFamilies:["gantt"]},mermaidConfig:{typeScript:"MermaidRuntimeConfig",description:"Mermaid-style recursive runtime configuration.",defaultLabel:"source config",validationExpectation:"be a plain JSON object",schema:{type:"object",description:"Mermaid-style recursive runtime configuration.",additionalProperties:{$ref:"#/$defs/jsonValue"}},terminal:"consumed"},embedFontImport:{typeScript:"boolean",description:"Embed the Google Fonts import in SVG styles; PNG forces this off for offline rasterization.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Embed the Google Fonts import in SVG styles; PNG forces this off for offline rasterization.",!1),terminal:"not-applicable",terminalNote:"terminal output embeds no web-font import"},compact:{typeScript:"boolean",description:"Compact SVG serialization while preserving agent hooks.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Compact SVG serialization while preserving agent hooks.",!1),terminal:"not-applicable",terminalNote:"compact controls SVG serialization"},idPrefix:{typeScript:"string",description:"Non-empty namespace for generated SVG definition IDs and local references.",defaultLabel:"unset",validationExpectation:"be non-empty and contain only ASCII letters, digits, underscore, hyphen, dot, and colon",schema:{...yt("Non-empty namespace for generated SVG definition IDs and local references."),pattern:"^[A-Za-z0-9_.:-]+$"},terminal:"not-applicable",terminalNote:"terminal output has no SVG definition ids"},security:{typeScript:"'default' | 'strict'",description:"Active SVG content is rejected in every mode; strict additionally rejects every external reference. Raw Mermaid themeCSS is rejected in both modes.",defaultLabel:"`default`",validationExpectation:"be default or strict",schema:{type:"string",enum:["default","strict"],description:"Active SVG content is rejected in every mode; strict additionally rejects every external reference. Raw Mermaid themeCSS is rejected in both modes.",default:"default"},terminal:"not-applicable",terminalNote:"terminal text has its own control-character and HTML-color safety projection"},ganttToday:{typeScript:"string",description:"Explicit deterministic date for the Gantt today marker.",defaultLabel:"unset",validationExpectation:"be a string",schema:yt("Explicit deterministic date for the Gantt today marker."),terminal:"consumed",applicableBuiltinFamilies:["gantt"]},seed:{typeScript:"number",description:"Deterministic re-roll seed for stochastic Styles.",defaultLabel:"`0`",validationExpectation:"be a finite number",schema:Oe("Deterministic re-roll seed for stochastic Styles.",0),terminal:"not-applicable",terminalNote:"terminal glyph geometry is deterministic and has no stochastic ink"}}),$e=Object.freeze(Object.keys(Ve)),_o=Object.freeze($e.filter(e=>"applicableBuiltinFamilies"in Ve[e]));function q(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}var zo=new Set(["__proto__","prototype","constructor"]);function Re(e){return q(e)?e:void 0}function Kr(e){let t=n=>Array.isArray(n)?n.map(t):q(n)?Object.fromEntries(Object.entries(n).map(([r,i])=>[r,t(i)])):n;return t(e)}function si(e){let t=String(e[0]??"");for(let n of e.slice(1))t+=typeof n=="number"?`[${n}]`:`.${n}`;return`render option "${t}"`}function ai(e){return Rt(un(e).map(t=>t.path.length>0?`${si(t.path)} ${t.message}`:`render options ${t.message}`),"render options")}function ci(e,t){let n=e.$ref;if(typeof n!="string"||!n.startsWith("#/"))return;let r=t;for(let i of n.slice(2).split("/")){if(!q(r))return;let o=i.replaceAll("~1","/").replaceAll("~0","~");r=r[o]}return Re(r)}function tn(e,t,n){let r=ci(t,n);if(r)return tn(e,r,n);let i=Array.isArray(t.anyOf)?t.anyOf.map(Re).filter(o=>o!==void 0):[];if(i.length>0)return i.some(o=>tn(e,o,n));switch(t.type){case"null":return e===null;case"string":return typeof e=="string";case"number":return typeof e=="number";case"integer":return typeof e=="number";case"boolean":return typeof e=="boolean";case"array":return Array.isArray(e);case"object":return q(e);default:return!0}}function xe(e,t,n,r,i){let o=ci(t,n);if(t.$ref!==void 0)return o?xe(e,o,n,r,i):[{path:r,message:"uses an unresolved schema reference",generic:!1}];let a=Array.isArray(t.anyOf)?t.anyOf.map(Re).filter(c=>c!==void 0):[];if(a.length>0){let c=a.filter(f=>tn(e,f,n)),u=(c.length>0?c:a).map(f=>xe(e,f,n,r,i));if(!u.some(f=>f.length===0)){let f=t["x-agentic-mermaid-validation-expectation"];return c.length===0&&typeof f=="string"?[{path:r,message:`must be ${f}`,generic:!0}]:u.sort((m,h)=>m.length-h.length)[0]??[{path:r,message:"must match an allowed shape",generic:!0}]}}if("const"in t&&e!==t.const)return[{path:r,message:`must equal ${String(t.const)}`,generic:!0}];if(Array.isArray(t.enum)&&!t.enum.includes(e))return[{path:r,message:`must be one of ${t.enum.map(String).join(" | ")}`,generic:!0}];let s=t.type;if(!(s===void 0||s==="null"&&e===null||s==="string"&&typeof e=="string"||s==="number"&&typeof e=="number"&&Number.isFinite(e)||s==="integer"&&typeof e=="number"&&Number.isFinite(e)&&Number.isInteger(e)||s==="boolean"&&typeof e=="boolean"||s==="array"&&Array.isArray(e)||s==="object"&&q(e))){let c=s==="number"?"a finite number":s==="integer"?"a finite integer":s==="object"?"a plain JSON object":s==="array"?"an array":s==="null"?"null":`a ${String(s)}`;return[{path:r,message:`must be ${c}`,generic:!0}]}if(typeof e=="number"){if(typeof t.minimum=="number"&&e<t.minimum)return[{path:r,message:`must be at least ${t.minimum}`,generic:!0}];if(typeof t.exclusiveMinimum=="number"&&e<=t.exclusiveMinimum)return[{path:r,message:`must be greater than ${t.exclusiveMinimum}`,generic:!0}];if(typeof t.maximum=="number"&&e>t.maximum)return[{path:r,message:`must be at most ${t.maximum}`,generic:!0}]}if(typeof e=="string"&&typeof t.pattern=="string"){let c=!1;try{c=new RegExp(t.pattern).test(e)}catch{return[{path:r,message:"uses an invalid schema pattern",generic:!1}]}if(!c)return[{path:r,message:`must match ${t.pattern}`,generic:!0}]}if(Array.isArray(e)&&s==="array"){if(i.has(e))return[{path:r,message:"must be acyclic",generic:!1}];let c=Re(t.items);if(c){i.add(e);try{let p=e.flatMap((u,f)=>xe(u,c,n,[...r,f],i));if(p.length>0)return p}finally{i.delete(e)}}}if(q(e)&&s==="object"){if(i.has(e))return[{path:r,message:"must be acyclic",generic:!1}];i.add(e);try{let c=Re(t.properties)??{},p=Array.isArray(t.required)?t.required.filter(f=>typeof f=="string"):[],u=[];for(let f of p)Object.prototype.hasOwnProperty.call(e,f)||u.push({path:[...r,f],message:"is required",generic:!1});for(let[f,m]of Object.entries(e)){if(zo.has(f)){u.push({path:[...r,f],message:"uses a forbidden prototype key",generic:!1});continue}let h=Re(c[f]);if(h){u.push(...xe(m,h,n,[...r,f],i));continue}if(t.additionalProperties===!1){u.push({path:[...r,f],message:"is not allowed",generic:!1});continue}let y=Re(t.additionalProperties);y&&u.push(...xe(m,y,n,[...r,f],i))}if(u.length>0)return u}finally{i.delete(e)}}let l=t["x-agentic-mermaid-runtime-validator"];if(l==="safeCssColor"&&Ie(e)===void 0)return[{path:r,message:"must be a safe, non-fetching CSS color",generic:!1}];if(l==="safeCssPaint"&&kt(e)===void 0)return[{path:r,message:"must be a safe, non-fetching CSS paint",generic:!1}];if(l==="safeCssFontFamily"&&xt(e)===void 0)return[{path:r,message:"must be a safe, non-fetching CSS font family or stack",generic:!1}];if(l==="styleInput")try{Kn(e)}catch(c){return[{path:r,message:`is invalid: ${c instanceof Error?c.message:String(c)}`,generic:!1}]}if(l==="architectureVisual"&&q(e)){let c=e.junctionOuterRadius,p=e.junctionInnerRadius;if(typeof c=="number"&&typeof p=="number"&&p>c)return[{path:[...r,"junctionInnerRadius"],message:"must not exceed junctionOuterRadius",generic:!1}]}return[]}function li(e){if(!q(e))return["render options must be a plain JSON object"];let t=ai(e);if(t.length>0)return t;let n=[],r=new Set($e),i=Bo();for(let[o,a]of Object.entries(e)){if(!r.has(o)){n.push(`unknown render option "${o}"`);continue}if(a===null){n.push(`render option "${o}" must be omitted instead of null`);continue}let s=Ve[o],d=xe(a,s.schema,i,[o],new Set);d.length>0&&d.every(l=>l.generic&&l.path.length===1)?n.push(`render option "${o}" must ${s.validationExpectation}`):n.push(...d.map(l=>`${si(l.path)} ${l.message}`))}return Rt(n,"render options")}function Bo(){let e={};for(let t of $e){let n=Ve[t],r="terminalNote"in n?n.terminalNote:void 0,i="applicableBuiltinFamilies"in n?n.applicableBuiltinFamilies:void 0;e[t]={...Kr(n.schema),"x-agentic-mermaid-terminal":n.terminal,...r===void 0?{}:{"x-agentic-mermaid-terminal-note":r},...i===void 0?{}:{"x-agentic-mermaid-applicable-builtin-families":[...i]}}}return{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://agentic-mermaid.dev/schemas/render-options.schema.json",type:"object",additionalProperties:!1,properties:e,$defs:{jsonValue:Kr(en)}}}var nn=class extends Error{constructor(n,r){super(`Parsed Mermaid family "${n}" serialized as family "${r}"`);this.expectedFamilyId=n;this.detectedFamilyId=r}expectedFamilyId;detectedFamilyId;name="ParsedDiagramFamilyMismatchError";code="PARSED_DIAGRAM_FAMILY_MISMATCH"},ke=class extends Error{name="RenderCapabilityError";code="UNSATISFIED_RENDER_CAPABILITIES";output;family;decision;constructor(t,n,r,i){super(t),this.output=n,this.family=Object.freeze({id:r.identity.id,version:r.identity.version}),this.decision=i}toJSON(){return{name:this.name,code:this.code,message:this.message,output:this.output,family:this.family,decision:this.decision}}},on=new WeakMap;function he(e){let t=on.get(e);if(!t)throw new Error("Resolved render request has no internal execution plan");return t}function Go(e,t){if(e.id.startsWith("family:")){let r=new Set(e.applicableRenderOptions??[]);return Object.freeze(t.flatMap(i=>!_o.includes(i)||r.has(i)?[]:[Object.freeze({code:"RENDER_OPTION_NOT_APPLICABLE",feature:`render-option:${i}`,message:`Render option "${i}" does not apply to extension family "${e.id}". Its FamilyDescriptor does not list the field in applicableRenderOptions.`})]))}let n=e.id;return Object.freeze(t.flatMap(r=>{let i=Ve[r];if(!("applicableBuiltinFamilies"in i))return[];let o=i.applicableBuiltinFamilies;if(o.includes(n))return[];let a=o.length===0?"No built-in family currently consumes this option.":`Applicable built-in families: ${o.join(", ")}.`;return[Object.freeze({code:"RENDER_OPTION_NOT_APPLICABLE",feature:`render-option:${r}`,message:`Render option "${r}" does not apply to built-in Mermaid family "${n}". ${a}`})]}))}function Vo(e,t){let n=new Set;return Object.freeze([...e.resolutionDiagnostics??[],...t].flatMap(r=>{let i=Ae(r);return n.has(i)?[]:(n.add(i),[Object.freeze({...r})])}))}function di(e,t=[]){let n=on.get(e)?.executionDecision;return Object.freeze({version:e.version,output:e.output,sharedRequestDigest:e.sharedRequestDigest,requestDigest:e.requestDigest,appearanceDigest:e.appearance.digest,capabilityDecision:e.capabilityDecision,diagnostics:Vo(e,t),...n?{executionDecision:n}:{}})}function bt(e){return Object.freeze({renderOptions:e.renderOptions,...e.appearance.face?{styleFace:e.appearance.face}:{},...e.familyConfig?{familyConfig:e.familyConfig}:{},...e.appearance.family?{familyAppearance:e.appearance.family}:{}})}function Wo(e,t,n){let r={...e},i=a=>Ot[a].some(s=>n?.[s]!==void 0),o=["bg","fg","line","accent","muted","surface","border"];for(let a of o)r[a]===void 0&&!i(a)&&t.colors?.[a]!==void 0&&(r[a]=t.colors[a]);return r.font===void 0&&t.font!==void 0&&(r.font=t.font),r}function rn(e){let t={};for(let n of $e){let r=e[n];r!==void 0&&(t[n]=r)}return t}var qo=new Set(["padding","nodeSpacing","layerSpacing","wrappingWidth","class"]);function Ho(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0&&!Do.includes(t)))}function Uo(e,t=e){return vn(e.lines[0]??e.firstLine,e.originalText,"strict",t.wrapperSource?.length??0,t.lines[0]??t.firstLine)}function Jo(e,t,n){if(n.onConfigDiagnostic!==void 0)throw new TypeError(`Family "${e.id}" request normalizer may not return executable option "onConfigDiagnostic"`);let r=li(Ho(n));if(r.length>0)throw new TypeError(`Family "${e.id}" returned invalid normalized RenderOptions: ${r.join("; ")}`);let i=rn(t),o=rn(n);for(let a of $e)if(!qo.has(a)&&Ae(i[a])!==Ae(o[a]))throw new TypeError(`Family "${e.id}" request normalizer may not rewrite non-geometry option "${a}"`)}function Xo(e,t,n){let r=new Set(["bg","fg","line","accent","muted","surface","border","shadow","font","embedFontImport"]),i=Object.keys(t).find(a=>!r.has(a));if(i)throw new TypeError(`Family "${e.id}" returned unknown appearance color field "${i}"`);let o={...n};for(let a of["bg","fg","line","accent","muted","surface","border"]){let s=t[a];if(s===void 0)continue;let d=kt(s);if(d===void 0)throw new TypeError(`Family "${e.id}" returned an unsafe ${a} paint`);o[a]=d}if(t.font!==void 0){let a=xt(t.font);if(a===void 0)throw new TypeError(`Family "${e.id}" returned an unsafe font family`);if(a!==n.font)throw new TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "font"`)}if(t.shadow!==void 0){if(typeof t.shadow!="boolean")throw new TypeError(`Family "${e.id}" returned a non-boolean shadow value`);if(t.shadow!==n.shadow)throw new TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "shadow"`)}if(t.embedFontImport!==void 0){if(typeof t.embedFontImport!="boolean")throw new TypeError(`Family "${e.id}" returned a non-boolean embedFontImport value`);if(t.embedFontImport!==n.embedFontImport)throw new TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "embedFontImport"`)}return o}var Yr=64,ft=1e5,mt=2e6;function gt(e,t="$",n=0,r=new Set,i={nodes:0,chars:0}){if(typeof e=="string"){if(i.chars+=e.length,i.chars>mt)throw new TypeError(`data exceeds the ${mt}-character aggregate limit at ${t}`);return e}if(e===null||typeof e!="object")return e;if(n>Yr)throw new TypeError(`data exceeds maximum depth ${Yr} at ${t}`);if(++i.nodes>ft)throw new TypeError(`data exceeds the ${ft}-node aggregate limit at ${t}`);if(r.has(e))throw new TypeError(`data must be acyclic at ${t}`);if(Array.isArray(e)){if(e.length>ft)throw new TypeError(`data array exceeds the ${ft}-entry limit at ${t}`);r.add(e);try{let o=[];for(let a=0;a<e.length;a++){if(!Object.prototype.hasOwnProperty.call(e,a))throw new TypeError(`data must not contain a sparse array at ${t}[${a}]`);o.push(gt(e[a],`${t}[${a}]`,n+1,r,i))}return o}finally{r.delete(e)}}if(!q(e))return e;r.add(e);try{let o=Object.create(null);for(let[a,s]of Object.entries(e)){if(i.chars+=a.length,i.chars>mt)throw new TypeError(`data exceeds the ${mt}-character aggregate limit at ${t}.${a}`);s!==void 0&&(o[a]=gt(s,`${t}.${a}`,n+1,r,i))}return o}finally{r.delete(e)}}function Zr(e,t,n){if(t===void 0)return;if(!q(t))throw new TypeError(`Family "${e.id}" returned ${n} data that is not a plain object`);let r;try{r=gt(t)}catch(a){throw new TypeError(`Family "${e.id}" returned invalid ${n} data: ${a instanceof Error?a.message:String(a)}`)}let i={...en,$defs:{jsonValue:en}},o=xe(r,i,i,[`family${n==="config"?"Config":"Appearance"}`],new Set);if(o.length>0){let a=o.map(s=>`${s.path.join(".")} ${s.message}`).join("; ");throw new TypeError(`Family "${e.id}" returned invalid ${n} data: ${a}`)}return E(r)}function Ko(e,t,n,r,i,o){if(!e.normalizeRequest)return{renderOptions:n,colors:r};let a=Object.freeze({source:E(t),renderOptions:E(n),colors:E(r),...i?{style:E(i)}:{},...o?{styleFace:E(o)}:{}}),s=e.normalizeRequest(a);if(s===void 0)return{renderOptions:n,colors:r};let d;try{d=sn(s,`Family "${e.id}" request normalizer result`)}catch(y){throw new TypeError(`Family "${e.id}" request normalizer returned invalid data: ${y instanceof Error?y.message:String(y)}`)}if(!q(d))throw new TypeError(`Family "${e.id}" request normalizer must return a plain object`);let l=Object.keys(d).find(y=>!["renderOptions","familyConfig","appearance"].includes(y));if(l)throw new TypeError(`Family "${e.id}" request normalizer returned unknown field "${l}"`);let c=d,p=c.appearance;if(p!==void 0){let y=p;if(!q(y))throw new TypeError(`Family "${e.id}" request normalizer returned a non-object appearance`);let g=Object.keys(y).find(S=>!["colors","family"].includes(S));if(g)throw new TypeError(`Family "${e.id}" request normalizer returned unknown appearance field "${g}"`)}let u=c.renderOptions??n;Jo(e,n,u);let f=p?.colors?Xo(e,p.colors,r):r,m=Zr(e,c.familyConfig,"config"),h=Zr(e,p?.family,"appearance");return{renderOptions:u,colors:f,...m?{familyConfig:m}:{},...h?{familyAppearance:h}:{}}}function Ae(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Ae).join(",")}]`;let t=e;return`{${Object.keys(t).sort().filter(n=>t[n]!==void 0).map(n=>`${JSON.stringify(n)}:${Ae(t[n])}`).join(",")}}`}function Fe(e){let t;try{t=sn(e,"render contract digest input")}catch(i){let o=(i instanceof Error?i.message:String(i)).replace("data exceeds maximum depth","data exceeds maximum nesting depth");throw new TypeError(o)}fn(t,"render contract digest input",{allowUndefinedObjectProperties:!0});let n=Ae(t),r=0xcbf29ce484222325n;for(let i=0;i<n.length;i++)r^=BigInt(n.charCodeAt(i)),r=BigInt.asUintN(64,r*0x100000001b3n);return`fnv1a64:${r.toString(16).padStart(16,"0")}`}function E(e,t="$",n=new Set){if(e===null||typeof e!="object")return e;if(n.has(e))throw new TypeError(`render request contains a cycle at ${t}`);let r=Object.getPrototypeOf(e);if(!Array.isArray(e)&&r!==Object.prototype&&r!==null)throw new TypeError(`render request contains a non-JSON object at ${t}`);n.add(e);let i=Array.isArray(e)?e.map((o,a)=>E(o,`${t}[${a}]`,n)):Object.fromEntries(Object.entries(e).map(([o,a])=>[o,E(a,`${t}.${o}`,n)]));return n.delete(e),Object.freeze(i)}function sn(e,t){try{return E(gt(e))}catch(n){throw new TypeError(`${t} could not be snapshotted: ${n instanceof Error?n.message:String(n)}`)}}function Yo(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Invalid RenderOptions: render options must be an object");let t=[],n;for(let[o,a]of Object.entries(e))o==="onConfigDiagnostic"?n=a:a!==void 0&&t.push([o,a]);if(n!==void 0&&typeof n!="function")throw new TypeError("Invalid RenderOptions: onConfigDiagnostic must be a function");let r=Object.fromEntries(t),i;try{i=sn(r,"RenderOptions")}catch(o){let a=(o instanceof Error?o.message:String(o)).replace("data exceeds maximum depth","render option tree exceeds maximum nesting depth");throw new TypeError(`Invalid RenderOptions: ${a}`)}return Object.freeze({serializable:i,...n===void 0?{}:{onConfigDiagnostic:n}})}function Zo(e){let t=e===void 0?[]:Array.isArray(e)?e:[e];return E(t.flatMap(n=>{if(typeof n!="string"||n==="crisp")return[];let r=Jn(n);return r?[{input:n,canonicalId:r.canonicalId}]:[]}))}function Qo(e){let t=new Set;for(let n of Object.values(Ot))for(let r of n){let i=e.config.themeVariables?.[r];typeof i=="string"&&i.length>0&&Ie(i)===void 0&&t.add(r)}return Object.freeze([...t].sort())}var an="1.0.0";function me(e,t,n=an){return t?[{id:e,version:n}]:[]}function W(e,t=`^${an}`){return{id:e,range:t,level:"required"}}function Qr(e){return`scene-primitive:${e.primitive}/${e.feature}/${e.operation}`}function es(e){let t=new Set(e.scenePrimitiveEvidence.filter(n=>n.applicability==="applicable").map(n=>n.primitive));return Fn.filter(n=>t.has(n.primitive))}function ei(e,t){return e.backend.capabilities.some(n=>n.primitive===t.primitive&&n.feature===t.feature&&n.operation===t.operation&&n.realization!=="unsupported")}function ts(e){return e.resolutions.filter(t=>t.level==="required"&&t.status!=="selected").map(t=>t.id).join(", ")}function ns(e,t,n,r,i,o){let a=ts(o),s=a?` (unsatisfied capabilities: ${a})`:"";return e==="layout"?new ke(`No public layout projection registered for Mermaid family "${t.id}"${s}`,e,t,o):e==="ascii"||e==="unicode"||e==="html"?new ke(`No ASCII renderer registered for Mermaid family ${t.id}${s}`,e,t,o):n.styled&&!t.lowerScene?new ke(`Family "${t.id}" does not support styled rendering (no SceneGraph lowering registered). Render without the style option, or register a lowerScene hook for the family.${s}`,e,t,o):r==="scene"&&t.layout&&t.lowerScene&&!i?new ke(n.styled?`Style "${n.style?.name??"(inline)"}" requires an unavailable SceneGraph backend${s}`:`Default SceneGraph backend is not registered${s}`,e,t,o):new ke(`No SVG renderer registered for Mermaid family ${t.id}${s}`,e,t,o)}function rs(e,t,n,r,i,o){let a,s,d;n==="svg"||n==="png"?(a=t.styled||e.lowerScene?"scene":"family-svg",a==="scene"&&(d=t.styled?t.inferredBackend:"default",s=Vn(d,r.backendPolicy))):n==="layout"?a="layout":a="terminal";let l=a==="scene"?es(e):[],c=s?l.flatMap(g=>me(Qr(g),ei(s,g))):[],p=[{id:e.identity.id,version:e.identity.version},...me("operation:layout",e.layout!==void 0),...me("operation:project-positioned",e.projectPositioned!==void 0),...me("operation:lower-scene",e.lowerScene!==void 0),...me("operation:render-svg",e.renderSvg!==void 0),...me("operation:render-terminal",e.renderAscii!==void 0),...me("core:scene",a==="scene"),...me("backend:scene-renderer",s!==void 0,s?.identity.version),...c],u=[W("core:family-descriptor"),W(e.identity.id,e.identity.version)],f;switch(a){case"scene":u.push(W("core:scene"),W("operation:layout"),W("operation:lower-scene"),W("backend:scene-renderer",s?.identity.version??an),...l.map(g=>W(Qr(g)))),f=!!(e.layout&&e.lowerScene&&s&&l.every(g=>ei(s,g)));break;case"family-svg":u.push(W("operation:layout"),W("operation:render-svg")),f=!!(e.layout&&e.renderSvg);break;case"terminal":u.push(W("operation:render-terminal")),f=e.renderAscii!==void 0;break;case"layout":u.push(W("operation:layout"),W("operation:project-positioned")),f=!!(e.layout&&e.projectPositioned);break}let m=wn(n,{offers:p,requirements:u,outputAvailable:f});if(!m.accepted)throw ns(n,e,t,a,s,m);let h;if(a==="scene"||a==="family-svg"){let g=Object.freeze(a==="scene"?{mode:"scene",requestedId:d,selectedId:s.identity.id,version:s.identity.version,hostPolicy:r.backendPolicy!==void 0}:{mode:"family-svg"}),S={family:Object.freeze({id:e.identity.id,version:e.identity.version}),backend:g};h=Object.freeze({...S,digest:Fe(S)})}let y=i===void 0?void 0:Object.freeze(Ur(e.id,i,e.config).map(g=>Object.freeze({...g})));return Object.freeze({output:n,mode:a,family:e,...s?{backend:s}:{},...d?{requestedBackendId:d}:{},...y===void 0?{}:{configDiagnostics:y},...o?{onConfigDiagnostic:o}:{},capabilityDecision:m,...h?{executionDecision:h}:{}})}function ti(e){return!e.id.startsWith("output:")&&!e.id.startsWith("operation:")&&!e.id.startsWith("backend:")&&!e.id.startsWith("scene-primitive:")&&e.id!=="core:scene"}function is(e){let{family:t,source:n,options:r,style:i,styleFace:o}=e,a=r.security==="strict"?{...r,embedFontImport:!1}:{...r},s=i!==void 0&&Zn(i);s&&(a=Wo(a,i,n.config.themeVariables));let d=r.font??n.config.fontFamily??On(n.config.themeVariables,"fontFamily")??a.font??"Inter",l={...a,font:d,mermaidConfig:n.config},c={...kn(l,n.config,d)},p=Ko(t,n,l,c,i,o),u=E(p.colors),f=Zo(r.style),m=Qo(n),h={version:ht,colors:u,font:d,style:E(i),face:E(o),styled:s,inferredBackend:i?Xn(i):"default",styleReferences:f,...m.length>0?{unsafeThemeColorKeys:m}:{},...p.familyAppearance?{family:p.familyAppearance}:{}},y=E({...h,digest:Fe(h)});return E({renderOptions:E(p.renderOptions),appearance:y,...p.familyConfig?{familyConfig:p.familyConfig}:{}})}function pi(e,t={},n="svg",r,i={}){let o=Yo(t),a=o.serializable,s=a,d=ai(s);if(d.length>0)throw new TypeError(`Invalid RenderOptions: ${d.join("; ")}`);let l=Yn(a.style),c=l.style,p=E(l.face),u=li(s);if(u.length>0)throw new TypeError(`Invalid RenderOptions: ${u.join("; ")}`);let f=He(e),m=hn(f,a.mermaidConfig??{}),h=f===e?m:mn(e),y=Object.freeze({...m,originalText:e}),g=i.familyDescriptor??Uo(y,h);if(i.expectedFamilyId!==void 0&&g.id!==i.expectedFamilyId)throw new nn(i.expectedFamilyId,g.id);let S=Cn(y.config.themeCSS,a.security??"default");if(S)throw new TypeError(S);let k=Object.freeze($e.filter(F=>a[F]!==void 0)),H=Go(g,k),v=is({family:g,source:y,options:a,...c?{style:c}:{},...p?{styleFace:p}:{}}),{appearance:L,renderOptions:Y,familyConfig:_}=v,N=rs(g,L,n,i,a.mermaidConfig,o.onConfigDiagnostic),C=N.capabilityDecision,G=Object.freeze({version:C.version,accepted:C.resolutions.filter(ti).every(F=>F.level!=="required"||F.status==="selected"),resolutions:Object.freeze(C.resolutions.filter(ti))}),w={version:ht,authoredSource:y.originalText,source:y.text,options:rn(Y),appearance:L.digest,..._?{familyConfig:_}:{},capabilities:G},x=Fe(w),A={...w,output:n,outputOptions:r,capabilities:C},U=Object.freeze({version:ht,output:n,source:E(y),renderOptions:Y,appearance:L,..._?{familyConfig:_}:{},capabilityDecision:C,explicitOptionFields:k,...H.length===0?{}:{resolutionDiagnostics:H},sharedRequestDigest:x,requestDigest:Fe(A)});return on.set(U,N),U}function os(e){return"positioned"in e?e:{positioned:e}}function ui(e,t,n=t.source){let r=he(t).family;if(r.id!==e)throw new Error(`Resolved request planned family ${r.id}, not ${e}`);if(!r.layout)throw new Error(`No layout registered for Mermaid family ${e}`);let i=bt(t);return os(r.layout({source:n,renderOptions:i.renderOptions,...i.styleFace?{styleFace:i.styleFace}:{},...i.familyConfig?{familyConfig:i.familyConfig}:{},...i.familyAppearance?{familyAppearance:i.familyAppearance}:{}}))}var fi=new WeakSet;function mi(e){if(fi.has(e))return;fi.add(e);let t=he(e),n=t.configDiagnostics??[];if(n.length===0)return;let r=t.onConfigDiagnostic??(i=>console.warn(i.message));for(let i of n)r(i)}function hi(e,t,n="scene.parts"){e.forEach((r,i)=>{let o=`${n}[${i}]`;t(r,o),r.kind==="group"&&hi(r.children.map(a=>a.node),t,`${o}.children`)})}function yi(e,t){let n=e.id.startsWith("family:"),r=jn(t,Nn,"scene");Pn(r,{mode:n?"external":"internal"});let i=r,o=[];n&&i.family!==e.id&&o.push({code:"SCENE_DOCUMENT",path:"scene.family",message:`external family "${e.id}" emitted a document owned by "${i.family}"`});let a=new Set(e.semanticRoles),s=new Set(e.semanticChannels),d=new Map(e.scenePrimitiveEvidence.map(l=>[`${l.role}\0${l.primitive}`,l]));if(hi(i.parts,(l,c)=>{if(!a.has(l.role)){o.push({code:"SCENE_PRIMITIVE_CLAIM",path:`${c}.role`,message:`emitted undeclared role "${l.role}"`});return}for(let p of Object.keys(l.channels??{}))s.has(p)||o.push({code:"SCENE_CHANNEL_CLAIM",path:`${c}.channels.${p}`,message:`emitted undeclared semantic channel "${p}"`});for(let p of $n(l)){let u=d.get(`${l.role}\0${p}`);(!u||u.applicability!=="applicable"||u.realization==="unsupported")&&o.push({code:"SCENE_PRIMITIVE_CLAIM",path:c,message:`emitted undeclared ${l.role}/${p} primitive`})}}),o.length>0)throw new In(Object.freeze(o));return i}function bi(e,t){let n=e.appearance.colors,r=e.output==="png"&&n.embedFontImport!==!1?{...n,embedFontImport:!1}:n;return{positioned:t.positioned,colors:r,resolved:bt(e)}}function ss(e,t){let n=he(e);if(n.mode!=="scene")throw new Error(`Resolved ${e.output} request has no Scene execution plan`);let r=n.family;return yi(r,r.lowerScene(bi(e,t)))}function gi(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function as(e,t,n){let r=`${n}svg-title`,i=`${n}svg-desc`,o=[],a=[];if(t.title&&(o.push(`aria-labelledby="${r}"`),a.push(`<title id="${r}">${gi(t.title)}</title>`)),t.descr&&(o.push(`aria-describedby="${i}"`),a.push(`<desc id="${i}">${gi(t.descr)}</desc>`)),a.length===0)return e;let s=Sn(e);if(!s||Je(s,"aria-labelledby")||Je(s,"aria-describedby"))return e;let d=`${Je(s,"role")?"":' role="img"'} ${o.join(" ")}`,l=e.slice(s.start,s.end);return Rn(e,s,`${l.slice(0,-1)}${d}>${a.join("")}`)}function cs(e,t,n){let r=he(e);if(r.mode!=="scene"&&r.mode!=="family-svg"||!r.executionDecision)throw new Error(`Resolved ${e.output} request has no graphical execution plan`);let i=e.renderOptions,o=r.family,a=bi(e,t),s;if(r.mode==="scene"){let f=ss(e,t);s=r.backend.backend.render(f,{seed:i.seed??0,...e.appearance.styled?{style:e.appearance.style}:{}})}else s=o.renderSvg(a);ie(s,"backend/family SVG output");let d=xn(s,a.colors);ie(d,"color-resolved SVG output"),d=Vr(d,e.appearance.font),ie(d,"font-geometry-fitted SVG output");let l=i.idPrefix??"";l&&(d=qn(d,l),ie(d,"namespaced SVG output"));let c=e.source.accessibility;(t.injectAccessibility??!0)&&(c.title||c.descr)&&(d=as(d,c,l),ie(d,"accessibility-projected SVG output")),i.compact&&(d=Wn(d),ie(d,"compacted SVG output"));let p=e.output==="png"?"strict":i.security,u=An(d,p);return n.push(...u.diagnostics),d=u.svg,ie(d,"final SVG output"),Object.freeze({svg:d,executionDecision:r.executionDecision})}function ls(e,t){let n=he(e).family.id;return cs(e,ui(n,e),t)}function Si(e,t,n,r,i={}){let o=pi(e,t,n,r,i);mi(o);let a=[],s=ls(o,a),d=di(o,a);return Object.freeze({svg:s.svg,receipt:Object.freeze({...d,graphicalProjectionDigest:Fe(s.svg),executionDecision:s.executionDecision})})}function Fc(e,t,n){return dn(n),Si(e,t,"svg",void 0,{expectedFamilyId:n.id,familyDescriptor:n}).svg}export{Fc as renderLoadedFamilySvg};
|
|
12
|
+
`):null},Nr=_t("hybrid",mo);var ho=Object.freeze([Bn,gr,Nr]);for(let e of ho)Gn(e);function jr(e,t){return e.match(new RegExp(`\\b${t}\\s*=\\s*(["'])(.*?)\\1`,"i"))?.[2]}function Ht(e,t){return jr(e,"style")?.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"))?.[1]?.trim()??jr(e,t)}function Lr(e,t,n){let r=Number.parseFloat(Ht(e,t)??"");return Number.isFinite(r)?r:n}function _r(e,t){let n=Ht(e,"font-weight")?.trim().toLowerCase();if(n===void 0)return t;if(n==="normal")return 400;if(n==="bold")return 700;if(n==="bolder")return t<350?400:t<550?700:900;if(n==="lighter")return t<550?100:t<750?400:700;let r=Number.parseFloat(n);return Number.isFinite(r)?r:t}function yo(e){return/\bclass\s*=\s*(["'])[^"']*\bmono\b/i.test(e)||/(?:^|[,\s])monospace(?:[,\s]|$)/i.test(Ht(e,"font-family")??"")}function go(e,t){let n="";for(let r=t+1;r<e.length;r++){let i=e[r];if(n){i===n&&(n="");continue}if(i==='"'||i==="'"){n=i;continue}if(i===">")return r}return-1}function bo(e){let t=[],n=[],r=0;for(;r<e.length;){let i=e.indexOf("<",r);if(i<0){n.length>0&&r<e.length&&n[n.length-1].children.push({kind:"text-node",raw:e.slice(r)}),r=e.length;break}if(n.length>0&&i>r&&n[n.length-1].children.push({kind:"text-node",raw:e.slice(r,i)}),e.startsWith("<!--",i)){let c=e.indexOf("-->",i+4);if(c<0)return null;r=c+3;continue}let o=go(e,i);if(o<0)return null;let a=e.slice(i,o+1);if(/^<\?/.test(a)||/^<!/.test(a)){r=o+1;continue}let s=a.match(/^<\/\s*([\w:-]+)\s*>$/);if(s){let c=n.pop();if(!c||c.name!==s[1].toLowerCase())return null;c.closeStart=i,r=o+1;continue}let d=a.match(/^<\s*([\w:-]+)([\s\S]*?)(\/?)>$/);if(!d)return null;let l={kind:"element",name:d[1].toLowerCase(),attrs:d[2],openEnd:o+1,closeStart:o+1,children:[]};n.length>0?n[n.length-1].children.push(l):t.push(l),d[3]!=="/"&&n.push(l),r=o+1}return n.length===0?t:null}function zr(e){return e.children.filter(t=>t.kind==="element")}function Br(e,t){let n=t.name==="b"||t.name==="strong";return{size:Lr(t.attrs,"font-size",e.size),weight:n?Math.max(700,_r(t.attrs,e.weight)):_r(t.attrs,e.weight),letterSpacing:Lr(t.attrs,"letter-spacing",e.letterSpacing),mono:e.mono||yo(t.attrs)}}function Ut(e,t){return new RegExp(`\\b${t}\\s*=`,"i").test(e)}function Jt(e){return e.name==="tspan"&&["x","y","dx","dy"].some(t=>Ut(e.attrs,t))}function Gr(e){return zr(e).some(t=>Jt(t)||Gr(t))}function So(e,t){let n=[],r=!1,i=(o,a,s)=>{let d=Br(a,o);if(!(!s&&Jt(o))){if(!s&&Ut(o.attrs,"textLength")){r=!0;return}for(let l of o.children)if(l.kind==="text-node"){let c=He(l.raw);c.length>0&&n.push({text:c,metrics:d})}else i(l,d,!1)}};return i(e,t,!0),{runs:n,blocked:r}}function Ro(e){let t=e.filter(o=>o.text.length>0);if(t.length===0||t.every(o=>o.text.trim().length===0))return null;let n=0,r=0,i=0;for(let o of t){if(!(o.metrics.size>0))return null;let a=yn(o.text).length;r>0&&a>0&&(n+=i),n+=o.metrics.mono?gn(o.text,o.metrics.size,o.metrics.letterSpacing):bn(o.text,o.metrics.size,o.metrics.weight,o.metrics.letterSpacing),r=a,i=o.metrics.letterSpacing}return Math.round(n*1e3)/1e3}function Vr(e,t){let n=bo(e);if(!n)return e;let r=[],i={size:0,weight:400,letterSpacing:0,mono:!1},o=(s,d,l)=>{let c=Br(d,s),p=s.name==="text"&&!l,u=p||l&&Jt(s);if(u&&Ut(s.attrs,"textLength"))return;if(u&&!(p&&Gr(s))){let h=So(s,d),y=h.blocked?null:Ro(h.runs);y!==null&&r.push({offset:s.openEnd-1,text:` textLength="${y}" lengthAdjust="spacingAndGlyphs" data-font-metrics="deterministic-fit"`})}let m=l||p;for(let h of zr(s))o(h,c,m)};for(let s of n)o(s,i,!1);let a=e;for(let s of r.sort((d,l)=>l.offset-d.offset))a=a.slice(0,s.offset)+s.text+a.slice(s.offset);return a}function be(e,t){if(!e||typeof e!="object"||Array.isArray(e))return;let n=e[t];return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}function xo(e,t,n){if(!n)return[];let r=t&&typeof t=="object"&&!Array.isArray(t)?t:void 0,i=be(t,n.section);if(!i)return r&&n.section in r?[{code:"INEFFECTIVE_CONFIG",field:n.section,message:`${e} config section "${n.section}" must be an object; the invalid value has no effect.`}]:[];let o=new Set(n.keys);return Object.keys(i).filter(a=>!o.has(a)).sort().map(a=>({code:"INEFFECTIVE_CONFIG",field:`${n.section}.${a}`,message:`${e} config field "${a}" is unknown and has no effect; check the spelling or remove it.`}))}var D=(e,t)=>({expected:e,valid:t}),T=D("a finite positive number",e=>typeof e=="number"&&Number.isFinite(e)&&e>0),V=D("a finite non-negative number",e=>typeof e=="number"&&Number.isFinite(e)&&e>=0),ko=D("a finite number",e=>typeof e=="number"&&Number.isFinite(e)),O=D("a boolean",e=>typeof e=="boolean"),Xt=D("a non-empty string",e=>typeof e=="string"&&e.trim().length>0),Kt=D("a non-empty array of strings",e=>Array.isArray(e)&&e.length>0&&e.every(t=>typeof t=="string")),Wr=(...e)=>D(`one of: ${e.join(", ")}`,t=>typeof t=="string"&&e.includes(t)),qr=(...e)=>D(`one of: ${e.join(", ")} (case-insensitive)`,t=>typeof t=="string"&&e.some(n=>n.toLowerCase()===t.toLowerCase())),Ee=(e,t,n=!0)=>D(`a finite number ${n?"from":"greater than"} ${e} through ${t}`,r=>typeof r=="number"&&Number.isFinite(r)&&(n?r>=e:r>e)&&r<=t),Q=e=>D(`a finite positive number no greater than ${e}`,t=>typeof t=="number"&&Number.isFinite(t)&&t>0&&t<=e),ut=e=>D(`a finite non-negative number no greater than ${e}`,t=>typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=e),Oo=D("a finite positive number or non-empty CSS size string",e=>typeof e=="number"&&Number.isFinite(e)&&e>0||typeof e=="string"&&e.trim().length>0),Ge=(e,t=!1)=>D(`a numeric value${t?` greater than ${e}`:` of at least ${e}`}`,n=>{let r=typeof n=="number"?n:typeof n=="string"&&/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:px)?$/i.test(n.trim())?Number.parseFloat(n):Number.NaN;return Number.isFinite(r)&&(t?r>e:r>=e)}),vo={flowchart:{nodeSpacing:T,rankSpacing:T,wrappingWidth:T},sequence:Object.fromEntries([...["actorMargin","width","height","diagramMarginX","diagramMarginY","messageMargin","noteMargin","activationWidth"].map(e=>[e,V]),["showSequenceNumbers",O]]),timeline:{disableMulticolor:O,sectionFills:Kt,sectionColours:Kt},journey:Object.fromEntries([...["diagramMarginX","diagramMarginY","leftMargin","maxLabelWidth","width","height","taskMargin"].map(e=>[e,T]),...["taskFontSize","titleFontSize"].map(e=>[e,Oo]),...["taskFontFamily","titleColor","titleFontFamily"].map(e=>[e,Xt]),...["actorColours","sectionFills","sectionColours"].map(e=>[e,Kt]),["useMaxWidth",O]]),radar:{width:Q($.dimension),height:Q($.dimension),marginTop:ut($.margin),marginRight:ut($.margin),marginBottom:ut($.margin),marginLeft:ut($.margin),axisScaleFactor:Q($.factor),axisLabelFactor:Ee($.axisLabelFactorMin,$.factor),curveTension:Ee(0,1),useMaxWidth:O,tickLabels:O},class:{nodeSpacing:V,rankSpacing:V,hierarchicalNamespaces:O},er:{layoutDirection:qr("TB","TD","BT","LR","RL"),nodeSpacing:V,rankSpacing:V},architecture:{padding:Ge(0),iconSize:Ge(0,!0),fontSize:Ge(0,!0),nodeSeparation:Ge(0),idealEdgeLengthMultiplier:Ge(0,!0)},xychart:{width:T,height:T,useMaxWidth:O,useWidth:T,titleFontSize:T,titlePadding:V,chartOrientation:Wr("vertical","horizontal"),plotReservedSpacePercent:Ee(0,100,!1),showDataLabel:O,showTitle:O,showLegend:O,legendFontSize:T,legendPadding:V,xAxis:D("an axis-config object",e=>!!e&&typeof e=="object"&&!Array.isArray(e)),yAxis:D("an axis-config object",e=>!!e&&typeof e=="object"&&!Array.isArray(e))},pie:{textPosition:Ee(0,1),donutHole:Ee(0,.9),legendPosition:Wr("top","bottom","left","right","center")},quadrant:Object.fromEntries([...["chartWidth","chartHeight","titleFontSize","quadrantLabelFontSize","xAxisLabelFontSize","yAxisLabelFontSize","pointLabelFontSize","pointRadius"].map(e=>[e,T]),...["titlePadding","quadrantPadding","xAxisLabelPadding","yAxisLabelPadding","pointTextPadding","quadrantInternalBorderStrokeWidth","quadrantExternalBorderStrokeWidth"].map(e=>[e,V]),["useMaxWidth",O]]),gantt:{displayMode:qr("compact"),barHeight:T,topAxis:O,axisFormat:Xt,tickInterval:D('a positive Mermaid interval such as "1day" or "2week"',e=>typeof e=="string"&&/^[1-9]\d*(?:millisecond|second|minute|hour|day|week|month)$/i.test(e.trim()))},mindmap:{padding:V,maxNodeWidth:T},gitgraph:{showBranches:O,showCommitLabel:O,parallelCommits:O,rotateCommitLabel:O,mainBranchName:Xt,mainBranchOrder:ko}},wo={showLabel:O,labelFontSize:T,labelPadding:V,showTitle:O,titleFontSize:T,titlePadding:V,showTick:O,tickLength:V,tickWidth:T,showAxisLine:O,axisLineWidth:T};function Eo(e){let t=be(e,"themeVariables");if(!t||!("radar"in t))return[];let n=be(t,"radar");if(!n)return[{code:"INEFFECTIVE_CONFIG",field:"themeVariables.radar",message:"themeVariables.radar must be an object; the invalid value has no effect."}];let r=new Set(Qn),i=[],o=new Set(["axisStrokeWidth","curveStrokeWidth","graticuleStrokeWidth"]),a=new Set(["axisLabelFontSize","legendFontSize"]),s=new Set(["curveOpacity","graticuleOpacity"]),d=new Set(["axisColor","graticuleColor"]);for(let l of Object.keys(n).sort(Ue)){let c=n[l],p;r.has(l)?o.has(l)&&!Q($.lineWidth).valid(c)?p=Q($.lineWidth).expected:a.has(l)&&!Q($.fontSize).valid(c)?p=Q($.fontSize).expected:l==="legendBoxSize"&&!Q($.legendBoxSize).valid(c)?p=Q($.legendBoxSize).expected:s.has(l)&&!Ee(0,1).valid(c)?p="a finite number from 0 through 1":d.has(l)&&!Ie(c)&&(p="a safe CSS color without url(), variables, or context-breaking characters"):p="a documented radar theme field",p&&i.push({code:"INEFFECTIVE_CONFIG",field:`themeVariables.radar.${l}`,message:`themeVariables.radar.${l} must be ${p}; the invalid value has no effect.`})}return i}function Mo(e,t,n){if(e==="state")return[];if(!n)return[];let r=be(t,n.section),i=e==="radar"?Eo(t):[],o=(a,s)=>{i.push({code:"INEFFECTIVE_CONFIG",field:a,message:`${a} must be ${s}; the invalid value has no effect.`})};if(e==="mindmap"){let a=t&&typeof t=="object"&&!Array.isArray(t)?t:void 0;a&&"layout"in a&&!["tidy-tree","cose-bilkent","radial"].includes(String(a.layout))&&o("layout",'"cose-bilkent", "radial", or "tidy-tree" for mindmap diagrams')}if(!r)return i;for(let[a,s]of Object.entries(vo[e]??{}))a in r&&!s.valid(r[a])&&o(`${n.section}.${a}`,s.expected);if(e==="xychart")for(let a of["xAxis","yAxis"]){let s=r[a];if(!s||typeof s!="object"||Array.isArray(s))continue;let d=s;for(let l of Object.keys(d).sort()){let c=wo[l];c?c.valid(d[l])||o(`xyChart.${a}.${l}`,c.expected):o(`xyChart.${a}.${l}`,"a documented axis-config field")}}return i}function Co(e,t,n){if(!n)return[];let r=be(t,n.section);if(!r)return[];let i=new Set(n.noopKeys??[]);return Object.keys(r).filter(o=>i.has(o)).sort().map(o=>({code:"INEFFECTIVE_CONFIG",field:`${n.section}.${o}`,message:`${e} config field "${o}" is accepted for Mermaid compatibility but has no effect on this renderer.`}))}function Hr(e){let t=new Set;return e.sort((n,r)=>Ue(n.field,r.field)||Ue(n.message,r.message)).filter(n=>{let r=`${n.code}\0${n.field}\0${n.message}`;return t.has(r)?!1:(t.add(r),!0)})}function Ao(e,t,n){if(!n)return[];let r=t.flatMap(i=>{let o=xo(e,i,n),a=be(i,n.section);return e==="state"?a?Hn([a],!0):o:[...o,...Mo(e,i,n),...Co(e,i,n)]});return Hr(r)}function Ur(e,t,n){let r=n??pn(e)?.config;if(!r)return[];if(e.includes(":")){let i=t&&typeof t=="object"&&!Array.isArray(t)?t:void 0,o=be(t,r.section);if(!o)return i&&r.section in i?[{code:"INEFFECTIVE_CONFIG",field:r.section,message:`${e} config section "${r.section}" must be an object; the invalid value has no effect.`}]:[];let a=new Set(r.keys),s=new Set(r.noopKeys??[]);return Hr(Object.keys(o).flatMap(d=>a.has(d)?s.has(d)?[{code:"INEFFECTIVE_CONFIG",field:`${r.section}.${d}`,message:`${e} config field "${d}" is accepted for compatibility but has no effect on this renderer.`}]:[]:[{code:"INEFFECTIVE_CONFIG",field:`${r.section}.${d}`,message:`${e} config field "${d}" is unknown and has no effect; check the spelling or remove it.`}]))}return Ao(e,[t],r)}var ht=2,Me=`render-contract@${ht}`,$o={svg:{availability:"public",security:"enforced",color:"srgb",terminal:"not-applicable",transports:{library:{availability:"direct",entrypoint:"renderMermaidSVG",evidence:["src/index.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format svg",evidence:["src/cli/index.ts"],format:"svg",order:0,help:"SVG markup",default:!0},codeMode:{availability:"direct",entrypoint:"mermaid.renderMermaidSVGWithReceipt",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"renderMermaidSVGWithReceipt",optionsType:"SvgRenderOptions",returnType:"RenderedSvg"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidSVGWithReceipt",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"direct",entrypoint:"render_svg",evidence:["src/mcp/hosted-server.ts"]},editor:{availability:"direct",entrypoint:"diagram preview / Save SVG",selector:"renderMermaidSVGWithReceipt",evidence:["editor/js/rendering.js","editor/js/export.js"]},website:{availability:"direct",entrypoint:"website build-time renderMermaidSVG",selector:"embedded examples and diagram assets",evidence:["website/build.ts"]}},evidence:["output-security@2",Me]},png:{availability:"public",security:"enforced",color:"srgb",terminal:"not-applicable",transports:{library:{availability:"direct",entrypoint:"renderMermaidPNG / createMermaidBrowserPNGRenderer",selector:"native Node/Bun or injected browser rasterizer",evidence:["src/agent/png.ts","src/browser-png.ts","src/index.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format png",evidence:["src/cli/index.ts"],format:"png",order:3,help:"PNG bytes; requires --output <file.png>; no watch/multi-input"},codeMode:{availability:"unavailable",entrypoint:"none",reason:"PNG rasterization is a host tool, not a sandbox SDK method",evidence:["src/mcp/sdk-decl.ts","src/mcp/facade.ts"]},localMcp:{availability:"direct",entrypoint:"render_png",evidence:["src/mcp/server.ts"]},hostedMcp:{availability:"direct",entrypoint:"render_png",evidence:["src/mcp/hosted-server.ts"]},editor:{availability:"direct",entrypoint:"Save PNG / Copy PNG",selector:"renderMermaidPNGInBrowserWithReceipt",evidence:["editor/js/export.js","src/browser-png.ts"]},website:{availability:"unavailable",entrypoint:"none",reason:"The site build copies curated PNG assets but exposes no PNG render adapter",evidence:["website/build.ts"]}},evidence:["output-security@2","output-color-profile@1",`png-output-policy@${3}`,Me]},ascii:{availability:"public",security:"enforced",color:"terminal-projected",terminal:"projected",transports:{library:{availability:"direct",entrypoint:"renderMermaidASCII",selector:"useAscii: true",evidence:["src/ascii/index.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format ascii",evidence:["src/cli/index.ts"],format:"ascii",order:1,help:"7-bit ASCII art"},codeMode:{availability:"direct",entrypoint:"mermaid.renderMermaidASCIIWithReceipt",selector:"useAscii: true",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"renderMermaidASCIIWithReceipt",optionsType:"AsciiRenderOptions",returnType:"RenderedAscii"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidASCIIWithReceipt({ useAscii: true })",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"direct",entrypoint:"render_ascii",selector:"useAscii: true",evidence:["src/mcp/hosted-server.ts"]},editor:{availability:"direct",entrypoint:"ASCII canvas tab",selector:"renderMermaidASCII({ useAscii: true })",evidence:["editor/js/rendering.js","editor/html/right-panel.html"]},website:{availability:"unavailable",entrypoint:"none",reason:"The site build emits one Unicode diagram asset but no 7-bit ASCII output",evidence:["website/build.ts"]}},evidence:["terminal-style@1",`terminal-output-policy@${1}`,"terminal-control-sanitization",Me]},unicode:{availability:"public",security:"enforced",color:"terminal-projected",terminal:"projected",transports:{library:{availability:"direct",entrypoint:"renderMermaidASCII",selector:"useAscii: false (default)",evidence:["src/ascii/index.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format unicode",evidence:["src/cli/index.ts"],format:"unicode",order:2,help:"Unicode box-drawing text"},codeMode:{availability:"direct",entrypoint:"mermaid.renderMermaidASCIIWithReceipt",selector:"useAscii: false (default)",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"renderMermaidASCIIWithReceipt",optionsType:"AsciiRenderOptions",returnType:"RenderedAscii"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidASCIIWithReceipt({ useAscii: false })",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"direct",entrypoint:"render_ascii",selector:"useAscii: false (default)",evidence:["src/mcp/hosted-server.ts"]},editor:{availability:"direct",entrypoint:"Unicode canvas tab",selector:"renderMermaidASCII({ useAscii: false })",evidence:["editor/js/rendering.js","editor/html/right-panel.html"]},website:{availability:"direct",entrypoint:"website build-time renderMermaidASCII",selector:"diagrams/workflow.txt; useAscii: false",evidence:["website/build.ts"]}},evidence:["terminal-style@1",`terminal-output-policy@${1}`,"terminal-control-sanitization",Me]},html:{availability:"public",security:"enforced",color:"terminal-projected",terminal:"projected",transports:{library:{availability:"projected",entrypoint:"renderMermaidASCII",selector:"colorMode: 'html'",evidence:["src/ascii/index.ts"]},cli:{availability:"unavailable",entrypoint:"none",reason:"HTML text is not a standalone CLI format",evidence:["src/cli/index.ts"]},codeMode:{availability:"projected",entrypoint:"mermaid.renderMermaidASCIIWithReceipt",selector:"colorMode: 'html' (terminal projection; not a standalone CLI format)",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"renderMermaidASCIIWithReceipt",optionsType:"AsciiRenderOptions",returnType:"RenderedAscii"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidASCIIWithReceipt({ colorMode: 'html' })",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.renderMermaidASCIIWithReceipt({ colorMode: 'html' })",evidence:["src/mcp/hosted-server.ts","src/mcp/facade.ts"]},editor:{availability:"unavailable",entrypoint:"none",reason:"The editor exposes diagram, Unicode and ASCII canvas tabs only",evidence:["editor/js/buttons.js","editor/html/right-panel.html"]},website:{availability:"unavailable",entrypoint:"none",reason:"The site does not emit terminal-HTML diagram artifacts",evidence:["website/build.ts"]}},evidence:["terminal-style@1",`terminal-output-policy@${1}`,"terminal-control-sanitization","html-text-escaping",Me]},layout:{availability:"public",security:"not-applicable",color:"not-applicable",terminal:"not-applicable",transports:{library:{availability:"direct",entrypoint:"layoutMermaid",evidence:["src/agent/core.ts"]},cli:{availability:"direct",entrypoint:"am render",selector:"--format layout",evidence:["src/cli/index.ts"],format:"layout",order:4,help:"Layout JSON (nodes, edges, groups, bounds)"},codeMode:{availability:"direct",entrypoint:"mermaid.layoutMermaidWithReceipt",evidence:["src/mcp/facade.ts","src/mcp/sdk-decl.ts"],method:"layoutMermaidWithReceipt",optionsType:"LayoutRenderOptions",returnType:"RenderedLayoutArtifact"},localMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.layoutMermaidWithReceipt",evidence:["src/mcp/server.ts","src/mcp/facade.ts"]},hostedMcp:{availability:"indirect",entrypoint:"execute",selector:"mermaid.layoutMermaidWithReceipt",evidence:["src/mcp/hosted-server.ts","src/mcp/facade.ts"]},editor:{availability:"indirect",entrypoint:"verification panel",selector:"verifyMermaid(source).layout (consumed, not exported)",evidence:["editor/js/rendering.js"]},website:{availability:"unavailable",entrypoint:"none",reason:"Website verification consumes layout internally but publishes no layout artifact",evidence:["website/build.ts"]}},evidence:["positioned-artifact@1",Me]}};function Se(e){return Object.freeze({...e,evidence:Object.freeze([...e.evidence])})}var rc=Object.freeze(["library","cli","codeMode","localMcp","hostedMcp","editor","website"]),To=Object.freeze(vt.map(e=>{let t=$o[e];return Object.freeze({id:e,...t,transports:Object.freeze({library:Se(t.transports.library),cli:Se(t.transports.cli),codeMode:Se(t.transports.codeMode),localMcp:Se(t.transports.localMcp),hostedMcp:Se(t.transports.hostedMcp),editor:Se(t.transports.editor),website:Se(t.transports.website)}),evidence:Object.freeze([...t.evidence])})})),ni=Object.freeze(To.filter(e=>e.transports.cli.availability==="direct").sort((e,t)=>e.transports.cli.order-t.transports.cli.order)),ic=Object.freeze(ni.map(e=>e.transports.cli.format)),ri=ni.filter(e=>e.transports.cli.default);if(ri.length!==1)throw new Error("Render output contract must declare exactly one default CLI format");var oc=ri[0].transports.cli.format;var Do=["onConfigDiagnostic"],yt=(e,t)=>({type:"string",description:e,...t===void 0?{}:{default:t}}),Oe=(e,t,n={})=>({type:"number",description:e,...t===void 0?{}:{default:t},...n}),I=(e,t)=>Oe(e,t,{minimum:0}),te=(e,t)=>Oe(e,t,{exclusiveMinimum:0}),Zt=e=>Oe(e,void 0,{minimum:1,maximum:1e3}),ee=(e,t)=>({type:"boolean",description:e,...t===void 0?{}:{default:t}}),P=(e,t)=>({...yt(e,t),"x-agentic-mermaid-runtime-validator":"safeCssPaint"}),ii=(e,t)=>({...yt(e,t),"x-agentic-mermaid-runtime-validator":"safeCssFontFamily"}),Ce=(e,t,n=[])=>({type:"object",description:t,additionalProperties:!1,properties:e,...n.length===0?{}:{required:n}}),Qt={type:"string",enum:["uppercase","lowercase","capitalize"]},Io={groupHeaderHeight:te("Architecture group-header height."),groupFontSize:te("Architecture group-label font size."),groupFontWeight:Zt("Architecture group-label font weight."),groupLetterSpacing:Oe("Architecture group-label letter spacing."),groupFont:ii("Architecture group-label font family."),groupTextTransform:{...Qt,description:"Architecture group-label text transform."},groupPaddingX:I("Horizontal padding inside architecture groups."),groupPaddingY:I("Vertical padding inside architecture groups."),groupLabelPaddingX:I("Horizontal padding around architecture group labels."),groupCornerRadius:I("Architecture group corner radius."),groupLineWidth:I("Architecture group border width."),groupText:P("Architecture group-label color."),serviceFontSize:te("Architecture service-label font size."),serviceFontWeight:Zt("Architecture service-label font weight."),serviceLetterSpacing:Oe("Architecture service-label letter spacing."),serviceTextTransform:{...Qt,description:"Architecture service-label text transform."},servicePaddingX:I("Horizontal padding inside architecture services."),servicePaddingY:I("Vertical padding inside architecture services."),serviceCornerRadius:I("Architecture service corner radius."),serviceLineWidth:I("Architecture service border width."),serviceText:P("Architecture service-label color."),edgeFontSize:te("Architecture connector-label font size."),edgeFontWeight:Zt("Architecture connector-label font weight."),edgeLetterSpacing:Oe("Architecture connector-label letter spacing."),edgeTextTransform:{...Qt,description:"Architecture connector-label text transform."},edgeLineWidth:I("Architecture connector width."),edgeBendRadius:I("Architecture connector bend radius."),edgeStroke:P("Architecture connector color."),edgeText:P("Architecture connector-label color."),iconSize:te("Architecture group icon size."),serviceIconSize:te("Architecture service icon size."),junctionOuterRadius:te("Architecture junction outer radius."),junctionInnerRadius:I("Architecture junction inner radius."),groupSurface:P("Architecture group surface color."),groupHeaderSurface:P("Architecture group-header surface color."),groupBorder:P("Architecture group border color."),serviceSurface:P("Architecture service surface color."),serviceBorder:P("Architecture service border color.")},Po={...Ce(Io,"Sparse architecture visual overrides merged over resolved defaults."),"x-agentic-mermaid-runtime-validator":"architectureVisual"},No=(()=>{let e=Un(),t=e.$defs,n=s=>{if(Array.isArray(s))return s.map(n);if(s===null||typeof s!="object")return s;let d=s,l=d.$ref;if(typeof l=="string"&&l.startsWith("#/$defs/")){let c=t?.[l.slice(8)];if(!c)throw new Error(`StyleSpec schema has unresolved local reference ${l}`);return n(c)}return Object.fromEntries(Object.entries(d).filter(([c])=>c!=="$defs").map(([c,p])=>[c,n(p)]))},{$schema:r,$id:i,title:o,...a}=e;return n(a)})(),Jr={anyOf:[{type:"string",description:"Registered Style or Palette name."},No],"x-agentic-mermaid-validation-expectation":"a registered Style name or StyleSpec"},jo={anyOf:[Jr,{type:"array",items:Jr,description:"Style stack merged from left to right."}],description:"A registered name, inline StyleSpec, or left-to-right stack of either.","x-agentic-mermaid-runtime-validator":"styleInput"},en={anyOf:[{type:"null"},{type:"string"},{type:"number"},{type:"boolean"},{type:"array",items:{$ref:"#/$defs/jsonValue"}},{type:"object",additionalProperties:{$ref:"#/$defs/jsonValue"}}],description:"A finite, acyclic JSON value without prototype keys.","x-agentic-mermaid-validation-expectation":"a finite, acyclic JSON value without prototype keys"};function oi(e){if(typeof e!="object"||e===null||Object.isFrozen(e))return e;for(let t of Object.values(e))oi(t);return Object.freeze(e)}var Xr=["flowchart","state","class","er","architecture"],Lo=["flowchart","state","sequence","timeline","class","er","journey","xychart","pie","quadrant","gantt","mindmap","gitgraph"],Ve=oi({bg:{typeScript:"string",description:"Background color or CSS variable.",defaultLabel:"`#FFFFFF`",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Background color or CSS variable.","#FFFFFF"),terminal:"consumed"},fg:{typeScript:"string",description:"Primary foreground and text color.",defaultLabel:"`#27272A`",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Primary foreground and text color.","#27272A"),terminal:"consumed"},line:{typeScript:"string",description:"Connector and secondary-line color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Connector and secondary-line color."),terminal:"consumed"},accent:{typeScript:"string",description:"Arrowhead, highlight, and data accent color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Arrowhead, highlight, and data accent color."),terminal:"consumed"},muted:{typeScript:"string",description:"Secondary text and label color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Secondary text and label color."),terminal:"projected",terminalNote:"terminal themes have no dedicated muted-text role"},surface:{typeScript:"string",description:"Node and group surface color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Node and group surface color."),terminal:"projected",terminalNote:"terminal cells do not paint graphical surfaces"},border:{typeScript:"string",description:"Node and group border color.",defaultLabel:"derived",validationExpectation:"be a safe non-fetching CSS paint",schema:P("Node and group border color."),terminal:"consumed"},font:{typeScript:"string",description:"CSS font family or stack.",defaultLabel:"`Inter`",validationExpectation:"be a safe non-fetching CSS font family or stack",schema:ii("CSS font family or stack.","Inter"),terminal:"projected",terminalNote:"the host terminal owns the font face"},style:{typeScript:"StyleInput | StyleInput[]",description:"Registered Style/Palette name, inline StyleSpec, or left-to-right stack.",defaultLabel:"`crisp`",validationExpectation:"be a registered Style name or StyleSpec, or an array of them",schema:jo,terminal:"consumed"},padding:{typeScript:"number",description:"Canvas padding in SVG user units.",defaultLabel:"`40`",validationExpectation:"be a non-negative finite number",schema:I("Canvas padding in SVG user units.",40),terminal:"not-applicable",terminalNote:"terminal output uses paddingX, paddingY, and boxBorderPadding",applicableBuiltinFamilies:["flowchart","state","architecture"]},nodeSpacing:{typeScript:"number",description:"Horizontal spacing between sibling nodes.",defaultLabel:"`24`",validationExpectation:"be a non-negative finite number",schema:I("Horizontal spacing between sibling nodes.",24),terminal:"not-applicable",terminalNote:"terminal layout has a cell-grid spacing contract",applicableBuiltinFamilies:Xr},layerSpacing:{typeScript:"number",description:"Vertical spacing between graph layers.",defaultLabel:"`40`",validationExpectation:"be a non-negative finite number",schema:I("Vertical spacing between graph layers.",40),terminal:"not-applicable",terminalNote:"terminal layout has a cell-grid spacing contract",applicableBuiltinFamilies:Xr},wrappingWidth:{typeScript:"number",description:"Flowchart measured-label wrapping budget in pixels.",defaultLabel:"unset",validationExpectation:"be a positive finite number",schema:te("Flowchart measured-label wrapping budget in pixels."),terminal:"not-applicable",terminalNote:"terminal output uses maxWidth or targetWidth",applicableBuiltinFamilies:["flowchart"]},componentSpacing:{typeScript:"number",description:"Spacing between disconnected graph components for compatible extension families; no built-in family currently consumes it.",defaultLabel:"extension-defined",validationExpectation:"be a non-negative finite number",schema:I("Spacing between disconnected graph components for compatible extension families; no built-in family currently consumes it."),terminal:"not-applicable",terminalNote:"terminal layout has a cell-grid spacing contract",applicableBuiltinFamilies:[]},transparent:{typeScript:"boolean",description:"Omit the painted SVG canvas background.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Omit the painted SVG canvas background.",!1),terminal:"projected",terminalNote:"terminal output has no painted canvas background"},interactive:{typeScript:"boolean",description:"Enable hover tooltips for supported chart data points.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Enable hover tooltips for supported chart data points.",!1),terminal:"projected",terminalNote:"terminal output is a static semantic projection",applicableBuiltinFamilies:["xychart","pie","quadrant"]},shadow:{typeScript:"boolean",description:"Paint explicit drop shadows on node shapes.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Paint explicit drop shadows on node shapes.",!1),terminal:"projected",terminalNote:"elevation projects to borders and labels",applicableBuiltinFamilies:Lo},class:{typeScript:"{ hierarchicalNamespaces?: boolean }",description:"Class-diagram rendering controls.",defaultLabel:"`hierarchicalNamespaces: true`",validationExpectation:"be a class options object",schema:Ce({hierarchicalNamespaces:ee("Nest namespace compounds.",!0)},"Class-diagram rendering controls."),terminal:"not-applicable",terminalNote:"this option configures graphical class layout",applicableBuiltinFamilies:["class"]},architecture:{typeScript:"{ visual?: ArchitectureVisualOverrides }",description:"Sparse architecture renderer visual metric and paint overrides.",defaultLabel:"built-in metrics",validationExpectation:"be an architecture options object",schema:Ce({visual:Po},"Architecture renderer visual metric and paint overrides."),terminal:"not-applicable",terminalNote:"this option configures graphical architecture rendering",applicableBuiltinFamilies:["architecture"]},timeline:{typeScript:"{ maxWidth?: number }",description:"Timeline layout controls.",defaultLabel:"`maxWidth`: unset",validationExpectation:"be a timeline options object",schema:Ce({maxWidth:te("Best-effort width budget for horizontal timelines.")},"Timeline layout controls."),terminal:"not-applicable",terminalNote:"terminal output uses maxWidth or targetWidth",applicableBuiltinFamilies:["timeline"]},journey:{typeScript:"{ experienceCurve?: boolean }",description:"User-journey graphical controls.",defaultLabel:"`experienceCurve: true`",validationExpectation:"be a journey options object",schema:Ce({experienceCurve:ee("Connect journey score markers with an experience curve.",!0)},"User-journey graphical controls."),terminal:"not-applicable",terminalNote:"experience curves are graphical-only",applicableBuiltinFamilies:["journey"]},gantt:{typeScript:"{ dependencyArrows?: boolean; criticalPath?: boolean }",description:"Gantt dependency and critical-path overlays.",defaultLabel:"both `false`",validationExpectation:"be a Gantt options object",schema:Ce({dependencyArrows:ee("Draw scheduled dependency connectors.",!1),criticalPath:ee("Emphasize critical-path tasks and connectors.",!1)},"Gantt dependency and critical-path overlays."),terminal:"not-applicable",terminalNote:"graphical Gantt connector emphasis is not represented in cells",applicableBuiltinFamilies:["gantt"]},mermaidConfig:{typeScript:"MermaidRuntimeConfig",description:"Mermaid-style recursive runtime configuration.",defaultLabel:"source config",validationExpectation:"be a plain JSON object",schema:{type:"object",description:"Mermaid-style recursive runtime configuration.",additionalProperties:{$ref:"#/$defs/jsonValue"}},terminal:"consumed"},embedFontImport:{typeScript:"boolean",description:"Embed the Google Fonts import in SVG styles; PNG forces this off for offline rasterization.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Embed the Google Fonts import in SVG styles; PNG forces this off for offline rasterization.",!1),terminal:"not-applicable",terminalNote:"terminal output embeds no web-font import"},compact:{typeScript:"boolean",description:"Compact SVG serialization while preserving agent hooks.",defaultLabel:"`false`",validationExpectation:"be a boolean",schema:ee("Compact SVG serialization while preserving agent hooks.",!1),terminal:"not-applicable",terminalNote:"compact controls SVG serialization"},idPrefix:{typeScript:"string",description:"Non-empty namespace for generated SVG definition IDs and local references.",defaultLabel:"unset",validationExpectation:"be non-empty and contain only ASCII letters, digits, underscore, hyphen, dot, and colon",schema:{...yt("Non-empty namespace for generated SVG definition IDs and local references."),pattern:"^[A-Za-z0-9_.:-]+$"},terminal:"not-applicable",terminalNote:"terminal output has no SVG definition ids"},security:{typeScript:"'default' | 'strict'",description:"Active SVG content is rejected in every mode; strict additionally rejects every external reference. Raw Mermaid themeCSS is rejected in both modes.",defaultLabel:"`default`",validationExpectation:"be default or strict",schema:{type:"string",enum:["default","strict"],description:"Active SVG content is rejected in every mode; strict additionally rejects every external reference. Raw Mermaid themeCSS is rejected in both modes.",default:"default"},terminal:"not-applicable",terminalNote:"terminal text has its own control-character and HTML-color safety projection"},ganttToday:{typeScript:"string",description:"Explicit deterministic date for the Gantt today marker.",defaultLabel:"unset",validationExpectation:"be a string",schema:yt("Explicit deterministic date for the Gantt today marker."),terminal:"consumed",applicableBuiltinFamilies:["gantt"]},seed:{typeScript:"number",description:"Deterministic re-roll seed for stochastic Styles.",defaultLabel:"`0`",validationExpectation:"be a finite number",schema:Oe("Deterministic re-roll seed for stochastic Styles.",0),terminal:"not-applicable",terminalNote:"terminal glyph geometry is deterministic and has no stochastic ink"}}),$e=Object.freeze(Object.keys(Ve)),_o=Object.freeze($e.filter(e=>"applicableBuiltinFamilies"in Ve[e]));function q(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}var zo=new Set(["__proto__","prototype","constructor"]);function Re(e){return q(e)?e:void 0}function Kr(e){let t=n=>Array.isArray(n)?n.map(t):q(n)?Object.fromEntries(Object.entries(n).map(([r,i])=>[r,t(i)])):n;return t(e)}function si(e){let t=String(e[0]??"");for(let n of e.slice(1))t+=typeof n=="number"?`[${n}]`:`.${n}`;return`render option "${t}"`}function ai(e){return Rt(un(e).map(t=>t.path.length>0?`${si(t.path)} ${t.message}`:`render options ${t.message}`),"render options")}function ci(e,t){let n=e.$ref;if(typeof n!="string"||!n.startsWith("#/"))return;let r=t;for(let i of n.slice(2).split("/")){if(!q(r))return;let o=i.replaceAll("~1","/").replaceAll("~0","~");r=r[o]}return Re(r)}function tn(e,t,n){let r=ci(t,n);if(r)return tn(e,r,n);let i=Array.isArray(t.anyOf)?t.anyOf.map(Re).filter(o=>o!==void 0):[];if(i.length>0)return i.some(o=>tn(e,o,n));switch(t.type){case"null":return e===null;case"string":return typeof e=="string";case"number":return typeof e=="number";case"integer":return typeof e=="number";case"boolean":return typeof e=="boolean";case"array":return Array.isArray(e);case"object":return q(e);default:return!0}}function xe(e,t,n,r,i){let o=ci(t,n);if(t.$ref!==void 0)return o?xe(e,o,n,r,i):[{path:r,message:"uses an unresolved schema reference",generic:!1}];let a=Array.isArray(t.anyOf)?t.anyOf.map(Re).filter(c=>c!==void 0):[];if(a.length>0){let c=a.filter(f=>tn(e,f,n)),u=(c.length>0?c:a).map(f=>xe(e,f,n,r,i));if(!u.some(f=>f.length===0)){let f=t["x-agentic-mermaid-validation-expectation"];return c.length===0&&typeof f=="string"?[{path:r,message:`must be ${f}`,generic:!0}]:u.sort((m,h)=>m.length-h.length)[0]??[{path:r,message:"must match an allowed shape",generic:!0}]}}if("const"in t&&e!==t.const)return[{path:r,message:`must equal ${String(t.const)}`,generic:!0}];if(Array.isArray(t.enum)&&!t.enum.includes(e))return[{path:r,message:`must be one of ${t.enum.map(String).join(" | ")}`,generic:!0}];let s=t.type;if(!(s===void 0||s==="null"&&e===null||s==="string"&&typeof e=="string"||s==="number"&&typeof e=="number"&&Number.isFinite(e)||s==="integer"&&typeof e=="number"&&Number.isFinite(e)&&Number.isInteger(e)||s==="boolean"&&typeof e=="boolean"||s==="array"&&Array.isArray(e)||s==="object"&&q(e))){let c=s==="number"?"a finite number":s==="integer"?"a finite integer":s==="object"?"a plain JSON object":s==="array"?"an array":s==="null"?"null":`a ${String(s)}`;return[{path:r,message:`must be ${c}`,generic:!0}]}if(typeof e=="number"){if(typeof t.minimum=="number"&&e<t.minimum)return[{path:r,message:`must be at least ${t.minimum}`,generic:!0}];if(typeof t.exclusiveMinimum=="number"&&e<=t.exclusiveMinimum)return[{path:r,message:`must be greater than ${t.exclusiveMinimum}`,generic:!0}];if(typeof t.maximum=="number"&&e>t.maximum)return[{path:r,message:`must be at most ${t.maximum}`,generic:!0}]}if(typeof e=="string"&&typeof t.pattern=="string"){let c=!1;try{c=new RegExp(t.pattern).test(e)}catch{return[{path:r,message:"uses an invalid schema pattern",generic:!1}]}if(!c)return[{path:r,message:`must match ${t.pattern}`,generic:!0}]}if(Array.isArray(e)&&s==="array"){if(i.has(e))return[{path:r,message:"must be acyclic",generic:!1}];let c=Re(t.items);if(c){i.add(e);try{let p=e.flatMap((u,f)=>xe(u,c,n,[...r,f],i));if(p.length>0)return p}finally{i.delete(e)}}}if(q(e)&&s==="object"){if(i.has(e))return[{path:r,message:"must be acyclic",generic:!1}];i.add(e);try{let c=Re(t.properties)??{},p=Array.isArray(t.required)?t.required.filter(f=>typeof f=="string"):[],u=[];for(let f of p)Object.prototype.hasOwnProperty.call(e,f)||u.push({path:[...r,f],message:"is required",generic:!1});for(let[f,m]of Object.entries(e)){if(zo.has(f)){u.push({path:[...r,f],message:"uses a forbidden prototype key",generic:!1});continue}let h=Re(c[f]);if(h){u.push(...xe(m,h,n,[...r,f],i));continue}if(t.additionalProperties===!1){u.push({path:[...r,f],message:"is not allowed",generic:!1});continue}let y=Re(t.additionalProperties);y&&u.push(...xe(m,y,n,[...r,f],i))}if(u.length>0)return u}finally{i.delete(e)}}let l=t["x-agentic-mermaid-runtime-validator"];if(l==="safeCssColor"&&Ie(e)===void 0)return[{path:r,message:"must be a safe, non-fetching CSS color",generic:!1}];if(l==="safeCssPaint"&&kt(e)===void 0)return[{path:r,message:"must be a safe, non-fetching CSS paint",generic:!1}];if(l==="safeCssFontFamily"&&xt(e)===void 0)return[{path:r,message:"must be a safe, non-fetching CSS font family or stack",generic:!1}];if(l==="styleInput")try{Kn(e)}catch(c){return[{path:r,message:`is invalid: ${c instanceof Error?c.message:String(c)}`,generic:!1}]}if(l==="architectureVisual"&&q(e)){let c=e.junctionOuterRadius,p=e.junctionInnerRadius;if(typeof c=="number"&&typeof p=="number"&&p>c)return[{path:[...r,"junctionInnerRadius"],message:"must not exceed junctionOuterRadius",generic:!1}]}return[]}function li(e){if(!q(e))return["render options must be a plain JSON object"];let t=ai(e);if(t.length>0)return t;let n=[],r=new Set($e),i=Bo();for(let[o,a]of Object.entries(e)){if(!r.has(o)){n.push(`unknown render option "${o}"`);continue}if(a===null){n.push(`render option "${o}" must be omitted instead of null`);continue}let s=Ve[o],d=xe(a,s.schema,i,[o],new Set);d.length>0&&d.every(l=>l.generic&&l.path.length===1)?n.push(`render option "${o}" must ${s.validationExpectation}`):n.push(...d.map(l=>`${si(l.path)} ${l.message}`))}return Rt(n,"render options")}function Bo(){let e={};for(let t of $e){let n=Ve[t],r="terminalNote"in n?n.terminalNote:void 0,i="applicableBuiltinFamilies"in n?n.applicableBuiltinFamilies:void 0;e[t]={...Kr(n.schema),"x-agentic-mermaid-terminal":n.terminal,...r===void 0?{}:{"x-agentic-mermaid-terminal-note":r},...i===void 0?{}:{"x-agentic-mermaid-applicable-builtin-families":[...i]}}}return{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://agentic-mermaid.dev/schemas/render-options.schema.json",type:"object",additionalProperties:!1,properties:e,$defs:{jsonValue:Kr(en)}}}var nn=class extends Error{constructor(n,r){super(`Parsed Mermaid family "${n}" serialized as family "${r}"`);this.expectedFamilyId=n;this.detectedFamilyId=r}expectedFamilyId;detectedFamilyId;name="ParsedDiagramFamilyMismatchError";code="PARSED_DIAGRAM_FAMILY_MISMATCH"},ke=class extends Error{name="RenderCapabilityError";code="UNSATISFIED_RENDER_CAPABILITIES";output;family;decision;constructor(t,n,r,i){super(t),this.output=n,this.family=Object.freeze({id:r.identity.id,version:r.identity.version}),this.decision=i}toJSON(){return{name:this.name,code:this.code,message:this.message,output:this.output,family:this.family,decision:this.decision}}},on=new WeakMap;function he(e){let t=on.get(e);if(!t)throw new Error("Resolved render request has no internal execution plan");return t}function Go(e,t){if(e.id.startsWith("family:")){let r=new Set(e.applicableRenderOptions??[]);return Object.freeze(t.flatMap(i=>!_o.includes(i)||r.has(i)?[]:[Object.freeze({code:"RENDER_OPTION_NOT_APPLICABLE",feature:`render-option:${i}`,message:`Render option "${i}" does not apply to extension family "${e.id}". Its FamilyDescriptor does not list the field in applicableRenderOptions.`})]))}let n=e.id;return Object.freeze(t.flatMap(r=>{let i=Ve[r];if(!("applicableBuiltinFamilies"in i))return[];let o=i.applicableBuiltinFamilies;if(o.includes(n))return[];let a=o.length===0?"No built-in family currently consumes this option.":`Applicable built-in families: ${o.join(", ")}.`;return[Object.freeze({code:"RENDER_OPTION_NOT_APPLICABLE",feature:`render-option:${r}`,message:`Render option "${r}" does not apply to built-in Mermaid family "${n}". ${a}`})]}))}function Vo(e,t){let n=new Set;return Object.freeze([...e.resolutionDiagnostics??[],...t].flatMap(r=>{let i=Ae(r);return n.has(i)?[]:(n.add(i),[Object.freeze({...r})])}))}function di(e,t=[]){let n=on.get(e)?.executionDecision;return Object.freeze({version:e.version,output:e.output,sharedRequestDigest:e.sharedRequestDigest,requestDigest:e.requestDigest,appearanceDigest:e.appearance.digest,capabilityDecision:e.capabilityDecision,diagnostics:Vo(e,t),...n?{executionDecision:n}:{}})}function bt(e){return Object.freeze({renderOptions:e.renderOptions,...e.appearance.face?{styleFace:e.appearance.face}:{},...e.familyConfig?{familyConfig:e.familyConfig}:{},...e.appearance.family?{familyAppearance:e.appearance.family}:{}})}function Wo(e,t,n){let r={...e},i=a=>Ot[a].some(s=>n?.[s]!==void 0),o=["bg","fg","line","accent","muted","surface","border"];for(let a of o)r[a]===void 0&&!i(a)&&t.colors?.[a]!==void 0&&(r[a]=t.colors[a]);return r.font===void 0&&t.font!==void 0&&(r.font=t.font),r}function rn(e){let t={};for(let n of $e){let r=e[n];r!==void 0&&(t[n]=r)}return t}var qo=new Set(["padding","nodeSpacing","layerSpacing","wrappingWidth","class"]);function Ho(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0&&!Do.includes(t)))}function Uo(e,t=e){return vn(e.lines[0]??e.firstLine,e.originalText,"strict",t.wrapperSource?.length??0,t.lines[0]??t.firstLine)}function Jo(e,t,n){if(n.onConfigDiagnostic!==void 0)throw new TypeError(`Family "${e.id}" request normalizer may not return executable option "onConfigDiagnostic"`);let r=li(Ho(n));if(r.length>0)throw new TypeError(`Family "${e.id}" returned invalid normalized RenderOptions: ${r.join("; ")}`);let i=rn(t),o=rn(n);for(let a of $e)if(!qo.has(a)&&Ae(i[a])!==Ae(o[a]))throw new TypeError(`Family "${e.id}" request normalizer may not rewrite non-geometry option "${a}"`)}function Xo(e,t,n){let r=new Set(["bg","fg","line","accent","muted","surface","border","shadow","font","embedFontImport"]),i=Object.keys(t).find(a=>!r.has(a));if(i)throw new TypeError(`Family "${e.id}" returned unknown appearance color field "${i}"`);let o={...n};for(let a of["bg","fg","line","accent","muted","surface","border"]){let s=t[a];if(s===void 0)continue;let d=kt(s);if(d===void 0)throw new TypeError(`Family "${e.id}" returned an unsafe ${a} paint`);o[a]=d}if(t.font!==void 0){let a=xt(t.font);if(a===void 0)throw new TypeError(`Family "${e.id}" returned an unsafe font family`);if(a!==n.font)throw new TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "font"`)}if(t.shadow!==void 0){if(typeof t.shadow!="boolean")throw new TypeError(`Family "${e.id}" returned a non-boolean shadow value`);if(t.shadow!==n.shadow)throw new TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "shadow"`)}if(t.embedFontImport!==void 0){if(typeof t.embedFontImport!="boolean")throw new TypeError(`Family "${e.id}" returned a non-boolean embedFontImport value`);if(t.embedFontImport!==n.embedFontImport)throw new TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "embedFontImport"`)}return o}var Yr=64,ft=1e5,mt=2e6;function gt(e,t="$",n=0,r=new Set,i={nodes:0,chars:0}){if(typeof e=="string"){if(i.chars+=e.length,i.chars>mt)throw new TypeError(`data exceeds the ${mt}-character aggregate limit at ${t}`);return e}if(e===null||typeof e!="object")return e;if(n>Yr)throw new TypeError(`data exceeds maximum depth ${Yr} at ${t}`);if(++i.nodes>ft)throw new TypeError(`data exceeds the ${ft}-node aggregate limit at ${t}`);if(r.has(e))throw new TypeError(`data must be acyclic at ${t}`);if(Array.isArray(e)){if(e.length>ft)throw new TypeError(`data array exceeds the ${ft}-entry limit at ${t}`);r.add(e);try{let o=[];for(let a=0;a<e.length;a++){if(!Object.prototype.hasOwnProperty.call(e,a))throw new TypeError(`data must not contain a sparse array at ${t}[${a}]`);o.push(gt(e[a],`${t}[${a}]`,n+1,r,i))}return o}finally{r.delete(e)}}if(!q(e))return e;r.add(e);try{let o=Object.create(null);for(let[a,s]of Object.entries(e)){if(i.chars+=a.length,i.chars>mt)throw new TypeError(`data exceeds the ${mt}-character aggregate limit at ${t}.${a}`);s!==void 0&&(o[a]=gt(s,`${t}.${a}`,n+1,r,i))}return o}finally{r.delete(e)}}function Zr(e,t,n){if(t===void 0)return;if(!q(t))throw new TypeError(`Family "${e.id}" returned ${n} data that is not a plain object`);let r;try{r=gt(t)}catch(a){throw new TypeError(`Family "${e.id}" returned invalid ${n} data: ${a instanceof Error?a.message:String(a)}`)}let i={...en,$defs:{jsonValue:en}},o=xe(r,i,i,[`family${n==="config"?"Config":"Appearance"}`],new Set);if(o.length>0){let a=o.map(s=>`${s.path.join(".")} ${s.message}`).join("; ");throw new TypeError(`Family "${e.id}" returned invalid ${n} data: ${a}`)}return E(r)}function Ko(e,t,n,r,i,o){if(!e.normalizeRequest)return{renderOptions:n,colors:r};let a=Object.freeze({source:E(t),renderOptions:E(n),colors:E(r),...i?{style:E(i)}:{},...o?{styleFace:E(o)}:{}}),s=e.normalizeRequest(a);if(s===void 0)return{renderOptions:n,colors:r};let d;try{d=sn(s,`Family "${e.id}" request normalizer result`)}catch(y){throw new TypeError(`Family "${e.id}" request normalizer returned invalid data: ${y instanceof Error?y.message:String(y)}`)}if(!q(d))throw new TypeError(`Family "${e.id}" request normalizer must return a plain object`);let l=Object.keys(d).find(y=>!["renderOptions","familyConfig","appearance"].includes(y));if(l)throw new TypeError(`Family "${e.id}" request normalizer returned unknown field "${l}"`);let c=d,p=c.appearance;if(p!==void 0){let y=p;if(!q(y))throw new TypeError(`Family "${e.id}" request normalizer returned a non-object appearance`);let g=Object.keys(y).find(S=>!["colors","family"].includes(S));if(g)throw new TypeError(`Family "${e.id}" request normalizer returned unknown appearance field "${g}"`)}let u=c.renderOptions??n;Jo(e,n,u);let f=p?.colors?Xo(e,p.colors,r):r,m=Zr(e,c.familyConfig,"config"),h=Zr(e,p?.family,"appearance");return{renderOptions:u,colors:f,...m?{familyConfig:m}:{},...h?{familyAppearance:h}:{}}}function Ae(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Ae).join(",")}]`;let t=e;return`{${Object.keys(t).sort().filter(n=>t[n]!==void 0).map(n=>`${JSON.stringify(n)}:${Ae(t[n])}`).join(",")}}`}function Fe(e){let t;try{t=sn(e,"render contract digest input")}catch(i){let o=(i instanceof Error?i.message:String(i)).replace("data exceeds maximum depth","data exceeds maximum nesting depth");throw new TypeError(o)}fn(t,"render contract digest input",{allowUndefinedObjectProperties:!0});let n=Ae(t),r=0xcbf29ce484222325n;for(let i=0;i<n.length;i++)r^=BigInt(n.charCodeAt(i)),r=BigInt.asUintN(64,r*0x100000001b3n);return`fnv1a64:${r.toString(16).padStart(16,"0")}`}function E(e,t="$",n=new Set){if(e===null||typeof e!="object")return e;if(n.has(e))throw new TypeError(`render request contains a cycle at ${t}`);let r=Object.getPrototypeOf(e);if(!Array.isArray(e)&&r!==Object.prototype&&r!==null)throw new TypeError(`render request contains a non-JSON object at ${t}`);n.add(e);let i=Array.isArray(e)?e.map((o,a)=>E(o,`${t}[${a}]`,n)):Object.fromEntries(Object.entries(e).map(([o,a])=>[o,E(a,`${t}.${o}`,n)]));return n.delete(e),Object.freeze(i)}function sn(e,t){try{return E(gt(e))}catch(n){throw new TypeError(`${t} could not be snapshotted: ${n instanceof Error?n.message:String(n)}`)}}function Yo(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Invalid RenderOptions: render options must be an object");let t=[],n;for(let[o,a]of Object.entries(e))o==="onConfigDiagnostic"?n=a:a!==void 0&&t.push([o,a]);if(n!==void 0&&typeof n!="function")throw new TypeError("Invalid RenderOptions: onConfigDiagnostic must be a function");let r=Object.fromEntries(t),i;try{i=sn(r,"RenderOptions")}catch(o){let a=(o instanceof Error?o.message:String(o)).replace("data exceeds maximum depth","render option tree exceeds maximum nesting depth");throw new TypeError(`Invalid RenderOptions: ${a}`)}return Object.freeze({serializable:i,...n===void 0?{}:{onConfigDiagnostic:n}})}function Zo(e){let t=e===void 0?[]:Array.isArray(e)?e:[e];return E(t.flatMap(n=>{if(typeof n!="string"||n==="crisp")return[];let r=Jn(n);return r?[{input:n,canonicalId:r.canonicalId}]:[]}))}function Qo(e){let t=new Set;for(let n of Object.values(Ot))for(let r of n){let i=e.config.themeVariables?.[r];typeof i=="string"&&i.length>0&&Ie(i)===void 0&&t.add(r)}return Object.freeze([...t].sort())}var an="1.0.0";function me(e,t,n=an){return t?[{id:e,version:n}]:[]}function W(e,t=`^${an}`){return{id:e,range:t,level:"required"}}function Qr(e){return`scene-primitive:${e.primitive}/${e.feature}/${e.operation}`}function es(e){let t=new Set(e.scenePrimitiveEvidence.filter(n=>n.applicability==="applicable").map(n=>n.primitive));return Fn.filter(n=>t.has(n.primitive))}function ei(e,t){return e.backend.capabilities.some(n=>n.primitive===t.primitive&&n.feature===t.feature&&n.operation===t.operation&&n.realization!=="unsupported")}function ts(e){return e.resolutions.filter(t=>t.level==="required"&&t.status!=="selected").map(t=>t.id).join(", ")}function ns(e,t,n,r,i,o){let a=ts(o),s=a?` (unsatisfied capabilities: ${a})`:"";return e==="layout"?new ke(`No public layout projection registered for Mermaid family "${t.id}"${s}`,e,t,o):e==="ascii"||e==="unicode"||e==="html"?new ke(`No ASCII renderer registered for Mermaid family ${t.id}${s}`,e,t,o):n.styled&&!t.lowerScene?new ke(`Family "${t.id}" does not support styled rendering (no SceneGraph lowering registered). Render without the style option, or register a lowerScene hook for the family.${s}`,e,t,o):r==="scene"&&t.layout&&t.lowerScene&&!i?new ke(n.styled?`Style "${n.style?.name??"(inline)"}" requires an unavailable SceneGraph backend${s}`:`Default SceneGraph backend is not registered${s}`,e,t,o):new ke(`No SVG renderer registered for Mermaid family ${t.id}${s}`,e,t,o)}function rs(e,t,n,r,i,o){let a,s,d;n==="svg"||n==="png"?(a=t.styled||e.lowerScene?"scene":"family-svg",a==="scene"&&(d=t.styled?t.inferredBackend:"default",s=Vn(d,r.backendPolicy))):n==="layout"?a="layout":a="terminal";let l=a==="scene"?es(e):[],c=s?l.flatMap(g=>me(Qr(g),ei(s,g))):[],p=[{id:e.identity.id,version:e.identity.version},...me("operation:layout",e.layout!==void 0),...me("operation:project-positioned",e.projectPositioned!==void 0),...me("operation:lower-scene",e.lowerScene!==void 0),...me("operation:render-svg",e.renderSvg!==void 0),...me("operation:render-terminal",e.renderAscii!==void 0),...me("core:scene",a==="scene"),...me("backend:scene-renderer",s!==void 0,s?.identity.version),...c],u=[W("core:family-descriptor"),W(e.identity.id,e.identity.version)],f;switch(a){case"scene":u.push(W("core:scene"),W("operation:layout"),W("operation:lower-scene"),W("backend:scene-renderer",s?.identity.version??an),...l.map(g=>W(Qr(g)))),f=!!(e.layout&&e.lowerScene&&s&&l.every(g=>ei(s,g)));break;case"family-svg":u.push(W("operation:layout"),W("operation:render-svg")),f=!!(e.layout&&e.renderSvg);break;case"terminal":u.push(W("operation:render-terminal")),f=e.renderAscii!==void 0;break;case"layout":u.push(W("operation:layout"),W("operation:project-positioned")),f=!!(e.layout&&e.projectPositioned);break}let m=wn(n,{offers:p,requirements:u,outputAvailable:f});if(!m.accepted)throw ns(n,e,t,a,s,m);let h;if(a==="scene"||a==="family-svg"){let g=Object.freeze(a==="scene"?{mode:"scene",requestedId:d,selectedId:s.identity.id,version:s.identity.version,hostPolicy:r.backendPolicy!==void 0}:{mode:"family-svg"}),S={family:Object.freeze({id:e.identity.id,version:e.identity.version}),backend:g};h=Object.freeze({...S,digest:Fe(S)})}let y=i===void 0?void 0:Object.freeze(Ur(e.id,i,e.config).map(g=>Object.freeze({...g})));return Object.freeze({output:n,mode:a,family:e,...s?{backend:s}:{},...d?{requestedBackendId:d}:{},...y===void 0?{}:{configDiagnostics:y},...o?{onConfigDiagnostic:o}:{},capabilityDecision:m,...h?{executionDecision:h}:{}})}function ti(e){return!e.id.startsWith("output:")&&!e.id.startsWith("operation:")&&!e.id.startsWith("backend:")&&!e.id.startsWith("scene-primitive:")&&e.id!=="core:scene"}function is(e){let{family:t,source:n,options:r,style:i,styleFace:o}=e,a=r.security==="strict"?{...r,embedFontImport:!1}:{...r},s=i!==void 0&&Zn(i);s&&(a=Wo(a,i,n.config.themeVariables));let d=r.font??n.config.fontFamily??On(n.config.themeVariables,"fontFamily")??a.font??"Inter",{style:l,...c}=a,p={...c,...i?{style:i}:{},font:d,mermaidConfig:n.config},u={...kn(p,n.config,d)},f=Ko(t,n,p,u,i,o),m=E(f.colors),h=Zo(r.style),y=Qo(n),g={version:ht,colors:m,font:d,style:E(i),face:E(o),styled:s,inferredBackend:i?Xn(i):"default",styleReferences:h,...y.length>0?{unsafeThemeColorKeys:y}:{},...f.familyAppearance?{family:f.familyAppearance}:{}},S=E({...g,digest:Fe(g)});return E({renderOptions:E(f.renderOptions),appearance:S,...f.familyConfig?{familyConfig:f.familyConfig}:{}})}function pi(e,t={},n="svg",r,i={}){let o=Yo(t),a=o.serializable,s=a,d=ai(s);if(d.length>0)throw new TypeError(`Invalid RenderOptions: ${d.join("; ")}`);let l=Yn(a.style),c=l.style,p=E(l.face),u=li(s);if(u.length>0)throw new TypeError(`Invalid RenderOptions: ${u.join("; ")}`);let f=He(e),m=hn(f,a.mermaidConfig??{}),h=f===e?m:mn(e),y=Object.freeze({...m,originalText:e}),g=i.familyDescriptor??Uo(y,h);if(i.expectedFamilyId!==void 0&&g.id!==i.expectedFamilyId)throw new nn(i.expectedFamilyId,g.id);let S=Cn(y.config.themeCSS,a.security??"default");if(S)throw new TypeError(S);let k=Object.freeze($e.filter(F=>a[F]!==void 0)),H=Go(g,k),v=is({family:g,source:y,options:a,...c?{style:c}:{},...p?{styleFace:p}:{}}),{appearance:L,renderOptions:Y,familyConfig:_}=v,N=rs(g,L,n,i,a.mermaidConfig,o.onConfigDiagnostic),C=N.capabilityDecision,G=Object.freeze({version:C.version,accepted:C.resolutions.filter(ti).every(F=>F.level!=="required"||F.status==="selected"),resolutions:Object.freeze(C.resolutions.filter(ti))}),w={version:ht,authoredSource:y.originalText,source:y.text,options:rn(Y),appearance:L.digest,..._?{familyConfig:_}:{},capabilities:G},x=Fe(w),A={...w,output:n,outputOptions:r,capabilities:C},U=Object.freeze({version:ht,output:n,source:E(y),renderOptions:Y,appearance:L,..._?{familyConfig:_}:{},capabilityDecision:C,explicitOptionFields:k,...H.length===0?{}:{resolutionDiagnostics:H},sharedRequestDigest:x,requestDigest:Fe(A)});return on.set(U,N),U}function os(e){return"positioned"in e?e:{positioned:e}}function ui(e,t,n=t.source){let r=he(t).family;if(r.id!==e)throw new Error(`Resolved request planned family ${r.id}, not ${e}`);if(!r.layout)throw new Error(`No layout registered for Mermaid family ${e}`);let i=bt(t);return os(r.layout({source:n,renderOptions:i.renderOptions,...i.styleFace?{styleFace:i.styleFace}:{},...i.familyConfig?{familyConfig:i.familyConfig}:{},...i.familyAppearance?{familyAppearance:i.familyAppearance}:{}}))}var fi=new WeakSet;function mi(e){if(fi.has(e))return;fi.add(e);let t=he(e),n=t.configDiagnostics??[];if(n.length===0)return;let r=t.onConfigDiagnostic??(i=>console.warn(i.message));for(let i of n)r(i)}function hi(e,t,n="scene.parts"){e.forEach((r,i)=>{let o=`${n}[${i}]`;t(r,o),r.kind==="group"&&hi(r.children.map(a=>a.node),t,`${o}.children`)})}function yi(e,t){let n=e.id.startsWith("family:"),r=jn(t,Nn,"scene");Pn(r,{mode:n?"external":"internal"});let i=r,o=[];n&&i.family!==e.id&&o.push({code:"SCENE_DOCUMENT",path:"scene.family",message:`external family "${e.id}" emitted a document owned by "${i.family}"`});let a=new Set(e.semanticRoles),s=new Set(e.semanticChannels),d=new Map(e.scenePrimitiveEvidence.map(l=>[`${l.role}\0${l.primitive}`,l]));if(hi(i.parts,(l,c)=>{if(!a.has(l.role)){o.push({code:"SCENE_PRIMITIVE_CLAIM",path:`${c}.role`,message:`emitted undeclared role "${l.role}"`});return}for(let p of Object.keys(l.channels??{}))s.has(p)||o.push({code:"SCENE_CHANNEL_CLAIM",path:`${c}.channels.${p}`,message:`emitted undeclared semantic channel "${p}"`});for(let p of $n(l)){let u=d.get(`${l.role}\0${p}`);(!u||u.applicability!=="applicable"||u.realization==="unsupported")&&o.push({code:"SCENE_PRIMITIVE_CLAIM",path:c,message:`emitted undeclared ${l.role}/${p} primitive`})}}),o.length>0)throw new In(Object.freeze(o));return i}function bi(e,t){let n=e.appearance.colors,r=e.output==="png"&&n.embedFontImport!==!1?{...n,embedFontImport:!1}:n;return{positioned:t.positioned,colors:r,resolved:bt(e)}}function ss(e,t){let n=he(e);if(n.mode!=="scene")throw new Error(`Resolved ${e.output} request has no Scene execution plan`);let r=n.family;return yi(r,r.lowerScene(bi(e,t)))}function gi(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function as(e,t,n){let r=`${n}svg-title`,i=`${n}svg-desc`,o=[],a=[];if(t.title&&(o.push(`aria-labelledby="${r}"`),a.push(`<title id="${r}">${gi(t.title)}</title>`)),t.descr&&(o.push(`aria-describedby="${i}"`),a.push(`<desc id="${i}">${gi(t.descr)}</desc>`)),a.length===0)return e;let s=Sn(e);if(!s||Je(s,"aria-labelledby")||Je(s,"aria-describedby"))return e;let d=`${Je(s,"role")?"":' role="img"'} ${o.join(" ")}`,l=e.slice(s.start,s.end);return Rn(e,s,`${l.slice(0,-1)}${d}>${a.join("")}`)}function cs(e,t,n){let r=he(e);if(r.mode!=="scene"&&r.mode!=="family-svg"||!r.executionDecision)throw new Error(`Resolved ${e.output} request has no graphical execution plan`);let i=e.renderOptions,o=r.family,a=bi(e,t),s;if(r.mode==="scene"){let f=ss(e,t);s=r.backend.backend.render(f,{seed:i.seed??0,...e.appearance.styled?{style:e.appearance.style}:{}})}else s=o.renderSvg(a);ie(s,"backend/family SVG output");let d=xn(s,a.colors);ie(d,"color-resolved SVG output"),d=Vr(d,e.appearance.font),ie(d,"font-geometry-fitted SVG output");let l=i.idPrefix??"";l&&(d=qn(d,l),ie(d,"namespaced SVG output"));let c=e.source.accessibility;(t.injectAccessibility??!0)&&(c.title||c.descr)&&(d=as(d,c,l),ie(d,"accessibility-projected SVG output")),i.compact&&(d=Wn(d),ie(d,"compacted SVG output"));let p=e.output==="png"?"strict":i.security,u=An(d,p);return n.push(...u.diagnostics),d=u.svg,ie(d,"final SVG output"),Object.freeze({svg:d,executionDecision:r.executionDecision})}function ls(e,t){let n=he(e).family.id;return cs(e,ui(n,e),t)}function Si(e,t,n,r,i={}){let o=pi(e,t,n,r,i);mi(o);let a=[],s=ls(o,a),d=di(o,a);return Object.freeze({svg:s.svg,receipt:Object.freeze({...d,graphicalProjectionDigest:Fe(s.svg),executionDecision:s.executionDecision})})}function Fc(e,t,n){return dn(n),Si(e,t,"svg",void 0,{expectedFamilyId:n.id,familyDescriptor:n}).svg}export{Fc as renderLoadedFamilySvg};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ye,d as Fe}from"./chunk-A7L4WWVW.js";import{f as Ze}from"./chunk-
|
|
1
|
+
import{c as Ye,d as Fe}from"./chunk-A7L4WWVW.js";import{f as Ze}from"./chunk-EBPTM2RP.js";import"./chunk-KJVNXJ5Y.js";import{e as xe}from"./chunk-QMZ4Y6I7.js";import"./chunk-FFOHLPDA.js";import{a as it}from"./chunk-I6VE56S7.js";import{a as rt}from"./chunk-OFRMKQA6.js";import{b as Ne,e as Be}from"./chunk-FLD63DXE.js";import{a as J,c as fe,d as ue,e as ee,g as _e,j as A,k as me}from"./chunk-32FWKUUV.js";import{a as Xe,b as Oe,c as Ge}from"./chunk-EPFMQPXX.js";import{G as Ke,H as Qe,I as Je,L as G,N as Ve,O as b,P as Z,i as ae,ia as V,j as Le,ja as se,ka as U,l as Ue,la as ce,m as We,na as et,oa as tt,pa as oe,qa as ot,t as je,xa as nt}from"./chunk-EX6TP7QM.js";import"./chunk-P7HMSKHJ.js";var Lt=Object.freeze({id:"sequence",upstreamId:"sequence",maturity:"stable",label:"Sequence",headers:["sequenceDiagram"],aliases:[],config:{section:"sequence",keys:["actorMargin","width","height","diagramMarginX","diagramMarginY","messageMargin","noteMargin","activationWidth","showSequenceNumbers","boxMargin","boxTextMargin","messageAlign","mirrorActors","bottomMarginAdj","rightAngles","wrap","wrapPadding","labelBoxWidth","labelBoxHeight","hideUnusedParticipants","forceMenus","arrowMarkerAbsolute","noteAlign","actorFontSize","actorFontFamily","actorFontWeight","noteFontSize","noteFontFamily","noteFontWeight","messageFontSize","messageFontFamily","messageFontWeight","useMaxWidth","useWidth"],noopKeys:["actorFontFamily","actorFontSize","actorFontWeight","arrowMarkerAbsolute","bottomMarginAdj","boxMargin","boxTextMargin","forceMenus","hideUnusedParticipants","labelBoxHeight","labelBoxWidth","messageAlign","messageFontFamily","messageFontSize","messageFontWeight","mirrorActors","noteAlign","noteFontFamily","noteFontSize","noteFontWeight","rightAngles","useMaxWidth","useWidth","wrap","wrapPadding"]},identity:{id:"family:sequence",kind:"family",version:"1.0.0",compatibility:{core:"^0.3.0"},provenance:{owner:"agentic-mermaid",source:"built-in"}},collisionPriority:100,semanticChannels:["category"],semanticRoles:["prelude","defs","chrome","actor","lifeline","activation","message","block","group","note","label","icon"],scenePrimitiveEvidence:[{role:"prelude",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"defs",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"defs",primitive:"marker",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"actor",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"actor",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"lifeline",primitive:"connector",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"activation",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"message",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"message",primitive:"connector",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"block",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"block",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"block",primitive:"connector",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"group",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"group",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"note",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"note",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"label",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"icon",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"icon",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"icon",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]}],example:`sequenceDiagram
|
|
2
2
|
participant U as User
|
|
3
3
|
participant S as Server
|
|
4
4
|
U->>S: request
|