All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.chunks.mermaid.esm.min.chunk-INOGIEW4.mjs Maven / Gradle / Ivy

Go to download

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

There is a newer version: 11.4.0
Show newest version
import{a as at}from"./chunk-TI4EEUUG.mjs";import{Ba as R,Ea as F,Fa as O,Ga as _,Ha as N,Ia as k,Ja as j,Ka as A,L as v,La as H,Ma as z,Na as I,Oa as U,Pa as X,Qa as Y,Ra as J,Sa as V,Ta as q,Ua as G,Va as Z,Wa as K,b as d,e as m,fa as D,h as B,k as w,t as L}from"./chunk-DMXVZUOD.mjs";import{T as Q,k as b}from"./chunk-6BY5RJGC.mjs";import{a,e as st}from"./chunk-GTKDMUJJ.mjs";var nt=st(at(),1);var ct="\u200B",ut={curveBasis:_,curveBasisClosed:N,curveBasisOpen:k,curveBumpX:F,curveBumpY:O,curveBundle:j,curveCardinalClosed:H,curveCardinalOpen:z,curveCardinal:A,curveCatmullRomClosed:U,curveCatmullRomOpen:X,curveCatmullRom:I,curveLinear:R,curveLinearClosed:Y,curveMonotoneX:J,curveMonotoneY:V,curveNatural:q,curveStep:G,curveStepAfter:K,curveStepBefore:Z},lt=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,ft=a(function(e,t){let r=rt(e,/(?:init\b)|(?:initialize\b)/),n={};if(Array.isArray(r)){let s=r.map(u=>u.args);L(s),n=w(n,[...s])}else n=r.args;if(!n)return;let i=B(e,t),o="config";return n[o]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[o],delete n[o]),n},"detectInit"),rt=a(function(e,t=null){try{let r=new RegExp(`[%]{2}(?![{]${lt.source})(?=[}][%]{2}).*
`,"ig");e=e.trim().replace(r,"").replace(/'/gm,'"'),d.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let n,i=[];for(;(n=m.exec(e))!==null;)if(n.index===m.lastIndex&&m.lastIndex++,n&&!t||t&&n[1]?.match(t)||t&&n[2]?.match(t)){let o=n[1]?n[1]:n[2],s=n[3]?n[3].trim():n[4]?JSON.parse(n[4].trim()):null;i.push({type:o,args:s})}return i.length===0?{type:e,args:null}:i.length===1?i[0]:i}catch(r){return d.error(`ERROR: ${r.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),Ht=a(function(e){return e.replace(m,"")},"removeDirectives"),gt=a(function(e,t){for(let[r,n]of t.entries())if(n.match(e))return r;return-1},"isSubstringInArray");function dt(e,t){if(!e)return t;let r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return ut[r]??t}a(dt,"interpolateToCurve");function ht(e,t){let r=e.trim();if(r)return t.securityLevel!=="loose"?(0,nt.sanitizeUrl)(r):r}a(ht,"formatUrl");var mt=a((e,...t)=>{let r=e.split("."),n=r.length-1,i=r[n],o=window;for(let s=0;s{r+=it(i,t),t=i});let n=r/2;return T(e,n)}a(pt,"traverseEdge");function xt(e){return e.length===1?e[0]:pt(e)}a(xt,"calcLabelPosition");var tt=a((e,t=2)=>{let r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),T=a((e,t)=>{let r,n=t;for(let i of e){if(r){let o=it(i,r);if(o=1)return{x:i.x,y:i.y};if(s>0&&s<1)return{x:tt((1-s)*r.x+s*i.x,5),y:tt((1-s)*r.y+s*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),yt=a((e,t,r)=>{d.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());let i=T(t,25),o=e?10:5,s=Math.atan2(t[0].y-i.y,t[0].x-i.x),u={x:0,y:0};return u.x=Math.sin(s)*o+(t[0].x+i.x)/2,u.y=-Math.cos(s)*o+(t[0].y+i.y)/2,u},"calcCardinalityPosition");function vt(e,t,r){let n=structuredClone(r);d.info("our points",n),t!=="start_left"&&t!=="start_right"&&n.reverse();let i=25+e,o=T(n,i),s=10+e*.5,u=Math.atan2(n[0].y-o.y,n[0].x-o.x),c={x:0,y:0};return t==="start_left"?(c.x=Math.sin(u+Math.PI)*s+(n[0].x+o.x)/2,c.y=-Math.cos(u+Math.PI)*s+(n[0].y+o.y)/2):t==="end_right"?(c.x=Math.sin(u-Math.PI)*s+(n[0].x+o.x)/2-5,c.y=-Math.cos(u-Math.PI)*s+(n[0].y+o.y)/2-5):t==="end_left"?(c.x=Math.sin(u)*s+(n[0].x+o.x)/2-5,c.y=-Math.cos(u)*s+(n[0].y+o.y)/2-5):(c.x=Math.sin(u)*s+(n[0].x+o.x)/2,c.y=-Math.cos(u)*s+(n[0].y+o.y)/2),c}a(vt,"calcTerminalLabelPosition");function bt(e){let t="",r="";for(let n of e)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":t=t+n+";");return{style:t,labelStyle:r}}a(bt,"getStylesFromArray");var et=0,Ct=a(()=>(et++,"id-"+Math.random().toString(36).substr(2,12)+"-"+et),"generateId");function Mt(e){let t="",r="0123456789abcdef",n=r.length;for(let i=0;iMt(e.length),"random"),Pt=a(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),Tt=a(function(e,t){let r=t.text.replace(v.lineBreakRegex," "),[,n]=S(t.fontSize),i=e.append("text");i.attr("x",t.x),i.attr("y",t.y),i.style("text-anchor",t.anchor),i.style("font-family",t.fontFamily),i.style("font-size",n),i.style("font-weight",t.fontWeight),i.attr("fill",t.fill),t.class!==void 0&&i.attr("class",t.class);let o=i.append("tspan");return o.attr("x",t.x+t.textMargin*2),o.attr("fill",t.fill),o.text(r),i},"drawSimpleText"),$t=b((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"
"},r),v.lineBreakRegex.test(e)))return e;let n=e.split(" ").filter(Boolean),i=[],o="";return n.forEach((s,u)=>{let c=M(`${s} `,r),l=M(o,r);if(c>t){let{hyphenatedStrings:h,remainingWord:f}=St(s,t,"-",r);i.push(o,...h),o=f}else l+c>=t?(i.push(o),o=s):o=[o,s].filter(Boolean).join(" ");u+1===n.length&&i.push(o)}),i.filter(s=>s!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),St=b((e,t,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);let i=[...e],o=[],s="";return i.forEach((u,c)=>{let l=`${s}${u}`;if(M(l,n)>=t){let x=c+1,h=i.length===x,f=`${l}${r}`;o.push(h?l:f),s=""}else s=l}),{hyphenatedStrings:o,remainingWord:s}},(e,t,r="-",n)=>`${e}${t}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function Wt(e,t){return $(e,t).height}a(Wt,"calculateTextHeight");function M(e,t){return $(e,t).width}a(M,"calculateTextWidth");var $=b((e,t)=>{let{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=t;if(!e)return{width:0,height:0};let[,o]=S(r),s=["sans-serif",n],u=e.split(v.lineBreakRegex),c=[],l=D("body");if(!l.remove)return{width:0,height:0,lineHeight:0};let p=l.append("svg");for(let h of s){let f=0,g={width:0,height:0,lineHeight:0};for(let ot of u){let W=Pt();W.text=ot||ct;let E=Tt(p,W).style("font-size",o).style("font-weight",i).style("font-family",h),y=(E._groups||E)[0][0].getBBox();if(y.width===0&&y.height===0)throw new Error("svg element not in render tree");g.width=Math.round(Math.max(g.width,y.width)),f=Math.round(y.height),g.height+=f,g.lineHeight=Math.round(Math.max(g.lineHeight,f))}c.push(g)}p.remove();let x=isNaN(c[1].height)||isNaN(c[1].width)||isNaN(c[1].lineHeight)||c[0].height>c[1].height&&c[0].width>c[1].width&&c[0].lineHeight>c[1].lineHeight?0:1;return c[x]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),P=class{constructor(t=!1,r){this.count=0;this.count=r?r.length:0,this.next=t?()=>this.count++:()=>Date.now()}static{a(this,"InitIDGenerator")}},C,Et=a(function(e){return C=C||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),C.innerHTML=e,unescape(C.textContent)},"entityDecode");function zt(e){return"str"in e}a(zt,"isDetailedError");var Bt=a((e,t,r,n)=>{if(!n)return;let i=e.node()?.getBBox();i&&e.append("text").text(n).attr("x",i.x+i.width/2).attr("y",-r).attr("class",t)},"insertTitle"),S=a(e=>{if(typeof e=="number")return[e,e+"px"];let t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");function Lt(e,t){return Q({},e,t)}a(Lt,"cleanAndMerge");var It={assignWithDepth:w,wrapLabel:$t,calculateTextHeight:Wt,calculateTextWidth:M,calculateTextDimensions:$,cleanAndMerge:Lt,detectInit:ft,detectDirective:rt,isSubstringInArray:gt,interpolateToCurve:dt,calcLabelPosition:xt,calcCardinalityPosition:yt,calcTerminalLabelPosition:vt,formatUrl:ht,getStylesFromArray:bt,generateId:Ct,random:wt,runFunc:mt,entityDecode:Et,insertTitle:Bt,parseFontSize:S,InitIDGenerator:P},Ut=a(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){let n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"\uFB02\xB0\xB0"+n+"\xB6\xDF":"\uFB02\xB0"+n+"\xB6\xDF"}),t},"encodeEntities"),Xt=a(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities");var Yt=a((e,t,{counter:r=0,prefix:n,suffix:i})=>`${n?`${n}_`:""}${e}_${t}_${r}${i?`_${i}`:""}`,"getEdgeId");export{ct as a,Ht as b,dt as c,bt as d,Ct as e,wt as f,$t as g,Wt as h,M as i,zt as j,S as k,Lt as l,It as m,Ut as n,Xt as o,Yt as p};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy