@logan-jun/cd1-rag-chat 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/assets/arc-scm8MMJs.js +1 -0
  2. package/dist/assets/architectureDiagram-3BPJPVTR-B4HnSePg.js +36 -0
  3. package/dist/assets/blockDiagram-GPEHLZMM-Br570MCp.js +132 -0
  4. package/dist/assets/c4Diagram-AAUBKEIU-DkTSnj0d.js +10 -0
  5. package/dist/assets/channel-DiZdOJ9B.js +1 -0
  6. package/dist/assets/chunk-2J33WTMH-CrTr9xzl.js +1 -0
  7. package/dist/assets/chunk-4BX2VUAB-D0wgG8xH.js +1 -0
  8. package/dist/assets/chunk-55IACEB6-Duov_Htw.js +1 -0
  9. package/dist/assets/chunk-727SXJPM-DDvX-nhe.js +206 -0
  10. package/dist/assets/chunk-AQP2D5EJ-09XyW5jk.js +231 -0
  11. package/dist/assets/chunk-FMBD7UC4-C8_DpYrt.js +15 -0
  12. package/dist/assets/chunk-ND2GUHAM-BeN_xln2.js +1 -0
  13. package/dist/assets/chunk-QZHKN3VN-vOMf7cyc.js +1 -0
  14. package/dist/assets/classDiagram-4FO5ZUOK-DDDJcc4H.js +1 -0
  15. package/dist/assets/classDiagram-v2-Q7XG4LA2-DDDJcc4H.js +1 -0
  16. package/dist/assets/cose-bilkent-S5V4N54A-pK2cAyHP.js +1 -0
  17. package/dist/assets/cytoscape.esm-C6a136cz.js +331 -0
  18. package/dist/assets/dagre-BM42HDAG-kL6GF6jg.js +4 -0
  19. package/dist/assets/defaultLocale-CrowFXzY.js +1 -0
  20. package/dist/assets/diagram-2AECGRRQ-dykDFI_K.js +43 -0
  21. package/dist/assets/diagram-5GNKFQAL-WJvXRiuM.js +10 -0
  22. package/dist/assets/diagram-KO2AKTUF-D2favLYT.js +3 -0
  23. package/dist/assets/diagram-LMA3HP47-CXVuETL_.js +24 -0
  24. package/dist/assets/diagram-OG6HWLK6-BcJzKfoj.js +24 -0
  25. package/dist/assets/erDiagram-TEJ5UH35-thR4lGNd.js +85 -0
  26. package/dist/assets/flowDiagram-I6XJVG4X-BxfwGe_r.js +162 -0
  27. package/dist/assets/ganttDiagram-6RSMTGT7-fwLip5Nh.js +292 -0
  28. package/dist/assets/gitGraphDiagram-PVQCEYII-D-oFePm0.js +106 -0
  29. package/dist/assets/graph-BB0J4w4c.js +1 -0
  30. package/dist/assets/index-CbSmh0fl.js +86 -0
  31. package/dist/assets/index-DDQloFPo.css +1 -0
  32. package/dist/assets/infoDiagram-5YYISTIA-D4MiRb75.js +2 -0
  33. package/dist/assets/init-Gi6I4Gst.js +1 -0
  34. package/dist/assets/ishikawaDiagram-YF4QCWOH-BXo0XBC7.js +70 -0
  35. package/dist/assets/journeyDiagram-JHISSGLW-CqScJnKj.js +139 -0
  36. package/dist/assets/kanban-definition-UN3LZRKU-MV47OAPx.js +89 -0
  37. package/dist/assets/katex-DOa3rsiF.js +257 -0
  38. package/dist/assets/layout-X4aHIIHH.js +1 -0
  39. package/dist/assets/linear-DLYnUT7M.js +1 -0
  40. package/dist/assets/mermaid.core-DuagT3S2.js +307 -0
  41. package/dist/assets/mindmap-definition-RKZ34NQL-HJXV2iNz.js +96 -0
  42. package/dist/assets/ordinal-Cboi1Yqb.js +1 -0
  43. package/dist/assets/pieDiagram-4H26LBE5-BVHq2F8U.js +30 -0
  44. package/dist/assets/quadrantDiagram-W4KKPZXB-BUPck4BP.js +7 -0
  45. package/dist/assets/requirementDiagram-4Y6WPE33-DQl89ON9.js +84 -0
  46. package/dist/assets/sankeyDiagram-5OEKKPKP-DD5N52ZQ.js +40 -0
  47. package/dist/assets/sequenceDiagram-3UESZ5HK-zctcDLCC.js +162 -0
  48. package/dist/assets/stateDiagram-AJRCARHV-Vyn0aDZv.js +1 -0
  49. package/dist/assets/stateDiagram-v2-BHNVJYJU-BY6pmmBt.js +1 -0
  50. package/dist/assets/timeline-definition-PNZ67QCA-1XNXDgjy.js +120 -0
  51. package/dist/assets/vennDiagram-CIIHVFJN-DZ1fF_Rg.js +34 -0
  52. package/dist/assets/wardley-L42UT6IY-DsEWk1n9.js +173 -0
  53. package/dist/assets/wardleyDiagram-YWT4CUSO-CpQIM9KB.js +78 -0
  54. package/dist/assets/xychartDiagram-2RQKCTM6-CIryoW2U.js +7 -0
  55. package/dist/index.html +2 -2
  56. package/package.json +18 -4
  57. package/dist/assets/index-BpgvSxpC.js +0 -89
  58. package/dist/assets/index-C4j9DEAI.css +0 -1
@@ -0,0 +1,4 @@
1
+ import{b,aG as F,w as Y,u as _,v as j,aE as r,a4 as H,bk as Q,b5 as V,ao as U,ad as $,aR as P,al as q,am as z,aQ as K,an as W}from"./mermaid.core-DuagT3S2.js";import{Q as x,G as R}from"./graph-BB0J4w4c.js";import{b as Z,m as B,l as I}from"./layout-X4aHIIHH.js";import"./index-CbSmh0fl.js";var ee=4;function ne(e){return Z(e,ee)}function E(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:te(e),edges:se(e)};return x(e.graph())||(t.value=ne(e.graph())),t}function te(e){return B(e.nodes(),function(t){var n=e.node(t),o=e.parent(t),c={v:t};return x(n)||(c.value=n),x(o)||(c.parent=o),c})}function se(e){return B(e.edges(),function(t){var n=e.edge(t),o={v:t.v,w:t.w};return x(t.name)||(o.name=t.name),x(n)||(o.value=n),o})}var f=new Map,N=new Map,A=new Map,re=b(()=>{N.clear(),A.clear(),f.clear()},"clear"),O=b((e,t)=>{const n=N.get(t)||[];return r.trace("In isDescendant",t," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),ie=b((e,t)=>{const n=N.get(t)||[];return r.info("Descendants of ",t," is ",n),r.info("Edge is ",e),e.v===t||e.w===t?!1:n?n.includes(e.v)||O(e.v,t)||O(e.w,t)||n.includes(e.w):(r.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),G=b((e,t,n,o)=>{r.warn("Copying children of ",e,"root",o,"data",t.node(e),o);const c=t.children(e)||[];e!==o&&c.push(e),r.warn("Copying (nodes) clusterId",e,"nodes",c),c.forEach(a=>{if(t.children(a).length>0)G(a,t,n,o);else{const i=t.node(a);r.info("cp ",a," to ",o," with parent ",e),n.setNode(a,i),o!==t.parent(a)&&(r.warn("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==o&&a!==e?(r.debug("Setting parent",a,e),n.setParent(a,e)):(r.info("In copy ",e,"root",o,"data",t.node(e),o),r.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==o,"node!==clusterId",a!==e));const u=t.edges(a);r.debug("Copying Edges",u),u.forEach(l=>{r.info("Edge",l);const v=t.edge(l.v,l.w,l.name);r.info("Edge data",v,o);try{ie(l,o)?(r.info("Copying as ",l.v,l.w,v,l.name),n.setEdge(l.v,l.w,v,l.name),r.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):r.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",o," clusterId:",e)}catch(C){r.error(C)}})}r.debug("Removing node",a),t.removeNode(a)})},"copy"),J=b((e,t)=>{const n=t.children(e);let o=[...n];for(const c of n)A.set(c,e),o=[...o,...J(c,t)];return o},"extractDescendants"),oe=b((e,t,n)=>{const o=e.edges().filter(l=>l.v===t||l.w===t),c=e.edges().filter(l=>l.v===n||l.w===n),a=o.map(l=>({v:l.v===t?n:l.v,w:l.w===t?t:l.w})),i=c.map(l=>({v:l.v,w:l.w}));return a.filter(l=>i.some(v=>l.v===v.v&&l.w===v.w))},"findCommonEdges"),D=b((e,t,n)=>{const o=t.children(e);if(r.trace("Searching children of id ",e,o),o.length<1)return e;let c;for(const a of o){const i=D(a,t,n),u=oe(t,n,i);if(i)if(u.length>0)c=i;else return i}return c},"findNonClusterChild"),k=b(e=>!f.has(e)||!f.get(e).externalConnections?e:f.has(e)?f.get(e).id:e,"getAnchorId"),ae=b((e,t)=>{if(!e||t>10){r.debug("Opting out, no graph ");return}else r.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(r.warn("Cluster identified",n," Replacement id in edges: ",D(n,e,n)),N.set(n,J(n,e)),f.set(n,{id:D(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const o=e.children(n),c=e.edges();o.length>0?(r.debug("Cluster identified",n,N),c.forEach(a=>{const i=O(a.v,n),u=O(a.w,n);i^u&&(r.warn("Edge: ",a," leaves cluster ",n),r.warn("Descendants of XXX ",n,": ",N.get(n)),f.get(n).externalConnections=!0)})):r.debug("Not a cluster ",n,N)});for(let n of f.keys()){const o=f.get(n).id,c=e.parent(o);c!==n&&f.has(c)&&!f.get(c).externalConnections&&(f.get(n).id=c)}e.edges().forEach(function(n){const o=e.edge(n);r.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),r.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let c=n.v,a=n.w;if(r.warn("Fix XXX",f,"ids:",n.v,n.w,"Translating: ",f.get(n.v)," --- ",f.get(n.w)),f.get(n.v)||f.get(n.w)){if(r.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),c=k(n.v),a=k(n.w),e.removeEdge(n.v,n.w,n.name),c!==n.v){const i=e.parent(c);f.get(i).externalConnections=!0,o.fromCluster=n.v}if(a!==n.w){const i=e.parent(a);f.get(i).externalConnections=!0,o.toCluster=n.w}r.warn("Fix Replacing with XXX",c,a,n.name),e.setEdge(c,a,o,n.name)}}),r.warn("Adjusted Graph",E(e)),T(e,0),r.trace(f)},"adjustClustersAndEdges"),T=b((e,t)=>{var c,a;if(r.warn("extractor - ",t,E(e),e.children("D")),t>10){r.error("Bailing out");return}let n=e.nodes(),o=!1;for(const i of n){const u=e.children(i);o=o||u.length>0}if(!o){r.debug("Done, no node has children",e.nodes());return}r.debug("Nodes = ",n,t);for(const i of n)if(r.debug("Extracting node",i,f,f.has(i)&&!f.get(i).externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!f.has(i))r.debug("Not a cluster",i,t);else if(!f.get(i).externalConnections&&e.children(i)&&e.children(i).length>0){r.warn("Cluster without external connections, without a parent and with children",i,t);let l=e.graph().rankdir==="TB"?"LR":"TB";(a=(c=f.get(i))==null?void 0:c.clusterData)!=null&&a.dir&&(l=f.get(i).clusterData.dir,r.warn("Fixing dir",f.get(i).clusterData.dir,l));const v=new R({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});r.warn("Old graph before copy",E(e)),G(i,e,v,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:f.get(i).clusterData,label:f.get(i).label,graph:v}),r.warn("New graph after copy node: (",i,")",E(v)),r.debug("Old graph after copy",E(e))}else r.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!f.get(i).externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),r.debug(f);n=e.nodes(),r.warn("New list of nodes",n);for(const i of n){const u=e.node(i);r.warn(" Now next level",i,u),u!=null&&u.clusterNode&&T(u.graph,t+1)}},"extractor"),L=b((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(o=>{const c=e.children(o),a=L(e,c);n=[...n,...a]}),n},"sorter"),ce=b(e=>L(e,e.children()),"sortNodesByHierarchy"),M=b(async(e,t,n,o,c,a)=>{r.warn("Graph in recursive render:XAX",E(t),c);const i=t.graph().rankdir;r.trace("Dir in recursive render - dir:",i);const u=e.insert("g").attr("class","root");t.nodes()?r.info("Recursive render XXX",t.nodes()):r.info("No nodes found for",t),t.edges().length>0&&r.info("Recursive edges",t.edge(t.edges()[0]));const l=u.insert("g").attr("class","clusters"),v=u.insert("g").attr("class","edgePaths"),C=u.insert("g").attr("class","edgeLabels"),w=u.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(d){const s=t.node(d);if(c!==void 0){const g=JSON.parse(JSON.stringify(c.clusterData));r.trace(`Setting data for parent cluster XXX
2
+ Node.id = `,d,`
3
+ data=`,g.height,`
4
+ Parent cluster`,c.height),t.setNode(c.id,g),t.parent(d)||(r.trace("Setting parent",d,c.id),t.setParent(d,c.id,g))}if(r.info("(Insert) Node XXX"+d+": "+JSON.stringify(t.node(d))),s!=null&&s.clusterNode){r.info("Cluster identified XBX",d,s.width,t.node(d));const{ranksep:g,nodesep:m}=t.graph();s.graph.setGraph({...s.graph.graph(),ranksep:g+25,nodesep:m});const p=await M(w,s.graph,n,o,t.node(d),a),S=p.elem;Q(s,S),s.diff=p.diff||0,r.info("New compound node after recursive render XAX",d,"width",s.width,"height",s.height),V(S,s)}else t.children(d).length>0?(r.trace("Cluster - the non recursive path XBX",d,s.id,s,s.width,"Graph:",t),r.trace(D(s.id,t)),f.set(s.id,{id:D(s.id,t),node:s})):(r.trace("Node - the non recursive path XAX",d,w,t.node(d),i),await U(w,t.node(d),{config:a,dir:i}))})),await b(async()=>{const d=t.edges().map(async function(s){const g=t.edge(s.v,s.w,s.name);r.info("Edge "+s.v+" -> "+s.w+": "+JSON.stringify(s)),r.info("Edge "+s.v+" -> "+s.w+": ",s," ",JSON.stringify(t.edge(s))),r.info("Fix",f,"ids:",s.v,s.w,"Translating: ",f.get(s.v),f.get(s.w)),await W(C,g)});await Promise.all(d)},"processEdges")(),r.info("Graph before layout:",JSON.stringify(E(t))),r.info("############################################# XXX"),r.info("### Layout ### XXX"),r.info("############################################# XXX"),I(t),r.info("Graph after layout:",JSON.stringify(E(t)));let y=0,{subGraphTitleTotalMargin:X}=$(a);return await Promise.all(ce(t).map(async function(d){var g;const s=t.node(d);if(r.info("Position XBX => "+d+": ("+s.x,","+s.y,") width: ",s.width," height: ",s.height),s!=null&&s.clusterNode)s.y+=X,r.info("A tainted cluster node XBX1",d,s.id,s.width,s.height,s.x,s.y,t.parent(d)),f.get(s.id).node=s,P(s);else if(t.children(d).length>0){r.info("A pure cluster node XBX1",d,s.id,s.x,s.y,s.width,s.height,t.parent(d)),s.height+=X,t.node(s.parentId);const m=(s==null?void 0:s.padding)/2||0,p=((g=s==null?void 0:s.labelBBox)==null?void 0:g.height)||0,S=p-m||0;r.debug("OffsetY",S,"labelHeight",p,"halfPadding",m),await q(l,s),f.get(s.id).node=s}else{const m=t.node(s.parentId);s.y+=X/2,r.info("A regular node XBX1 - using the padding",s.id,"parent",s.parentId,s.width,s.height,s.x,s.y,"offsetY",s.offsetY,"parent",m,m==null?void 0:m.offsetY,s),P(s)}})),t.edges().forEach(function(d){const s=t.edge(d);r.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(s),s),s.points.forEach(S=>S.y+=X/2);const g=t.node(d.v);var m=t.node(d.w);const p=z(v,s,f,n,g,m,o);K(s,p)}),t.nodes().forEach(function(d){const s=t.node(d);r.info(d,s.type,s.diff),s.isGroup&&(y=s.diff)}),r.warn("Returning from recursive render XAX",u,y),{elem:u,diff:y}},"recursiveRender"),ge=b(async(e,t)=>{var a,i,u,l,v,C;const n=new R({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:((a=e.config)==null?void 0:a.nodeSpacing)||((u=(i=e.config)==null?void 0:i.flowchart)==null?void 0:u.nodeSpacing)||e.nodeSpacing,ranksep:((l=e.config)==null?void 0:l.rankSpacing)||((C=(v=e.config)==null?void 0:v.flowchart)==null?void 0:C.rankSpacing)||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),o=t.select("g");F(o,e.markers,e.type,e.diagramId),Y(),_(),j(),re(),e.nodes.forEach(w=>{n.setNode(w.id,{...w}),w.parentId&&n.setParent(w.id,w.parentId)}),r.debug("Edges:",e.edges),e.edges.forEach(w=>{if(w.start===w.end){const h=w.start,y=h+"---"+h+"---1",X=h+"---"+h+"---2",d=n.node(h);n.setNode(y,{domId:y,id:y,parentId:d.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(y,d.parentId),n.setNode(X,{domId:X,id:X,parentId:d.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(X,d.parentId);const s=structuredClone(w),g=structuredClone(w),m=structuredClone(w);s.label="",s.arrowTypeEnd="none",s.endLabelLeft="",s.endLabelRight="",s.startLabelLeft="",s.id=h+"-cyclic-special-1",g.startLabelRight="",g.startLabelLeft="",g.endLabelLeft="",g.endLabelRight="",g.arrowTypeStart="none",g.arrowTypeEnd="none",g.id=h+"-cyclic-special-mid",m.label="",m.startLabelRight="",m.startLabelLeft="",m.arrowTypeStart="none",d.isGroup&&(s.fromCluster=h,m.toCluster=h),m.id=h+"-cyclic-special-2",m.arrowTypeStart="none",n.setEdge(h,y,s,h+"-cyclic-special-0"),n.setEdge(y,X,g,h+"-cyclic-special-1"),n.setEdge(X,h,m,h+"-cyc<lic-special-2")}else n.setEdge(w.start,w.end,{...w},w.id)}),r.warn("Graph at first:",JSON.stringify(E(n))),ae(n),r.warn("Graph after XAX:",JSON.stringify(E(n)));const c=H();await M(o,n,e.type,e.diagramId,void 0,c)},"render");export{ge as render};
@@ -0,0 +1 @@
1
+ function J(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function j(n,t){if(!isFinite(n)||n===0)return null;var e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"),i=n.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+n.slice(e+1)]}function K(n){return n=j(Math.abs(n)),n?n[1]:NaN}function Q(n,t){return function(e,i){for(var o=e.length,a=[],c=0,h=n[0],M=0;o>0&&h>0&&(M+h+1>i&&(h=Math.max(1,i-M)),a.push(e.substring(o-=h,o+h)),!((M+=h+1)>i));)h=n[c=(c+1)%n.length];return a.reverse().join(t)}}function V(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var W=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $(n){if(!(t=W.exec(n)))throw new Error("invalid format: "+n);var t;return new L({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$.prototype=L.prototype;function L(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}L.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _(n){n:for(var t=n.length,e=1,i=-1,o;e<t;++e)switch(n[e]){case".":i=o=e;break;case"0":i===0&&(i=e),o=e;break;default:if(!+n[e])break n;i>0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(o+1):n}var N;function v(n,t){var e=j(n,t);if(!e)return N=void 0,n.toPrecision(t);var i=e[0],o=e[1],a=o-(N=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,c=i.length;return a===c?i:a>c?i+new Array(a-c+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+j(n,Math.max(0,t+a-1))[0]}function X(n,t){var e=j(n,t);if(!e)return n+"";var i=e[0],o=e[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}const O={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:J,e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>X(n*100,t),r:X,s:v,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function R(n){return n}var U=Array.prototype.map,Y=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nn(n){var t=n.grouping===void 0||n.thousands===void 0?R:Q(U.call(n.grouping,Number),n.thousands+""),e=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",o=n.decimal===void 0?".":n.decimal+"",a=n.numerals===void 0?R:V(U.call(n.numerals,String)),c=n.percent===void 0?"%":n.percent+"",h=n.minus===void 0?"−":n.minus+"",M=n.nan===void 0?"NaN":n.nan+"";function T(f,g){f=$(f);var b=f.fill,p=f.align,m=f.sign,w=f.symbol,S=f.zero,E=f.width,F=f.comma,y=f.precision,C=f.trim,d=f.type;d==="n"?(F=!0,d="g"):O[d]||(y===void 0&&(y=12),C=!0,d="g"),(S||b==="0"&&p==="=")&&(S=!0,b="0",p="=");var q=(g&&g.prefix!==void 0?g.prefix:"")+(w==="$"?e:w==="#"&&/[boxX]/.test(d)?"0"+d.toLowerCase():""),B=(w==="$"?i:/[%p]/.test(d)?c:"")+(g&&g.suffix!==void 0?g.suffix:""),D=O[d],H=/[defgprs%]/.test(d);y=y===void 0?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function G(r){var l=q,u=B,x,I,k;if(d==="c")u=D(r)+u,r="";else{r=+r;var P=r<0||1/r<0;if(r=isNaN(r)?M:D(Math.abs(r),y),C&&(r=_(r)),P&&+r==0&&m!=="+"&&(P=!1),l=(P?m==="("?m:h:m==="-"||m==="("?"":m)+l,u=(d==="s"&&!isNaN(r)&&N!==void 0?Y[8+N/3]:"")+u+(P&&m==="("?")":""),H){for(x=-1,I=r.length;++x<I;)if(k=r.charCodeAt(x),48>k||k>57){u=(k===46?o+r.slice(x+1):r.slice(x))+u,r=r.slice(0,x);break}}}F&&!S&&(r=t(r,1/0));var z=l.length+r.length+u.length,s=z<E?new Array(E-z+1).join(b):"";switch(F&&S&&(r=t(s+r,s.length?E-u.length:1/0),s=""),p){case"<":r=l+r+u+s;break;case"=":r=l+s+r+u;break;case"^":r=s.slice(0,z=s.length>>1)+l+r+u+s.slice(z);break;default:r=s+l+r+u;break}return a(r)}return G.toString=function(){return f+""},G}function Z(f,g){var b=Math.max(-8,Math.min(8,Math.floor(K(g)/3)))*3,p=Math.pow(10,-b),m=T((f=$(f),f.type="f",f),{suffix:Y[8+b/3]});return function(w){return m(p*w)}}return{format:T,formatPrefix:Z}}var A,tn,rn;en({thousands:",",grouping:[3],currency:["$",""]});function en(n){return A=nn(n),tn=A.format,rn=A.formatPrefix,A}export{rn as a,$ as b,K as e,tn as f};
@@ -0,0 +1,43 @@
1
+ import{b1 as k,a1 as R,a6 as E,b4 as F,a2 as I,b2 as _,b as l,b0 as D,t as z,s as b,a3 as C,T as G,aE as P,af as W,F as B}from"./mermaid.core-DuagT3S2.js";import{p as V}from"./chunk-4BX2VUAB-D0wgG8xH.js";import{p as H}from"./wardley-L42UT6IY-DsEWk1n9.js";import"./index-CbSmh0fl.js";var h={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},w={axes:[],curves:[],options:h},m=structuredClone(w),j=G.radar,N=l(()=>b({...j,...C().radar}),"getConfig"),M=l(()=>m.axes,"getAxes"),U=l(()=>m.curves,"getCurves"),X=l(()=>m.options,"getOptions"),Y=l(a=>{m.axes=a.map(t=>{var e;return{name:t.name,label:(e=t.label)!=null?e:t.name}})},"setAxes"),Z=l(a=>{m.curves=a.map(t=>{var e;return{name:t.name,label:(e=t.label)!=null?e:t.name,entries:q(t.entries)}})},"setCurves"),q=l(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=l(a=>{var e,r,s,n,i,o,c,d,p,u;const t=a.reduce((g,x)=>(g[x.name]=x,g),{});m.options={showLegend:(r=(e=t.showLegend)==null?void 0:e.value)!=null?r:h.showLegend,ticks:(n=(s=t.ticks)==null?void 0:s.value)!=null?n:h.ticks,max:(o=(i=t.max)==null?void 0:i.value)!=null?o:h.max,min:(d=(c=t.min)==null?void 0:c.value)!=null?d:h.min,graticule:(u=(p=t.graticule)==null?void 0:p.value)!=null?u:h.graticule}},"setOptions"),K=l(()=>{z(),m=structuredClone(w)},"clear"),f={getAxes:M,getCurves:U,getOptions:X,setAxes:Y,setCurves:Z,setOptions:J,getConfig:N,clear:K,setAccTitle:_,getAccTitle:I,setDiagramTitle:F,getDiagramTitle:E,getAccDescription:R,setAccDescription:k},Q=l(a=>{V(a,f);const{axes:t,curves:e,options:r}=a;f.setAxes(t),f.setCurves(e),f.setOptions(r)},"populate"),tt={parse:l(async a=>{const t=await H("radar",a);P.debug(t),Q(t)},"parse")},et=l((a,t,e,r)=>{var $;const s=r.db,n=s.getAxes(),i=s.getCurves(),o=s.getOptions(),c=s.getConfig(),d=s.getDiagramTitle(),p=D(t),u=at(p,c),g=($=o.max)!=null?$:Math.max(...i.map(y=>Math.max(...y.entries))),x=o.min,v=Math.min(c.width,c.height)/2;rt(u,n,v,o.ticks,o.graticule),st(u,n,v,c),A(u,n,i,x,g,o.graticule,c),S(u,i,o.showLegend,c),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-c.height/2-c.marginTop)},"draw"),at=l((a,t)=>{var n;const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return B(a,r,e,(n=t.useMaxWidth)!=null?n:!0),a.attr("viewBox",`0 0 ${e} ${r}`),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),rt=l((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n<r;n++){const i=e*(n+1)/r;a.append("circle").attr("r",i).attr("class","radarGraticule")}else if(s==="polygon"){const n=t.length;for(let i=0;i<r;i++){const o=e*(i+1)/r,c=t.map((d,p)=>{const u=2*p*Math.PI/n-Math.PI/2,g=o*Math.cos(u),x=o*Math.sin(u);return`${g},${x}`}).join(" ");a.append("polygon").attr("points",c).attr("class","radarGraticule")}}},"drawGraticule"),st=l((a,t,e,r)=>{const s=t.length;for(let n=0;n<s;n++){const i=t[n].label,o=2*n*Math.PI/s-Math.PI/2;a.append("line").attr("x1",0).attr("y1",0).attr("x2",e*r.axisScaleFactor*Math.cos(o)).attr("y2",e*r.axisScaleFactor*Math.sin(o)).attr("class","radarAxisLine"),a.append("text").text(i).attr("x",e*r.axisLabelFactor*Math.cos(o)).attr("y",e*r.axisLabelFactor*Math.sin(o)).attr("class","radarAxisLabel")}},"drawAxes");function A(a,t,e,r,s,n,i){const o=t.length,c=Math.min(i.width,i.height)/2;e.forEach((d,p)=>{if(d.entries.length!==o)return;const u=d.entries.map((g,x)=>{const v=2*Math.PI*x/o-Math.PI/2,$=L(g,r,s,c),y=$*Math.cos(v),O=$*Math.sin(v);return{x:y,y:O}});n==="circle"?a.append("path").attr("d",T(u,i.curveTension)).attr("class",`radarCurve-${p}`):n==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}l(A,"drawCurves");function L(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}l(L,"relativeRadius");function T(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s<e;s++){const n=a[(s-1+e)%e],i=a[s],o=a[(s+1)%e],c=a[(s+2)%e],d={x:i.x+(o.x-n.x)*t,y:i.y+(o.y-n.y)*t},p={x:o.x-(c.x-i.x)*t,y:o.y-(c.y-i.y)*t};r+=` C${d.x},${d.y} ${p.x},${p.y} ${o.x},${o.y}`}return`${r} Z`}l(T,"closedRoundCurve");function S(a,t,e,r){if(!e)return;const s=(r.width/2+r.marginRight)*3/4,n=-(r.height/2+r.marginTop)*3/4,i=20;t.forEach((o,c)=>{const d=a.append("g").attr("transform",`translate(${s}, ${n+c*i})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${c}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}l(S,"drawLegend");var nt={draw:et},ot=l((a,t)=>{let e="";for(let r=0;r<a.THEME_COLOR_LIMIT;r++){const s=a[`cScale${r}`];e+=`
2
+ .radarCurve-${r} {
3
+ color: ${s};
4
+ fill: ${s};
5
+ fill-opacity: ${t.curveOpacity};
6
+ stroke: ${s};
7
+ stroke-width: ${t.curveStrokeWidth};
8
+ }
9
+ .radarLegendBox-${r} {
10
+ fill: ${s};
11
+ fill-opacity: ${t.curveOpacity};
12
+ stroke: ${s};
13
+ }
14
+ `}return e},"genIndexStyles"),it=l(a=>{const t=W(),e=C(),r=b(t,e.themeVariables),s=b(r.radar,a);return{themeVariables:r,radarOptions:s}},"buildRadarStyleOptions"),lt=l(({radar:a}={})=>{const{themeVariables:t,radarOptions:e}=it(a);return`
15
+ .radarTitle {
16
+ font-size: ${t.fontSize};
17
+ color: ${t.titleColor};
18
+ dominant-baseline: hanging;
19
+ text-anchor: middle;
20
+ }
21
+ .radarAxisLine {
22
+ stroke: ${e.axisColor};
23
+ stroke-width: ${e.axisStrokeWidth};
24
+ }
25
+ .radarAxisLabel {
26
+ dominant-baseline: middle;
27
+ text-anchor: middle;
28
+ font-size: ${e.axisLabelFontSize}px;
29
+ color: ${e.axisColor};
30
+ }
31
+ .radarGraticule {
32
+ fill: ${e.graticuleColor};
33
+ fill-opacity: ${e.graticuleOpacity};
34
+ stroke: ${e.graticuleColor};
35
+ stroke-width: ${e.graticuleStrokeWidth};
36
+ }
37
+ .radarLegendText {
38
+ text-anchor: start;
39
+ font-size: ${e.legendFontSize}px;
40
+ dominant-baseline: hanging;
41
+ }
42
+ ${ot(t,e)}
43
+ `},"styles"),gt={parser:tt,db:f,renderer:nt,styles:lt};export{gt as diagram};
@@ -0,0 +1,10 @@
1
+ import{b4 as x,b2 as f,b1 as C,a6 as T,a1 as B,a2 as y,b as s,s as u,aE as k,b0 as V,F as N,a3 as S,t as _,T as D}from"./mermaid.core-DuagT3S2.js";import{p as $}from"./chunk-4BX2VUAB-D0wgG8xH.js";import{I as A}from"./chunk-QZHKN3VN-vOMf7cyc.js";import{p as I}from"./wardley-L42UT6IY-DsEWk1n9.js";import"./index-CbSmh0fl.js";var l=new A(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),X=s(()=>{l.reset(),_()},"clear"),z=s(()=>l.records.stack[0],"getRoot"),E=s(()=>l.records.cnt,"getCount"),H=D.treeView,L=s(()=>u(H,S().treeView),"getConfig"),R=s((e,t)=>{for(;e<=l.records.stack[l.records.stack.length-1].level;)l.records.stack.pop();const a={id:l.records.cnt++,level:e,name:t,children:[]};l.records.stack[l.records.stack.length-1].children.push(a),l.records.stack.push(a)},"addNode"),W={clear:X,addNode:R,getRoot:z,getCount:E,getConfig:L,getAccTitle:y,getAccDescription:B,getDiagramTitle:T,setAccDescription:C,setAccTitle:f,setDiagramTitle:x},w=W,F=s(e=>{$(e,w),e.nodes.map(t=>w.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),M={parse:s(async e=>{const t=await I("treeView",e);k.debug(t),F(t)},"parse")},Y=s((e,t,a,n,o)=>{const c=n.append("text").text(a.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:g,width:r}=c.node().getBBox(),d=g+o.paddingY*2,i=r+o.paddingX*2;c.attr("x",e+o.paddingX),c.attr("y",t+d/2),a.BBox={x:e,y:t,width:i,height:d}},"positionLabel"),m=s((e,t,a,n,o,c)=>e.append("line").attr("x1",t).attr("y1",a).attr("x2",n).attr("y2",o).attr("stroke-width",c).attr("class","treeView-node-line"),"positionLine"),j=s((e,t,a)=>{let n=0,o=0;const c=s((r,d,i,h)=>{const v=h*(i.rowIndent+i.paddingX);Y(v,n,d,r,i);const{height:p,width:b}=d.BBox;m(r,v-i.rowIndent,n+p/2,v,n+p/2,i.lineThickness),o=Math.max(o,v+b),n+=p},"drawNode"),g=s((r,d=0)=>{c(e,r,a,d),r.children.forEach(p=>{g(p,d+1)});const{x:i,y:h,height:v}=r.BBox;if(r.children.length){const{y:p,height:b}=r.children[r.children.length-1].BBox;m(e,i+a.paddingX,h+v,i+a.paddingX,p+b/2+a.lineThickness/2,a.lineThickness)}},"processNode");return g(t),{totalHeight:n,totalWidth:o}},"drawTree"),q=s((e,t,a,n)=>{k.debug(`Rendering treeView diagram
2
+ `+e);const o=n.db,c=o.getRoot(),g=o.getConfig(),r=V(t),d=r.append("g");d.attr("class","tree-view");const{totalHeight:i,totalWidth:h}=j(d,c,g);r.attr("viewBox",`-${g.lineThickness/2} 0 ${h} ${i}`),N(r,i,h,g.useMaxWidth)},"draw"),G={draw:q},J=G,K={labelFontSize:"16px",labelColor:"black",lineColor:"black"},O=s(({treeView:e})=>{const{labelFontSize:t,labelColor:a,lineColor:n}=u(K,e);return`
3
+ .treeView-node-label {
4
+ font-size: ${t};
5
+ fill: ${a};
6
+ }
7
+ .treeView-node-line {
8
+ stroke: ${n};
9
+ }
10
+ `},"styles"),P=O,ae={db:w,renderer:J,parser:M,styles:P};export{ae as diagram};
@@ -0,0 +1,3 @@
1
+ import{p as se}from"./chunk-4BX2VUAB-D0wgG8xH.js";import{a6 as de,b4 as le,b1 as ce,a1 as me,a2 as ue,b2 as xe,b as o,aE as h,a4 as D,a$ as fe,b8 as ge,t as he,s as pe,a3 as E,T as be,aZ as P,bn as S,p as ve}from"./mermaid.core-DuagT3S2.js";import{p as we,i as ye}from"./wardley-L42UT6IY-DsEWk1n9.js";import"./index-CbSmh0fl.js";var N="position frame",C="frame positioned",M="position relation",O="relation positioned",Pe=o(function(e){h.debug("options str",e)},"setOptions"),Se=o(function(){return{}},"getOptions"),ke=o(function(){W(),he()},"clear");function W(){R={}}o(W,"reset");var Me=be.eventmodeling,Be=o(()=>pe({...Me,...E().eventmodeling}),"getConfig"),R={};function I(){let e=Fe;const{ast:n}=R,t=A();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=G(i,n.dataEntities,t);e=y(e,{$kind:N,index:a,frame:i,textProps:r});let d;q(i)?(h.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=y(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=y(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(I,"getState");function H(e){R.ast=e}o(H,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:450-2*10,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function A(){return s}o(A,"getDiagramProps");var Fe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function U(e){const n=e.split(".");if(n.length===2)return n[0]}o(U,"extractNamespace");function V(e){const n=e.split(".");return n.length===2?n[1]:e}o(V,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function w(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&a<t}).map(i=>Number.parseInt(i)))+1}o(w,"findNextAvailableIndex");function L(e,n){const t=U(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:w(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:w(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:w(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(L,"calculateSwimlaneProps");function X(e){var t,i,a,r,d,l,c,m,f,u;const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:(t=n.emUiFill)!=null?t:"white",stroke:(i=n.emUiStroke)!=null?i:"#dbdada"};case"pcr":case"processor":return{fill:(a=n.emProcessorFill)!=null?a:"#edb3f6",stroke:(r=n.emProcessorStroke)!=null?r:"#b88cbf"};case"rmo":case"readmodel":return{fill:(d=n.emReadModelFill)!=null?d:"#d3f1a2",stroke:(l=n.emReadModelStroke)!=null?l:"#a3b732"};case"cmd":case"command":return{fill:(c=n.emCommandFill)!=null?c:"#bcd6fe",stroke:(m=n.emCommandStroke)!=null?m:"#679ac3"};case"evt":case"event":return{fill:(f=n.emEventFill)!=null?f:"#ffb778",stroke:(u=n.emEventStroke)!=null?u:"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(X,"calculateEntityVisualProps");function G(e,n,t){var g;const i=E(),a=P((g=V(e.entityIdentifier))!=null?g:"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"};let c=`<b>${S(a,t.textMaxWidth,d)}</b>`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" ","&nbsp;")),e.dataReference){const b=n.find(v=>{var T;return v.name===((T=e.dataReference)==null?void 0:T.$refText)});b&&(r=b.dataBlockValue,r=r.substring(r.indexOf(`{
2
+ `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" ","&nbsp;"),r+="<br/>")}const m=r!==void 0;m&&(c+=`<br/><br/><code style="text-align: left; display: block;max-width:${t.textMaxWidth}px">${r}</code>`);const f={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=ve(c,f),p=m?u.width/3:u.width,x={content:c,width:p,height:u.height};return h.debug(`[${e.name}] ${e.entityIdentifier} text`,x),x}o(G,"calculateTextProps");function j(e,n){const t=n,i=X(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:C,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(j,"decidePositionFrame");function Y(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(Y,"calculateX");function z(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(z,"calculateMaxRight");function $(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o($,"sortedSwimlanesArray");function K(e,n){const t=n,i=L(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,d=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=Y(a,d,r),m=c+l.width+s.boxPadding,f=z(Object.values(e.swimlanes),m);a.r=c+l.width,a.maxHeight=Math.max(a.maxHeight,l.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:l,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},p={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:f},x=$(p.swimlanes);x.length>0&&(x[0].y=0);for(let g=1;g<x.length;g++){const b=x[g],v=x[g-1];b.y=v.y+v.height+s.swimlaneGap}return p}o(K,"evolveFramePositioned");function Z(e,n){return e===0&&n.sourceFrames.length===0}o(Z,"isFirstFrame");function q(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}o(q,"hasSourceFrame");function B(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(B,"findBoxByFrame");function J(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(J,"findBoxByLineIndex");function Q(e,n){const t=n;if(ye(t.frame)||Z(t.index,t.frame))return[];const i=B(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=B(e.boxes,t.sourceFrame):a=J(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:O,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(Q,"decidePositionRelation");function ee(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(ee,"evolveRelationPositioned");var Ee={[N]:j,[M]:Q},Re={[C]:K,[O]:ee};function te(e,n){const t=Ee[n.$kind];if(t==null)return[];const i=t(e,n);return h.debug("decided events",i),i}o(te,"decide");function ne(e,n){const t=n.reduce((i,a)=>{const r=Re[a.$kind];return r==null?i:r(i,a)},e);return h.debug("evolve events",{state:e,newState:t,events:n}),t}o(ne,"evolve");function y(e,n){const t=te(e,n);return ne(e,t)}o(y,"dispatch");var F={getConfig:Be,setOptions:Pe,getOptions:Se,clear:ke,setAccTitle:xe,getAccTitle:ue,getAccDescription:me,setAccDescription:ce,setDiagramTitle:le,getDiagramTitle:de,setAst:H,getDiagramProps:A,getState:I},Ae={parse:o(async e=>{const n=await we("eventmodeling",e);h.debug(n),F.setAst(n),se(n,F)},"parse")},k=D(),$e=k==null?void 0:k.eventmodeling;function ie(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(ie,"renderD3Box");function ae(e,n){return e>n}o(ae,"dirUpwards");function re(e,n,t,i){return a=>{var x;const r=a.sourceBox.swimlane.y+n.swimlanePadding,d=a.targetBox.swimlane.y+n.swimlanePadding,l=ae(r,d),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let f,u;h.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(f=r,u=d+a.targetBox.dimension.height):(f=r+a.sourceBox.dimension.height,u=d);const p=(x=i.emRelationStroke)!=null?x:a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",p).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${f} L${m} ${u}`)}}o(re,"renderD3Relation");function oe(e,n,t,i){return a=>{var c,m;const r=e.append("g").attr("class","em-swimlane"),d=(c=i.emSwimlaneBackgroundOdd)!=null?c:"rgb(250,250,250)",l=(m=i.emSwimlaneBackgroundStroke)!=null?m:"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",d).attr("stroke",l),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(oe,"renderD3Swimlane");var Te=o(function(e,n,t,i){var x,g;if(h.debug("in eventmodeling renderer",e+`
3
+ `,"id:",n,t),!$e)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:d}=D(),l=fe(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),f=`em-arrowhead-${n}`,u=(x=r.emArrowhead)!=null?x:"#000000";m.sortedSwimlanesArray.forEach(oe(l,m.maxR,c,r)),m.boxes.forEach(ie(l,c)),m.relations.forEach(re(l,c,f,r)),l.append("defs").append("marker").attr("id",f).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),ge(void 0,l,(g=d==null?void 0:d.padding)!=null?g:30,d==null?void 0:d.useMaxWidth)},"draw"),De={draw:Te},Ne=o(e=>"","getStyles"),Ce=Ne,Ue={parser:Ae,db:F,renderer:De,styles:Ce};export{Ue as diagram};
@@ -0,0 +1,24 @@
1
+ import{b,s as m,b0 as B,F as C,aE as w,b2 as S,a2 as T,b4 as D,a6 as E,a1 as F,b1 as P,a3 as z,T as A,t as W}from"./mermaid.core-DuagT3S2.js";import{p as _}from"./chunk-4BX2VUAB-D0wgG8xH.js";import{p as N}from"./wardley-L42UT6IY-DsEWk1n9.js";import"./index-CbSmh0fl.js";var L=A.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=T,this.setDiagramTitle=D,this.getDiagramTitle=E,this.getAccDescription=F,this.setAccDescription=P}getConfig(){const t=m({...L,...z().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},b(u,"PacketDB"),u),M=1e4,Y=b((e,t)=>{_(e,t);let s=-1,r=[],l=1;const{bitsPerRow:c}=t.getConfig();for(let{start:a,end:o,bits:n,label:d}of e.blocks){if(a!==void 0&&o!==void 0&&o<a)throw new Error(`Packet block ${a} - ${o} is invalid. End must be greater than start.`);if(a!=null||(a=s+1),a!==s+1)throw new Error(`Packet block ${a} - ${o!=null?o:a} is not contiguous. It should start from ${s+1}.`);if(n===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(o!=null||(o=a+(n!=null?n:1)-1),n!=null||(n=o-a+1),s=o,w.debug(`Packet block ${a} - ${s} with label ${d}`);r.length<=c+1&&t.getPacket().length<M;){const[p,i]=I({start:a,end:o,bits:n,label:d},l,c);if(r.push(p),p.end+1===l*c&&(t.pushWord(r),r=[],l++),!i)break;({start:a,end:o,bits:n,label:d}=i)}}t.pushWord(r)},"populate"),I=b((e,t,s)=>{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*s)return[e,void 0];const r=t*s-1,l=t*s;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:l,end:e.end,label:e.label,bits:e.end-l}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),s=(r=x.parser)==null?void 0:r.yy;if(!(s instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,s)},"parse")},O=b((e,t,s,r)=>{const l=r.db,c=l.getConfig(),{rowHeight:a,paddingY:o,bitWidth:n,bitsPerRow:d}=c,p=l.getPacket(),i=l.getDiagramTitle(),h=a+o,g=h*(p.length+1)-(i?0:a),k=n*d+2,f=B(t);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,c.useMaxWidth);for(const[y,$]of p.entries())j(f,$,y,c);f.append("text").text(i).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,s,{rowHeight:r,paddingX:l,paddingY:c,bitWidth:a,bitsPerRow:o,showBits:n})=>{const d=e.append("g"),p=s*(r+c)+c;for(const i of t){const h=i.start%o*a+1,g=(i.end-i.start+1)*a-l;if(d.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),d.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(i.label),!n)continue;const k=i.end===i.start,f=p-2;d.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(i.start),k||d.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(i.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=m(H,e);return`
2
+ .packetByte {
3
+ font-size: ${t.byteFontSize};
4
+ }
5
+ .packetByte.start {
6
+ fill: ${t.startByteColor};
7
+ }
8
+ .packetByte.end {
9
+ fill: ${t.endByteColor};
10
+ }
11
+ .packetLabel {
12
+ fill: ${t.labelColor};
13
+ font-size: ${t.labelFontSize};
14
+ }
15
+ .packetTitle {
16
+ fill: ${t.titleColor};
17
+ font-size: ${t.titleFontSize};
18
+ }
19
+ .packetBlock {
20
+ stroke: ${t.blockStrokeColor};
21
+ stroke-width: ${t.blockStrokeWidth};
22
+ fill: ${t.blockFillColor};
23
+ }
24
+ `},"styles"),J={parser:x,get db(){return new v},renderer:G,styles:K};export{J as diagram};
@@ -0,0 +1,24 @@
1
+ import{b as C,af as pe,a3 as ee,s as K,b0 as fe,F as ge,aE as Q,bc as P,a$ as j,b2 as me,a2 as ye,b4 as Se,a6 as ve,a1 as xe,b1 as be,T as we,aw as Ce,t as Te}from"./mermaid.core-DuagT3S2.js";import{s as Le}from"./chunk-2J33WTMH-CrTr9xzl.js";import{p as $e}from"./chunk-4BX2VUAB-D0wgG8xH.js";import{p as Ae}from"./wardley-L42UT6IY-DsEWk1n9.js";import{f as O}from"./defaultLocale-CrowFXzY.js";import{o as J}from"./ordinal-Cboi1Yqb.js";import"./index-CbSmh0fl.js";import"./init-Gi6I4Gst.js";function Fe(t){var n=0,l=t.children,a=l&&l.length;if(!a)n=1;else for(;--a>=0;)n+=l[a].value;t.value=n}function Ne(){return this.eachAfter(Fe)}function Me(t,n){let l=-1;for(const a of this)t.call(n,a,++l,this);return this}function Ve(t,n){for(var l=this,a=[l],r,c,d=-1;l=a.pop();)if(t.call(n,l,++d,this),r=l.children)for(c=r.length-1;c>=0;--c)a.push(r[c]);return this}function ke(t,n){for(var l=this,a=[l],r=[],c,d,u,g=-1;l=a.pop();)if(r.push(l),c=l.children)for(d=0,u=c.length;d<u;++d)a.push(c[d]);for(;l=r.pop();)t.call(n,l,++g,this);return this}function _e(t,n){let l=-1;for(const a of this)if(t.call(n,a,++l,this))return a}function ze(t){return this.eachAfter(function(n){for(var l=+t(n.data)||0,a=n.children,r=a&&a.length;--r>=0;)l+=a[r].value;n.value=l})}function De(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})}function Pe(t){for(var n=this,l=Be(n,t),a=[n];n!==l;)n=n.parent,a.push(n);for(var r=a.length;t!==l;)a.splice(r,0,t),t=t.parent;return a}function Be(t,n){if(t===n)return t;var l=t.ancestors(),a=n.ancestors(),r=null;for(t=l.pop(),n=a.pop();t===n;)r=t,t=l.pop(),n=a.pop();return r}function Ee(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n}function Re(){return Array.from(this)}function We(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t}function He(){var t=this,n=[];return t.each(function(l){l!==t&&n.push({source:l.parent,target:l})}),n}function*Ie(){var t=this,n,l=[t],a,r,c;do for(n=l.reverse(),l=[];t=n.pop();)if(yield t,a=t.children)for(r=0,c=a.length;r<c;++r)l.push(a[r]);while(l.length)}function te(t,n){t instanceof Map?(t=[void 0,t],n===void 0&&(n=qe)):n===void 0&&(n=Ge);for(var l=new U(t),a,r=[l],c,d,u,g;a=r.pop();)if((d=n(a.data))&&(g=(d=Array.from(d)).length))for(a.children=d,u=g-1;u>=0;--u)r.push(c=d[u]=new U(d[u])),c.parent=a,c.depth=a.depth+1;return l.eachBefore(Ye)}function Oe(){return te(this).eachBefore(Xe)}function Ge(t){return t.children}function qe(t){return Array.isArray(t)?t[1]:null}function Xe(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ye(t){var n=0;do t.height=n;while((t=t.parent)&&t.height<++n)}function U(t){this.data=t,this.depth=this.height=0,this.parent=null}U.prototype=te.prototype={constructor:U,count:Ne,each:Me,eachAfter:ke,eachBefore:Ve,find:_e,sum:ze,sort:De,path:Pe,ancestors:Ee,descendants:Re,leaves:We,links:He,copy:Oe,[Symbol.iterator]:Ie};function je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ue(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Ze(t,n,l,a,r){for(var c=t.children,d,u=-1,g=c.length,o=t.value&&(a-n)/t.value;++u<g;)d=c[u],d.y0=l,d.y1=r,d.x0=n,d.x1=n+=d.value*o}function Je(t,n,l,a,r){for(var c=t.children,d,u=-1,g=c.length,o=t.value&&(r-l)/t.value;++u<g;)d=c[u],d.x0=n,d.x1=a,d.y0=l,d.y1=l+=d.value*o}var Ke=(1+Math.sqrt(5))/2;function Qe(t,n,l,a,r,c){for(var d=[],u=n.children,g,o,h=0,m=0,s=u.length,y,S,v=n.value,p,x,M,N,z,R,V;h<s;){y=r-l,S=c-a;do p=u[m++].value;while(!p&&m<s);for(x=M=p,R=Math.max(S/y,y/S)/(v*t),V=p*p*R,z=Math.max(M/V,V/x);m<s;++m){if(p+=o=u[m].value,o<x&&(x=o),o>M&&(M=o),V=p*p*R,N=Math.max(M/V,V/x),N>z){p-=o;break}z=N}d.push(g={value:p,dice:y<S,children:u.slice(h,m)}),g.dice?Ze(g,l,a,r,v?a+=S*p/v:c):Je(g,l,a,v?l+=y*p/v:r,c),v-=p,h=m}return d}const et=function t(n){function l(a,r,c,d,u){Qe(n,a,r,c,d,u)}return l.ratio=function(a){return t((a=+a)>1?a:1)},l}(Ke);function tt(){var t=et,n=!1,l=1,a=1,r=[0],c=G,d=G,u=G,g=G,o=G;function h(s){return s.x0=s.y0=0,s.x1=l,s.y1=a,s.eachBefore(m),r=[0],n&&s.eachBefore(Ue),s}function m(s){var y=r[s.depth],S=s.x0+y,v=s.y0+y,p=s.x1-y,x=s.y1-y;p<S&&(S=p=(S+p)/2),x<v&&(v=x=(v+x)/2),s.x0=S,s.y0=v,s.x1=p,s.y1=x,s.children&&(y=r[s.depth+1]=c(s)/2,S+=o(s)-y,v+=d(s)-y,p-=u(s)-y,x-=g(s)-y,p<S&&(S=p=(S+p)/2),x<v&&(v=x=(v+x)/2),t(s,S,v,p,x))}return h.round=function(s){return arguments.length?(n=!!s,h):n},h.size=function(s){return arguments.length?(l=+s[0],a=+s[1],h):[l,a]},h.tile=function(s){return arguments.length?(t=je(s),h):t},h.padding=function(s){return arguments.length?h.paddingInner(s).paddingOuter(s):h.paddingInner()},h.paddingInner=function(s){return arguments.length?(c=typeof s=="function"?s:q(+s),h):c},h.paddingOuter=function(s){return arguments.length?h.paddingTop(s).paddingRight(s).paddingBottom(s).paddingLeft(s):h.paddingTop()},h.paddingTop=function(s){return arguments.length?(d=typeof s=="function"?s:q(+s),h):d},h.paddingRight=function(s){return arguments.length?(u=typeof s=="function"?s:q(+s),h):u},h.paddingBottom=function(s){return arguments.length?(g=typeof s=="function"?s:q(+s),h):g},h.paddingLeft=function(s){return arguments.length?(o=typeof s=="function"?s:q(+s),h):o},h}var E,re=(E=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=me,this.getAccTitle=ye,this.setDiagramTitle=Se,this.getDiagramTitle=ve,this.getAccDescription=xe,this.setAccDescription=be}getNodes(){return this.nodes}getConfig(){var a;const n=we,l=ee();return K({...n.treemap,...(a=l.treemap)!=null?a:{}})}addNode(n,l){var a;this.nodes.push(n),this.levels.set(n,l),l===0&&(this.outerNodes.push(n),(a=this.root)!=null||(this.root=n))}getRoot(){return{name:"",children:this.outerNodes}}addClass(n,l){var c;const a=(c=this.classes.get(n))!=null?c:{id:n,styles:[],textStyles:[]},r=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");r&&r.forEach(d=>{Ce(d)&&(a!=null&&a.textStyles?a.textStyles.push(d):a.textStyles=[d]),a!=null&&a.styles?a.styles.push(d):a.styles=[d]}),this.classes.set(n,a)}getClasses(){return this.classes}getStylesForClass(n){var l,a;return(a=(l=this.classes.get(n))==null?void 0:l.styles)!=null?a:[]}clear(){Te(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},C(E,"TreeMapDB"),E);function se(t){if(!t.length)return[];const n=[],l=[];return t.forEach(a=>{const r={name:a.name,children:a.type==="Leaf"?void 0:[]};for(r.classSelector=a==null?void 0:a.classSelector,a!=null&&a.cssCompiledStyles&&(r.cssCompiledStyles=a.cssCompiledStyles),a.type==="Leaf"&&a.value!==void 0&&(r.value=a.value);l.length>0&&l[l.length-1].level>=a.level;)l.pop();if(l.length===0)n.push(r);else{const c=l[l.length-1].node;c.children?c.children.push(r):c.children=[r]}a.type!=="Leaf"&&l.push({node:r,level:a.level})}),n}C(se,"buildHierarchy");var at=C((t,n)=>{var c,d,u,g;$e(t,n);const l=[];for(const o of(c=t.TreemapRows)!=null?c:[])o.$type==="ClassDefStatement"&&n.addClass((d=o.className)!=null?d:"",(u=o.styleText)!=null?u:"");for(const o of(g=t.TreemapRows)!=null?g:[]){const h=o.item;if(!h)continue;const m=o.indent?parseInt(o.indent):0,s=nt(h),y=h.classSelector?n.getStylesForClass(h.classSelector):[],S=y.length>0?y:void 0,v={level:m,name:s,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:S};l.push(v)}const a=se(l),r=C((o,h)=>{for(const m of o)n.addNode(m,h),m.children&&m.children.length>0&&r(m.children,h+1)},"addNodesRecursively");r(a,0)},"populate"),nt=C(t=>t.name?String(t.name):"","getItemName"),ie={parser:{yy:void 0},parse:C(async t=>{var n;try{const a=await Ae("treemap",t);Q.debug("Treemap AST:",a);const r=(n=ie.parser)==null?void 0:n.yy;if(!(r instanceof re))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");at(a,r)}catch(l){throw Q.error("Error parsing treemap:",l),l}},"parse")},lt=10,B=10,X=25,rt=C((t,n,l,a)=>{var ne,le;const r=a.db,c=r.getConfig(),d=(ne=c.padding)!=null?ne:lt,u=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:o}=ee();if(!g)return;const h=u?30:0,m=fe(n),s=c.nodeWidth?c.nodeWidth*B:960,y=c.nodeHeight?c.nodeHeight*B:500,S=s,v=y+h;m.attr("viewBox",`0 0 ${S} ${v}`),ge(m,v,S,c.useMaxWidth);let p;try{const e=c.valueFormat||",";if(e==="$0,0")p=C(i=>"$"+O(",")(i),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const i=/\.\d+/.exec(e),f=i?i[0]:"";p=C(w=>"$"+O(","+f)(w),"valueFormat")}else if(e.startsWith("$")){const i=e.substring(1);p=C(f=>"$"+O(i||"")(f),"valueFormat")}else p=O(e)}catch(e){Q.error("Error creating format function:",e),p=O(",")}const x=J().range(["transparent",o.cScale0,o.cScale1,o.cScale2,o.cScale3,o.cScale4,o.cScale5,o.cScale6,o.cScale7,o.cScale8,o.cScale9,o.cScale10,o.cScale11]),M=J().range(["transparent",o.cScalePeer0,o.cScalePeer1,o.cScalePeer2,o.cScalePeer3,o.cScalePeer4,o.cScalePeer5,o.cScalePeer6,o.cScalePeer7,o.cScalePeer8,o.cScalePeer9,o.cScalePeer10,o.cScalePeer11]),N=J().range([o.cScaleLabel0,o.cScaleLabel1,o.cScaleLabel2,o.cScaleLabel3,o.cScaleLabel4,o.cScaleLabel5,o.cScaleLabel6,o.cScaleLabel7,o.cScaleLabel8,o.cScaleLabel9,o.cScaleLabel10,o.cScaleLabel11]);u&&m.append("text").attr("x",S/2).attr("y",h/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(u);const z=m.append("g").attr("transform",`translate(0, ${h})`).attr("class","treemapContainer"),R=te(g).sum(e=>{var i;return(i=e.value)!=null?i:0}).sort((e,i)=>{var f,w;return((f=i.value)!=null?f:0)-((w=e.value)!=null?w:0)}),ae=tt().size([s,y]).paddingTop(e=>e.children&&e.children.length>0?X+B:0).paddingInner(d).paddingLeft(e=>e.children&&e.children.length>0?B:0).paddingRight(e=>e.children&&e.children.length>0?B:0).paddingBottom(e=>e.children&&e.children.length>0?B:0).round(!0)(R),oe=ae.descendants().filter(e=>e.children&&e.children.length>0),W=z.selectAll(".treemapSection").data(oe).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);W.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),W.append("clipPath").attr("id",(e,i)=>`clip-section-${n}-${i}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),W.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,i)=>`treemapSection section${i}`).attr("fill",e=>x(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>M(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const i=P({cssCompiledStyles:e.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),W.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("style",e=>{if(e.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+N(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=P({cssCompiledStyles:e.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const i=j(this),f=e.data.name;i.text(f);const w=e.x1-e.x0,$=6;let A;c.showValues!==!1&&e.value?A=w-10-30-10-$:A=w-$-6;const F=Math.max(15,A),b=i.node();if(b.getComputedTextLength()>F){const T="...";let L=f;for(;L.length>0;){if(L=f.substring(0,L.length-1),L.length===0){i.text(T),b.getComputedTextLength()>F&&i.text("");break}if(i.text(L+T),b.getComputedTextLength()<=F)break}}}),c.showValues!==!1&&W.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+N(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=P({cssCompiledStyles:e.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")});const ce=ae.leaves(),Y=z.selectAll(".treemapLeafGroup").data(ce).enter().append("g").attr("class",(e,i)=>`treemapNode treemapLeafGroup leaf${i}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);Y.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?x(e.parent.data.name):x(e.data.name)).attr("style",e=>P({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?x(e.parent.data.name):x(e.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(e,i)=>`clip-${n}-${i}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const i="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+N(e.data.name)+";",f=P({cssCompiledStyles:e.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,i)=>`url(#clip-${n}-${i})`).text(e=>e.data.name).each(function(e){const i=j(this),f=e.x1-e.x0,w=e.y1-e.y0,$=i.node(),A=4,D=f-2*A,F=w-2*A;if(D<10||F<10){i.style("display","none");return}let b=parseInt(i.style("font-size"),10);const k=8,T=28,L=.6,_=6,H=2;for(;$.getComputedTextLength()>D&&b>k;)b--,i.style("font-size",`${b}px`);let I=Math.max(_,Math.min(T,Math.round(b*L))),Z=b+H+I;for(;Z>F&&b>k&&(b--,I=Math.max(_,Math.min(T,Math.round(b*L))),!(I<_&&b===k));)i.style("font-size",`${b}px`),Z=b+H+I;i.style("font-size",`${b}px`),($.getComputedTextLength()>D||b<k||F<b)&&i.style("display","none")}),c.showValues!==!1&&Y.append("text").attr("class","treemapValue").attr("x",i=>(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const f="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+N(i.data.name)+";",w=P({cssCompiledStyles:i.data.cssCompiledStyles});return f+w.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,f)=>`url(#clip-${n}-${f})`).text(i=>i.value?p(i.value):"").each(function(i){const f=j(this),w=this.parentNode;if(!w){f.style("display","none");return}const $=j(w).select(".treemapLabel");if($.empty()||$.style("display")==="none"){f.style("display","none");return}const A=parseFloat($.style("font-size")),D=28,F=.6,b=6,k=2,T=Math.max(b,Math.min(D,Math.round(A*F)));f.style("font-size",`${T}px`);const _=(i.y1-i.y0)/2+A/2+k;f.attr("y",_);const H=i.x1-i.x0,he=i.y1-i.y0-4,ue=H-2*4;f.node().getComputedTextLength()>ue||_+T>he||T<b?f.style("display","none"):f.style("display",null)});const de=(le=c.diagramPadding)!=null?le:8;Le(m,de,"flowchart",(c==null?void 0:c.useMaxWidth)||!1)},"draw"),st=C(function(t,n){return n.db.getClasses()},"getClasses"),it={draw:rt,getClasses:st},ot={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},ct=C(({treemap:t}={})=>{var g,o,h;const n=pe(),l=ee(),a=K(n,l.themeVariables),r=K(ot,t),c=(g=r.titleColor)!=null?g:a.titleColor,d=(o=r.labelColor)!=null?o:a.textColor,u=(h=r.valueColor)!=null?h:a.textColor;return`
2
+ .treemapNode.section {
3
+ stroke: ${r.sectionStrokeColor};
4
+ stroke-width: ${r.sectionStrokeWidth};
5
+ fill: ${r.sectionFillColor};
6
+ }
7
+ .treemapNode.leaf {
8
+ stroke: ${r.leafStrokeColor};
9
+ stroke-width: ${r.leafStrokeWidth};
10
+ fill: ${r.leafFillColor};
11
+ }
12
+ .treemapLabel {
13
+ fill: ${d};
14
+ font-size: ${r.labelFontSize};
15
+ }
16
+ .treemapValue {
17
+ fill: ${u};
18
+ font-size: ${r.valueFontSize};
19
+ }
20
+ .treemapTitle {
21
+ fill: ${c};
22
+ font-size: ${r.titleFontSize};
23
+ }
24
+ `},"getStyles"),dt=ct,xt={parser:ie,get db(){return new re},renderer:it,styles:dt};export{xt as diagram};
@@ -0,0 +1,85 @@
1
+ import{g as Bt}from"./chunk-55IACEB6-Duov_Htw.js";import{s as Ft}from"./chunk-2J33WTMH-CrTr9xzl.js";import{b as p,b2 as Yt,a2 as Pt,b1 as zt,a1 as Gt,b4 as Kt,a6 as Ut,a4 as at,aE as M,t as Zt,a7 as jt,aY as Wt,_ as Qt,ab as Xt,aV as Ht,a$ as qt,bl as Jt}from"./mermaid.core-DuagT3S2.js";import{c as $t}from"./channel-DiZdOJ9B.js";import"./index-CbSmh0fl.js";var gt=function(){var s=p(function(R,n,a,l){for(a=a||{},l=R.length;l--;a[R[l]]=n);return a},"o"),i=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],c=[1,10],h=[1,11],o=[1,12],d=[1,13],y=[1,23],u=[1,24],k=[1,25],X=[1,26],H=[1,27],T=[1,19],q=[1,28],F=[1,29],S=[1,20],O=[1,18],D=[1,21],x=[1,22],L=[1,36],Y=[1,37],ot=[1,38],lt=[1,39],ht=[1,40],P=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,65,66,67,68,69],N=[1,45],A=[1,46],z=[1,55],G=[40,48,50,51,52,70,71],K=[1,66],U=[1,64],I=[1,61],Z=[1,65],j=[1,67],J=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,65,66,67,68,69],bt=[65,66,67,68,69],mt=[1,84],kt=[1,83],Et=[1,81],Tt=[1,82],St=[6,10,42,47],w=[6,10,13,41,42,47,48,49],$=[1,92],tt=[1,91],et=[1,90],W=[19,58],Ot=[1,101],Nt=[1,100],ut=[19,58,60,62],dt={trace:p(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,attributeKeyType:59,",":60,ATTRIBUTE_KEY:61,COMMENT:62,cardinality:63,relType:64,ZERO_OR_ONE:65,ZERO_OR_MORE:66,ONE_OR_MORE:67,ONLY_ONE:68,MD_PARENT:69,NON_IDENTIFYING:70,IDENTIFYING:71,WORD:72,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",60:",",61:"ATTRIBUTE_KEY",62:"COMMENT",65:"ZERO_OR_ONE",66:"ZERO_OR_MORE",67:"ONE_OR_MORE",68:"ONLY_ONE",69:"MD_PARENT",70:"NON_IDENTIFYING",71:"IDENTIFYING",72:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[55,1],[56,1],[56,3],[59,1],[57,1],[12,3],[63,1],[63,1],[63,1],[63,1],[63,1],[64,1],[64,1],[14,1],[14,1],[14,1]],performAction:p(function(n,a,l,r,f,t,Q){var e=t.length-1;switch(f){case 1:break;case 2:this.$=[];break;case 3:t[e-1].push(t[e]),this.$=t[e-1];break;case 4:case 5:this.$=t[e];break;case 6:case 7:this.$=[];break;case 8:r.addEntity(t[e-4]),r.addEntity(t[e-2]),r.addRelationship(t[e-4],t[e],t[e-2],t[e-3]);break;case 9:r.addEntity(t[e-8]),r.addEntity(t[e-4]),r.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),r.setClass([t[e-8]],t[e-6]),r.setClass([t[e-4]],t[e-2]);break;case 10:r.addEntity(t[e-6]),r.addEntity(t[e-2]),r.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),r.setClass([t[e-6]],t[e-4]);break;case 11:r.addEntity(t[e-6]),r.addEntity(t[e-4]),r.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),r.setClass([t[e-4]],t[e-2]);break;case 12:r.addEntity(t[e-3]),r.addAttributes(t[e-3],t[e-1]);break;case 13:r.addEntity(t[e-5]),r.addAttributes(t[e-5],t[e-1]),r.setClass([t[e-5]],t[e-3]);break;case 14:r.addEntity(t[e-2]);break;case 15:r.addEntity(t[e-4]),r.setClass([t[e-4]],t[e-2]);break;case 16:r.addEntity(t[e]);break;case 17:r.addEntity(t[e-2]),r.setClass([t[e-2]],t[e]);break;case 18:r.addEntity(t[e-6],t[e-4]),r.addAttributes(t[e-6],t[e-1]);break;case 19:r.addEntity(t[e-8],t[e-6]),r.addAttributes(t[e-8],t[e-1]),r.setClass([t[e-8]],t[e-3]);break;case 20:r.addEntity(t[e-5],t[e-3]);break;case 21:r.addEntity(t[e-7],t[e-5]),r.setClass([t[e-7]],t[e-2]);break;case 22:r.addEntity(t[e-3],t[e-1]);break;case 23:r.addEntity(t[e-5],t[e-3]),r.setClass([t[e-5]],t[e]);break;case 24:case 25:this.$=t[e].trim(),r.setAccTitle(this.$);break;case 26:case 27:this.$=t[e].trim(),r.setAccDescription(this.$);break;case 32:r.setDirection("TB");break;case 33:r.setDirection("BT");break;case 34:r.setDirection("RL");break;case 35:r.setDirection("LR");break;case 36:this.$=t[e-3],r.addClass(t[e-2],t[e-1]);break;case 37:case 38:case 59:case 67:this.$=[t[e]];break;case 39:case 40:this.$=t[e-2].concat([t[e]]);break;case 41:this.$=t[e-2],r.setClass(t[e-1],t[e]);break;case 42:this.$=t[e-3],r.addCssStyles(t[e-2],t[e-1]);break;case 43:this.$=[t[e]];break;case 44:t[e-2].push(t[e]),this.$=t[e-2];break;case 46:this.$=t[e-1]+t[e];break;case 54:case 79:case 80:this.$=t[e].replace(/"/g,"");break;case 55:case 56:case 57:case 58:case 81:this.$=t[e];break;case 60:t[e].push(t[e-1]),this.$=t[e];break;case 61:this.$={type:t[e-1],name:t[e]};break;case 62:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 63:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 64:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 65:case 66:case 69:this.$=t[e];break;case 68:t[e-2].push(t[e]),this.$=t[e-2];break;case 70:this.$=t[e].replace(/"/g,"");break;case 71:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 72:this.$=r.Cardinality.ZERO_OR_ONE;break;case 73:this.$=r.Cardinality.ZERO_OR_MORE;break;case 74:this.$=r.Cardinality.ONE_OR_MORE;break;case 75:this.$=r.Cardinality.ONLY_ONE;break;case 76:this.$=r.Cardinality.MD_PARENT;break;case 77:this.$=r.Identification.NON_IDENTIFYING;break;case 78:this.$=r.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(i,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:c,24:h,26:o,28:d,29:14,30:15,31:16,32:17,33:y,34:u,35:k,36:X,37:H,40:T,43:q,44:F,48:S,50:O,51:D,52:x},s(i,[2,7],{1:[2,1]}),s(i,[2,3]),{9:30,11:9,22:c,24:h,26:o,28:d,29:14,30:15,31:16,32:17,33:y,34:u,35:k,36:X,37:H,40:T,43:q,44:F,48:S,50:O,51:D,52:x},s(i,[2,5]),s(i,[2,6]),s(i,[2,16],{12:31,63:35,15:[1,32],17:[1,33],20:[1,34],65:L,66:Y,67:ot,68:lt,69:ht}),{23:[1,41]},{25:[1,42]},{27:[1,43]},s(i,[2,27]),s(i,[2,28]),s(i,[2,29]),s(i,[2,30]),s(i,[2,31]),s(P,[2,54]),s(P,[2,55]),s(P,[2,56]),s(P,[2,57]),s(P,[2,58]),s(i,[2,32]),s(i,[2,33]),s(i,[2,34]),s(i,[2,35]),{16:44,40:N,41:A},{16:47,40:N,41:A},{16:48,40:N,41:A},s(i,[2,4]),{11:49,40:T,48:S,50:O,51:D,52:x},{16:50,40:N,41:A},{18:51,19:[1,52],53:53,54:54,58:z},{11:56,40:T,48:S,50:O,51:D,52:x},{64:57,70:[1,58],71:[1,59]},s(G,[2,72]),s(G,[2,73]),s(G,[2,74]),s(G,[2,75]),s(G,[2,76]),s(i,[2,24]),s(i,[2,25]),s(i,[2,26]),{13:K,38:60,41:U,42:I,45:62,46:63,48:Z,49:j},s(J,[2,37]),s(J,[2,38]),{16:68,40:N,41:A,42:I},{13:K,38:69,41:U,42:I,45:62,46:63,48:Z,49:j},{13:[1,70],15:[1,71]},s(i,[2,17],{63:35,12:72,17:[1,73],42:I,65:L,66:Y,67:ot,68:lt,69:ht}),{19:[1,74]},s(i,[2,14]),{18:75,19:[2,59],53:53,54:54,58:z},{55:76,58:[1,77]},{58:[2,65]},{21:[1,78]},{63:79,65:L,66:Y,67:ot,68:lt,69:ht},s(bt,[2,77]),s(bt,[2,78]),{6:mt,10:kt,39:80,42:Et,47:Tt},{40:[1,85],41:[1,86]},s(St,[2,43],{46:87,13:K,41:U,48:Z,49:j}),s(w,[2,45]),s(w,[2,50]),s(w,[2,51]),s(w,[2,52]),s(w,[2,53]),s(i,[2,41],{42:I}),{6:mt,10:kt,39:88,42:Et,47:Tt},{14:89,40:$,50:tt,72:et},{16:93,40:N,41:A},{11:94,40:T,48:S,50:O,51:D,52:x},{18:95,19:[1,96],53:53,54:54,58:z},s(i,[2,12]),{19:[2,60]},s(W,[2,61],{56:97,57:98,59:99,61:Ot,62:Nt}),s([19,58,61,62],[2,66]),s(i,[2,22],{15:[1,103],17:[1,102]}),s([40,48,50,51,52],[2,71]),s(i,[2,36]),{13:K,41:U,45:104,46:63,48:Z,49:j},s(i,[2,47]),s(i,[2,48]),s(i,[2,49]),s(J,[2,39]),s(J,[2,40]),s(w,[2,46]),s(i,[2,42]),s(i,[2,8]),s(i,[2,79]),s(i,[2,80]),s(i,[2,81]),{13:[1,105],42:I},{13:[1,107],15:[1,106]},{19:[1,108]},s(i,[2,15]),s(W,[2,62],{57:109,60:[1,110],62:Nt}),s(W,[2,63]),s(ut,[2,67]),s(W,[2,70]),s(ut,[2,69]),{18:111,19:[1,112],53:53,54:54,58:z},{16:113,40:N,41:A},s(St,[2,44],{46:87,13:K,41:U,48:Z,49:j}),{14:114,40:$,50:tt,72:et},{16:115,40:N,41:A},{14:116,40:$,50:tt,72:et},s(i,[2,13]),s(W,[2,64]),{59:117,61:Ot},{19:[1,118]},s(i,[2,20]),s(i,[2,23],{17:[1,119],42:I}),s(i,[2,11]),{13:[1,120],42:I},s(i,[2,10]),s(ut,[2,68]),s(i,[2,18]),{18:121,19:[1,122],53:53,54:54,58:z},{14:123,40:$,50:tt,72:et},{19:[1,124]},s(i,[2,21]),s(i,[2,9]),s(i,[2,19])],defaultActions:{55:[2,65],75:[2,60]},parseError:p(function(n,a){if(a.recoverable)this.trace(n);else{var l=new Error(n);throw l.hash=a,l}},"parseError"),parse:p(function(n){var a=this,l=[0],r=[],f=[null],t=[],Q=this.table,e="",it=0,At=0,Lt=2,It=1,wt=t.slice.call(arguments,1),_=Object.create(this.lexer),C={yy:{}};for(var pt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,pt)&&(C.yy[pt]=this.yy[pt]);_.setInput(n,C.yy),C.yy.lexer=_,C.yy.parser=this,typeof _.yylloc=="undefined"&&(_.yylloc={});var yt=_.yylloc;t.push(yt);var Vt=_.options&&_.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Mt(b){l.length=l.length-2*b,f.length=f.length-b,t.length=t.length-b}p(Mt,"popStack");function Rt(){var b;return b=r.pop()||_.lex()||It,typeof b!="number"&&(b instanceof Array&&(r=b,b=r.pop()),b=a.symbols_[b]||b),b}p(Rt,"lex");for(var g,v,m,ft,V={},rt,E,xt,nt;;){if(v=l[l.length-1],this.defaultActions[v]?m=this.defaultActions[v]:((g===null||typeof g=="undefined")&&(g=Rt()),m=Q[v]&&Q[v][g]),typeof m=="undefined"||!m.length||!m[0]){var _t="";nt=[];for(rt in Q[v])this.terminals_[rt]&&rt>Lt&&nt.push("'"+this.terminals_[rt]+"'");_.showPosition?_t="Parse error on line "+(it+1)+`:
2
+ `+_.showPosition()+`
3
+ Expecting `+nt.join(", ")+", got '"+(this.terminals_[g]||g)+"'":_t="Parse error on line "+(it+1)+": Unexpected "+(g==It?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(_t,{text:_.match,token:this.terminals_[g]||g,line:_.yylineno,loc:yt,expected:nt})}if(m[0]instanceof Array&&m.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+g);switch(m[0]){case 1:l.push(g),f.push(_.yytext),t.push(_.yylloc),l.push(m[1]),g=null,At=_.yyleng,e=_.yytext,it=_.yylineno,yt=_.yylloc;break;case 2:if(E=this.productions_[m[1]][1],V.$=f[f.length-E],V._$={first_line:t[t.length-(E||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(E||1)].first_column,last_column:t[t.length-1].last_column},Vt&&(V._$.range=[t[t.length-(E||1)].range[0],t[t.length-1].range[1]]),ft=this.performAction.apply(V,[e,At,it,C.yy,m[1],f,t].concat(wt)),typeof ft!="undefined")return ft;E&&(l=l.slice(0,-1*E*2),f=f.slice(0,-1*E),t=t.slice(0,-1*E)),l.push(this.productions_[m[1]][0]),f.push(V.$),t.push(V._$),xt=Q[l[l.length-2]][l[l.length-1]],l.push(xt);break;case 3:return!0}}return!0},"parse")},Dt=function(){var R={EOF:1,parseError:p(function(a,l){if(this.yy.parser)this.yy.parser.parseError(a,l);else throw new Error(a)},"parseError"),setInput:p(function(n,a){return this.yy=a||this.yy||{},this._input=n,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:p(function(){var n=this._input[0];this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n;var a=n.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),n},"input"),unput:p(function(n){var a=n.length,l=n.split(/(?:\r\n?|\n)/g);this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var f=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===r.length?this.yylloc.first_column:0)+r[r.length-l.length].length-l[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[f[0],f[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:p(function(){return this._more=!0,this},"more"),reject:p(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:p(function(n){this.unput(this.match.slice(n))},"less"),pastInput:p(function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:p(function(){var n=this.match;return n.length<20&&(n+=this._input.substr(0,20-n.length)),(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:p(function(){var n=this.pastInput(),a=new Array(n.length+1).join("-");return n+this.upcomingInput()+`
5
+ `+a+"^"},"showPosition"),test_match:p(function(n,a){var l,r,f;if(this.options.backtrack_lexer&&(f={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(f.yylloc.range=this.yylloc.range.slice(0))),r=n[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+n[0].length},this.yytext+=n[0],this.match+=n[0],this.matches=n,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(n[0].length),this.matched+=n[0],l=this.performAction.call(this,this.yy,this,a,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),l)return l;if(this._backtrack){for(var t in f)this[t]=f[t];return!1}return!1},"test_match"),next:p(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var n,a,l,r;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),t=0;t<f.length;t++)if(l=this._input.match(this.rules[f[t]]),l&&(!a||l[0].length>a[0].length)){if(a=l,r=t,this.options.backtrack_lexer){if(n=this.test_match(l,f[t]),n!==!1)return n;if(this._backtrack){a=!1;continue}else return!1}else if(!this.options.flex)break}return a?(n=this.test_match(a,f[r]),n!==!1?n:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:p(function(){var a=this.next();return a||this.lex()},"lex"),begin:p(function(a){this.conditionStack.push(a)},"begin"),popState:p(function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:p(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:p(function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:p(function(a){this.begin(a)},"pushState"),stateStackSize:p(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:p(function(a,l,r,f){switch(r){case 0:return this.begin("acc_title"),24;case 1:return this.popState(),"acc_title_value";case 2:return this.begin("acc_descr"),26;case 3:return this.popState(),"acc_descr_value";case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return 33;case 8:return 34;case 9:return 35;case 10:return 36;case 11:return 10;case 12:break;case 13:return 8;case 14:return 50;case 15:return 72;case 16:return 4;case 17:return this.begin("block"),17;case 18:return 49;case 19:return 49;case 20:return 42;case 21:return 15;case 22:return 13;case 23:break;case 24:return 61;case 25:return 58;case 26:return 58;case 27:return 62;case 28:break;case 29:return this.popState(),19;case 30:return l.yytext[0];case 31:return 20;case 32:return 21;case 33:return this.begin("style"),44;case 34:return this.popState(),10;case 35:break;case 36:return 13;case 37:return 42;case 38:return 49;case 39:return this.begin("style"),37;case 40:return 43;case 41:return 65;case 42:return 67;case 43:return 67;case 44:return 67;case 45:return 65;case 46:return 65;case 47:return 66;case 48:return 66;case 49:return 66;case 50:return 66;case 51:return 66;case 52:return 67;case 53:return 66;case 54:return 67;case 55:return 68;case 56:return 68;case 57:return 51;case 58:return 68;case 59:return 68;case 60:return 68;case 61:return 52;case 62:return 48;case 63:return 68;case 64:return 65;case 65:return 66;case 66:return 67;case 67:return 69;case 68:return 70;case 69:return 71;case 70:return 71;case 71:return 70;case 72:return 70;case 73:return 70;case 74:return 41;case 75:return 47;case 76:return 40;case 77:return l.yytext[0];case 78:return 6}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:[0-9]+\.[0-9]+)/i,/^(?:1(?=\s+[A-Za-z_"']))/i,/^(?:1(?=\s+[0-9]))/i,/^(?:1(?=(--|\.\.|\.-|-\.)))/i,/^(?:1\b)/i,/^(?:[0-9]+)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:u(?=[\.\-\|]))/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i,/^(?:.)/i,/^(?:$)/i],conditions:{style:{rules:[34,35,36,37,38,74,75],inclusive:!1},acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block:{rules:[23,24,25,26,27,28,29,30],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,31,32,33,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,76,77,78],inclusive:!0}}};return R}();dt.lexer=Dt;function st(){this.yy={}}return p(st,"Parser"),st.prototype=dt,dt.Parser=st,new st}();gt.parser=gt;var te=gt,B,ee=(B=class{constructor(){this.entities=new Map,this.relationships=[],this.classes=new Map,this.direction="TB",this.Cardinality={ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE",MD_PARENT:"MD_PARENT"},this.Identification={NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},this.setAccTitle=Yt,this.getAccTitle=Pt,this.setAccDescription=zt,this.getAccDescription=Gt,this.setDiagramTitle=Kt,this.getDiagramTitle=Ut,this.getConfig=p(()=>at().er,"getConfig"),this.clear(),this.addEntity=this.addEntity.bind(this),this.addAttributes=this.addAttributes.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setDirection=this.setDirection.bind(this),this.addCssStyles=this.addCssStyles.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}addEntity(i,c=""){var h,o;return this.entities.has(i)?!((o=this.entities.get(i))!=null&&o.alias)&&c&&(this.entities.get(i).alias=c,M.info(`Add alias '${c}' to entity '${i}'`)):(this.entities.set(i,{id:`entity-${i}-${this.entities.size}`,label:i,attributes:[],alias:c,shape:"erBox",look:(h=at().look)!=null?h:"default",cssClasses:"default",cssStyles:[],labelType:"markdown"}),M.info("Added new entity :",i)),this.entities.get(i)}getEntity(i){return this.entities.get(i)}getEntities(){return this.entities}getClasses(){return this.classes}addAttributes(i,c){const h=this.addEntity(i);let o;for(o=c.length-1;o>=0;o--)c[o].keys||(c[o].keys=[]),c[o].comment||(c[o].comment=""),h.attributes.push(c[o]),M.debug("Added attribute ",c[o].name)}addRelationship(i,c,h,o){const d=this.entities.get(i),y=this.entities.get(h);if(!d||!y)return;const u={entityA:d.id,roleA:c,entityB:y.id,relSpec:o};this.relationships.push(u),M.debug("Added new relationship :",u)}getRelationships(){return this.relationships}getDirection(){return this.direction}setDirection(i){this.direction=i}getCompiledStyles(i){var h,o;let c=[];for(const d of i){const y=this.classes.get(d);y!=null&&y.styles&&(c=[...c,...(h=y.styles)!=null?h:[]].map(u=>u.trim())),y!=null&&y.textStyles&&(c=[...c,...(o=y.textStyles)!=null?o:[]].map(u=>u.trim()))}return c}addCssStyles(i,c){for(const h of i){const o=this.entities.get(h);if(!c||!o)return;for(const d of c)o.cssStyles.push(d)}}addClass(i,c){i.forEach(h=>{let o=this.classes.get(h);o===void 0&&(o={id:h,styles:[],textStyles:[]},this.classes.set(h,o)),c&&c.forEach(function(d){if(/color/.exec(d)){const y=d.replace("fill","bgFill");o.textStyles.push(y)}o.styles.push(d)})})}setClass(i,c){for(const h of i){const o=this.entities.get(h);if(o)for(const d of c)o.cssClasses+=" "+d}}clear(){this.entities=new Map,this.classes=new Map,this.relationships=[],Zt()}getData(){const i=[],c=[],h=at();let o=0;for(const y of this.entities.keys()){const u=this.entities.get(y);u&&(u.cssCompiledStyles=this.getCompiledStyles(u.cssClasses.split(" ")),u.colorIndex=o++,i.push(u))}let d=0;for(const y of this.relationships){const u={id:jt(y.entityA,y.entityB,{prefix:"id",counter:d++}),type:"normal",curve:"basis",start:y.entityA,end:y.entityB,label:y.roleA,labelpos:"c",thickness:"normal",classes:"relationshipLine",arrowTypeStart:y.relSpec.cardB.toLowerCase(),arrowTypeEnd:y.relSpec.cardA.toLowerCase(),pattern:y.relSpec.relType=="IDENTIFYING"?"solid":"dashed",look:h.look,labelType:"markdown"};c.push(u)}return{nodes:i,edges:c,other:{},config:h,direction:"TB"}}},p(B,"ErDB"),B),vt={};Qt(vt,{draw:()=>se});var se=p(async function(s,i,c,h){var F,S;M.info("REF0:"),M.info("Drawing er diagram (unified)",i);const{securityLevel:o,er:d,layout:y}=at(),u=h.db.getData(),k=Bt(i,o);u.type=h.type,u.layoutAlgorithm=Xt(y),u.config.flowchart.nodeSpacing=(d==null?void 0:d.nodeSpacing)||140,u.config.flowchart.rankSpacing=(d==null?void 0:d.rankSpacing)||80,u.direction=h.db.getDirection();const{config:X}=u,{look:H}=X;H==="neo"?u.markers=["only_one_neo","zero_or_one_neo","one_or_more_neo","zero_or_more_neo"]:u.markers=["only_one","zero_or_one","one_or_more","zero_or_more"],u.diagramId=i,await Ht(u,k),u.layoutAlgorithm==="elk"&&k.select(".edges").lower();const T=k.selectAll('[id*="-background"]');Array.from(T).length>0&&T.each(function(){const O=qt(this),x=O.attr("id").replace("-background",""),L=k.select(`#${CSS.escape(x)}`);if(!L.empty()){const Y=L.attr("transform");O.attr("transform",Y)}});const q=8;Jt.insertTitle(k,"erDiagramTitleText",(F=d==null?void 0:d.titleTopMargin)!=null?F:25,h.db.getDiagramTitle()),Ft(k,q,"erDiagram",(S=d==null?void 0:d.useMaxWidth)!=null?S:!0)},"draw"),Ct=p((s,i)=>{const c=$t,h=c(s,"r"),o=c(s,"g"),d=c(s,"b");return Wt(h,o,d,i)},"fade"),ct=new Set(["redux-color","redux-dark-color"]),ie=p(s=>{const{theme:i,look:c,bkgColorArray:h,borderColorArray:o}=s;if(!ct.has(i))return"";const d=(h==null?void 0:h.length)>0;let y="";for(let u=0;u<s.THEME_COLOR_LIMIT;u++)y+=`
7
+
8
+ [data-look="${c}"][data-color-id="color-${u}"].node path {
9
+ stroke: ${o[u]};
10
+ ${d?`fill: ${h[u]};`:""}
11
+ }
12
+
13
+ [data-look="${c}"][data-color-id="color-${u}"].node rect {
14
+ stroke: ${o[u]};
15
+ ${d?`fill: ${h[u]};`:""}
16
+ }
17
+ `;return y},"genColor"),re=p(s=>{const{look:i,theme:c,erEdgeLabelBackground:h,strokeWidth:o}=s;return`
18
+ ${ie(s)}
19
+ .entityBox {
20
+ fill: ${s.mainBkg};
21
+ stroke: ${s.nodeBorder};
22
+ }
23
+
24
+ .relationshipLabelBox {
25
+ fill: ${s.tertiaryColor};
26
+ opacity: 0.7;
27
+ background-color: ${s.tertiaryColor};
28
+ rect {
29
+ opacity: 0.5;
30
+ }
31
+ }
32
+
33
+ .labelBkg {
34
+ background-color: ${ct.has(c)&&h?h:Ct(s.tertiaryColor,.5)};
35
+ }
36
+
37
+ .edgeLabel {
38
+ background-color: ${ct.has(c)&&h?h:s.edgeLabelBackground};
39
+ }
40
+ .edgeLabel .label rect {
41
+ fill: ${ct.has(c)&&h?h:s.edgeLabelBackground};
42
+ }
43
+ .edgeLabel .label text {
44
+ fill: ${s.textColor};
45
+ }
46
+
47
+ .edgeLabel .label {
48
+ fill: ${s.nodeBorder};
49
+ font-size: 14px;
50
+ }
51
+
52
+ .label {
53
+ font-family: ${s.fontFamily};
54
+ color: ${s.nodeTextColor||s.textColor};
55
+ }
56
+
57
+ .edge-pattern-dashed {
58
+ stroke-dasharray: 8,8;
59
+ }
60
+
61
+ .node rect,
62
+ .node circle,
63
+ .node ellipse,
64
+ .node polygon
65
+ {
66
+ fill: ${s.mainBkg};
67
+ stroke: ${s.nodeBorder};
68
+ stroke-width: ${i==="neo"?o:"1px"};
69
+ }
70
+
71
+ .relationshipLine {
72
+ stroke: ${s.lineColor};
73
+ stroke-width: ${i==="neo"?o:"1px"};
74
+ fill: none;
75
+ }
76
+
77
+ .marker {
78
+ fill: none !important;
79
+ stroke: ${s.lineColor} !important;
80
+ stroke-width: 1;
81
+ }
82
+ [data-look=neo].labelBkg {
83
+ background-color: ${Ct(s.tertiaryColor,.5)};
84
+ }
85
+ `},"getStyles"),ne=re,ue={parser:te,get db(){return new ee},renderer:vt,styles:ne};export{ue as diagram};